/[RomCheater]/trunk/RomCheater/Docking/FloatingMemorySearcher.cs
ViewVC logotype

Diff of /trunk/RomCheater/Docking/FloatingMemorySearcher.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2013/06/03 18:35:45	477
+++ trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2013/06/03 19:59:25	483
@@ -1766,7 +1766,7 @@
         private void SearchWorkerThread_DoWork(object sender, DoWorkEventArgs e)
         {
             try
-            {             
+            {
                 Stopwatch st = new Stopwatch();
                 st.Start();
 
@@ -1790,7 +1790,7 @@
                 provider_st.Start();
                 using (GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
                 {
-                   
+
                     if (SearchArgs.IsFirstSearch)
                     {
                         provider.OpenProvider();
@@ -1824,7 +1824,7 @@
                             //const int item_count = 0x100;
                             using (SearchResultWriter writer = new SearchResultWriter((int)(reader.ResultCount), new_SearchGuid))
                             {
-                                var items = reader.GetSearchAddressValueMatches((IAcceptsProcessAndConfig)this,SearchArgs, new Action<int, string>(UpdateProgress));
+                                var items = reader.GetSearchAddressValueMatches((IAcceptsProcessAndConfig)this, SearchArgs, new Action<int, string>(UpdateProgress));
 
                                 foreach (var item in items)
                                 {
@@ -2313,7 +2313,7 @@
                                                 //if (int_percent_done != Last_Whole_Percent_Done && i % 100000 == 0)
                                                 //{
                                                 if (int_percent_done <= 100)
-                                                {                                                    
+                                                {
                                                     //Last_Whole_Percent_Done = int_percent_done;
                                                     new Action<int, string>(UpdateProgress).Invoke(int_percent_done, string.Format(" -> Reading Address: 0x{0:x8}", i + MemoryRangeStart));
                                                 }
@@ -2353,7 +2353,7 @@
                             for (int i = 0; i < reader.ResultCount; i += 1)
                             {
                                 uint address = 0;
-                                #region switch (SearchArgs.DataType)
+                    #region switch (SearchArgs.DataType)
                                 switch (SearchArgs.DataType)
                                 {
                                     case SearchDataTypes._8bits: if (unsigned) { using (ResultType<byte> result = reader.GetNextResult<byte>()) { address = result.Address; } }
@@ -2449,6 +2449,14 @@
                 //    second_tmp_Results = null; // free memory                       
                 //}
             }
+            catch (OutOfMemoryException ex)
+            {
+                e.Result = true;
+                logger.Error.WriteLine("Encounted {0} for search: {0}", ex.GetType().Name, SearchGuid.ToString());
+                logger.VerboseError.WriteLine(ex.ToString());
+                MessageBox.Show(string.Format("Encounted {0} for search: {0} ... Please try again.", ex.GetType().Name, SearchGuid.ToString()), string.Format("{0} was thrown", ex.GetType().Name), MessageBoxButtons.OK, MessageBoxIcon.Error);
+                return;
+            }
             catch (Exception ex)
             {
                 throw ex;

 

  ViewVC Help
Powered by ViewVC 1.1.22