/[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

revision 445 by william, Sun Jun 2 19:21:16 2013 UTC revision 446 by william, Sun Jun 2 19:52:03 2013 UTC
# Line 1044  namespace RomCheater.Docking Line 1044  namespace RomCheater.Docking
1044          }          }
1045          private void search_provider_OnBytesRead(OnBytesReadEventArgs e)          private void search_provider_OnBytesRead(OnBytesReadEventArgs e)
1046          {          {
1047                if (SearchWorkerThread.CancellationPending) { e.Canceled = true; return; }
1048              SearchDataTypes sdt = SearchArgs.DataType;              SearchDataTypes sdt = SearchArgs.DataType;
1049              bool unsigned = SearchArgs.IsUnsignedDataType;              bool unsigned = SearchArgs.IsUnsignedDataType;
1050              int Last_Whole_Percent_Done = 0;              int Last_Whole_Percent_Done = 0;
# Line 1076  namespace RomCheater.Docking Line 1077  namespace RomCheater.Docking
1077                                          if (unsigned) { writer.WriteResult<UInt64>((uint)CurrentIndex, br.ReadUInt64()); }                                          if (unsigned) { writer.WriteResult<UInt64>((uint)CurrentIndex, br.ReadUInt64()); }
1078                                          else { writer.WriteResult<Int64>((uint)CurrentIndex, br.ReadInt64()); } break;                                          else { writer.WriteResult<Int64>((uint)CurrentIndex, br.ReadInt64()); } break;
1079                                  }                                  }
1080                                    if (SearchWorkerThread.CancellationPending) { e.Canceled = true; return; }
1081                              }                              }
1082                              catch (EndOfStreamException) { }                              catch (EndOfStreamException) { }
1083                              double double_percent_done = 100.0 * (double)((double)CurrentIndex / (double)e.TotalCount);                              double double_percent_done = 100.0 * (double)((double)CurrentIndex / (double)e.TotalCount);
# Line 1088  namespace RomCheater.Docking Line 1090  namespace RomCheater.Docking
1090                                      resultsprogress.Message = string.Format(" -> Reading Address: 0x{0:x8}", (CurrentIndex + MemoryRangeStart));                                      resultsprogress.Message = string.Format(" -> Reading Address: 0x{0:x8}", (CurrentIndex + MemoryRangeStart));
1091                                      Last_Whole_Percent_Done = int_percent_done;                                      Last_Whole_Percent_Done = int_percent_done;
1092                                  }                                  }
1093                                    if (SearchWorkerThread.CancellationPending) { e.Canceled = true; return; }
1094                              }                              }
1095                              switch (sdt)                              switch (sdt)
1096                              {                              {
# Line 1109  namespace RomCheater.Docking Line 1112  namespace RomCheater.Docking
1112                      }                      }
1113                  }                  }
1114              }              }
1115                if (SearchWorkerThread.CancellationPending) { e.Canceled = true; return; }
1116          }          }
1117          private void SearchWorkerThread_DoWork(object sender, DoWorkEventArgs e)          private void SearchWorkerThread_DoWork(object sender, DoWorkEventArgs e)
1118          {          {
# Line 1145  namespace RomCheater.Docking Line 1149  namespace RomCheater.Docking
1149                      provider.OnBytesRead += new BaseEventHandler<OnBytesReadEventArgs>(search_provider_OnBytesRead);                      provider.OnBytesRead += new BaseEventHandler<OnBytesReadEventArgs>(search_provider_OnBytesRead);
1150                      provider.ReadProcessMemoryAtOnce(MemoryRangeStart, (MemoryRangeSize - MemoryRangeStart), writer);                      provider.ReadProcessMemoryAtOnce(MemoryRangeStart, (MemoryRangeSize - MemoryRangeStart), writer);
1151                      provider.CloseProvider();                      provider.CloseProvider();
1152                        if (SearchWorkerThread.CancellationPending) { provider_st.Stop(); st.Stop(); writer.CancelRequest(); e.Result = true; return; }
1153                      writer.Dispose();                      writer.Dispose();
1154                  }                  }
1155                  provider_st.Stop();                  provider_st.Stop();
# Line 1725  namespace RomCheater.Docking Line 1730  namespace RomCheater.Docking
1730    
1731          private void SearchWorkerThread_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)          private void SearchWorkerThread_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
1732          {          {
1733              if (!e.Cancelled)              try { if ((bool)e.Result) { logger.Warn.WriteLine("Search operation was cancelled."); resultsprogress.Value = 0; resultsprogress.Message = ""; return; } }
1734                catch (InvalidCastException) { }
1735                try
1736              {              {
1737                  Stopwatch st = (e.Result as Stopwatch);                  Stopwatch st = (Stopwatch)e.Result;
1738                  st.Stop();                  st.Stop();
1739                  logger.Profiler.WriteLine("Search took {0} seconds, overall, to complete.", st.Elapsed.TotalSeconds);                  logger.Profiler.WriteLine("Search took {0} seconds, overall, to complete.", st.Elapsed.TotalSeconds);
1740              }              }
1741                            catch (InvalidCastException) { }
1742                catch (Exception ex) { throw ex; }
1743    
1744              resultsprogress.Value = 100;              resultsprogress.Value = 100;
1745              bool unsigned = SearchArgs.IsUnsignedDataType;              bool unsigned = SearchArgs.IsUnsignedDataType;
1746              using (SearchResultReader reader = new SearchResultReader(SearchGuid))              using (SearchResultReader reader = new SearchResultReader(SearchGuid))

Legend:
Removed from v.445  
changed lines
  Added in v.446

  ViewVC Help
Powered by ViewVC 1.1.22