/[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	2012/06/21 07:13:04	403
+++ trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2012/06/21 14:38:54	405
@@ -1064,7 +1064,9 @@
                         st_first_search.Start();
                         //SearchArgs.Results.Clear();
                         r_ms.BaseStream.Seek(0, SeekOrigin.Begin);
-                        using (SearchResultWriter writer = new SearchResultWriter((int)buffered_mem.Length / (int)STEP_SIZE))
+                        int count = (int)buffered_mem.Length / (int)STEP_SIZE;
+                        #region using (SearchResultWriter writer = new SearchResultWriter(count))
+                        using (SearchResultWriter writer = new SearchResultWriter(count))
                         {
                             //List<ResultType<object>> results_list = new List<ResultType<object>>();
                             //for (uint i = 0; i < buffered_mem.Length; i += STEP_SIZE)
@@ -1095,19 +1097,23 @@
                                 int int_percent_done = (int)double_percent_done;
                                 if (int_percent_done != Last_Whole_Percent_Done)
                                 {
-                                    resultsprogress.Value = int_percent_done;
-                                    resultsprogress.Message = string.Format(" -> Reading Address: 0x{0:x8}", (r_ms.BaseStream.Position + MemoryRangeStart));
-                                    Last_Whole_Percent_Done = int_percent_done;
-                                    //Application.DoEvents();
+                                    if (int_percent_done <= 100)
+                                    {
+                                        resultsprogress.Value = int_percent_done;
+                                        resultsprogress.Message = string.Format(" -> Reading Address: 0x{0:x8}", (r_ms.BaseStream.Position + MemoryRangeStart));
+                                        Last_Whole_Percent_Done = int_percent_done;
+                                    }
                                 }
                             }
                             if (SearchWorkerThread.CancellationPending == true)
-                                {
-                                    e.Cancel = true;
-                                    return;
-                                }
-                            #endregion                  
+                            {
+                                e.Cancel = true;
+                                return;
+                            }
+                            #endregion
                         }
+                        #endregion
+                        
                         //}
                         //SearchArgs.Results.AddRange(results_list);
                         //results_list = null;
@@ -1116,6 +1122,7 @@
                         //Application.DoEvents();
                         st_first_search.Stop();
                         logger.Profiler.WriteLine("First search took a total of {0} seconds to complete.", st_first_search.Elapsed.TotalSeconds);
+                        Last_Whole_Percent_Done = 0;
                     }
                     #endregion
 
@@ -1363,16 +1370,19 @@
                                     int int_percent_done = (int)double_percent_done;
                                     if (int_percent_done != Last_Whole_Percent_Done)
                                     {
-                                        resultsprogress.Value = int_percent_done;
-                                        resultsprogress.Message = string.Format(" -> Reading Address: 0x{0:x8}", i + MemoryRangeStart);
-                                        Last_Whole_Percent_Done = int_percent_done;
-                                        //Application.DoEvents();
+                                        if (int_percent_done <= 100)
+                                        {
+                                            resultsprogress.Value = int_percent_done;
+                                            resultsprogress.Message = string.Format(" -> Reading Address: 0x{0:x8}", i + MemoryRangeStart);
+                                            Last_Whole_Percent_Done = int_percent_done;
+                                        }
                                     }
 
                                 }
                             }
                             st_nonrange_search.Stop();
                             logger.Profiler.WriteLine("Non-Ranged search took a total of {0} seconds to complete.", st_nonrange_search.Elapsed.TotalSeconds);
+                            Last_Whole_Percent_Done = 0;
                             #endregion
                         }
                         #region Ranged Searches
@@ -1419,10 +1429,12 @@
                                     int int_percent_done = (int)double_percent_done;
                                     if (int_percent_done != Last_Whole_Percent_Done)
                                     {
-                                        resultsprogress.Value = int_percent_done;
-                                        resultsprogress.Message = string.Format(" -> Reading Address: 0x{0:x8}", i + MemoryRangeStart);
-                                        Last_Whole_Percent_Done = int_percent_done;
-                                        //Application.DoEvents();
+                                        if (int_percent_done <= 100)
+                                        {
+                                            resultsprogress.Value = int_percent_done;
+                                            resultsprogress.Message = string.Format(" -> Reading Address: 0x{0:x8}", i + MemoryRangeStart);
+                                            Last_Whole_Percent_Done = int_percent_done;
+                                        }
                                     }
                                 }
                             }

 

  ViewVC Help
Powered by ViewVC 1.1.22