/[RomCheater]/trunk/RomCheater/Serialization/SearchResultReader.cs
ViewVC logotype

Contents of /trunk/RomCheater/Serialization/SearchResultReader.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 486 - (show annotations) (download)
Mon Jun 3 20:11:43 2013 UTC (7 years, 3 months ago) by william
File size: 41964 byte(s)
+ allow the delete of result files, when reading (if delete is true)

1 #region Logging Defines
2 // include this any class or method that required logging, and comment-out what is not needed
3
4 #region Enabled logging levels
5 #define LOGGING_ENABLE_INFO
6 #define LOGGING_ENABLE_WARN
7 #define LOGGING_ENABLE_DEBUG
8 #define LOGGING_ENABLE_VERBOSEDEBUG
9 #define LOGGING_ENABLE_ERROR
10 #define LOGGING_ENABLE_VERBOSEERROR
11 #define LOGGING_ENABLE_PROFILER
12 #endregion
13 #endregion
14 using System;
15 using System.Collections.Generic;
16 using System.Linq;
17 using System.Text;
18 using RomCheater.Docking.MemorySearch;
19 using RomCheater.Logging;
20 using System.IO;
21 using Utilities.TransparentControls;
22 using Sojaner.MemoryScanner.MemoryProviers;
23 using RomCheater.PluginFramework.Interfaces;
24 using System.Windows.Forms;
25
26 namespace RomCheater.Serialization
27 {
28 public interface ISearchResultReader
29 {
30 ResultType<TValue> GetNextResult<TValue>() where TValue : IConvertible;
31 }
32 public class SearchResultReader : SerializationReader, ISearchResultReader
33 {
34
35 public delegate void update_progress(int progress, string message);
36
37 private Guid _ResultGuid;
38 private Guid ResultGuid { get { return _ResultGuid; } set { _ResultGuid = value; } }
39
40 private long ResultDataOffset = 0;
41 //private long CurrentResultOffset = 0;
42 //public SearchResultReader() : base() { ReadHeader(); }
43 public SearchResultReader(Guid guid) : this(guid, false) { }
44 public SearchResultReader(Guid guid, bool delete) : base(guid, delete) { ResultGuid = guid; ReadHeader(); }
45
46 protected override string TemporaryFolder { get { return SearchResultsConstants.SearchResultsFolder; } }
47 private void ReadHeader()
48 {
49 try
50 {
51 using (FileStream fs = CreateReader())
52 {
53 using (BinaryReader binReader = new BinaryReader(fs))
54 {
55 //int ResultsRead = 0;
56 // SRD (string)
57 string magic = Encoding.UTF8.GetString(binReader.ReadBytes(3));
58 string SRD = "SRD";
59 if (magic != SRD)
60 {
61 throw new InvalidOperationException(string.Format("Encountered unexpected magic: {0} expected: {1}", magic, SRD));
62 }
63 // version (int)
64 int version = binReader.ReadInt32();
65
66 if (version == 1)
67 {
68 // do nothing
69 }
70 else if (version == 2)
71 {
72 int guid_array_length = binReader.ReadInt32();
73 byte[] guid_array = new byte[guid_array_length];
74 binReader.Read(guid_array, 0, guid_array_length);
75 Guid g = new Guid(guid_array);
76 if (g != ResultGuid)
77 {
78 throw new InvalidOperationException(string.Format("Encountered wrong search results guid: read '{1}' excpected '{2}'", g.ToString(), ResultGuid.ToString()));
79 }
80 }
81 else
82 {
83 throw new InvalidOperationException(string.Format("Encountered unexpected version: {0} expected: {1} or {2}", version, 1, 2));
84 }
85 // resultcount
86 int resultcount = binReader.ReadInt32();
87 if (resultcount == 0)
88 {
89 throw new InvalidOperationException(string.Format("Result Count is zero"));
90 }
91 ResultCount = resultcount;
92 ResultDataOffset = binReader.BaseStream.Position;
93 //for (int i = 0; i < ResultCount; i++)
94 //{
95 // try
96 // {
97 // ResultsRead = i;
98 // uint address = 0;
99 // // assume uint for data type
100 // uint value = 0;
101 // address = binReader.ReadUInt32();
102 // value = binReader.ReadUInt32();
103 // //if (i % 100000 == 0)
104 // // logger.VerboseDebug.WriteLine("Result: @0x{0:x8}=0x{1:x8}", address, value);
105 // }
106 // catch (Exception ex)
107 // {
108 // logger.VerboseError.WriteLine("SearchResultReader.ReadHeader():Consistency Check");
109 // //logger.VerboseError.WriteLine(ex.ToString());
110 // logger.VerboseError.WriteLine("Faied entry: {0}", ResultsRead);
111 // break;
112 // }
113 // ResultsRead++; // add 1
114 //}
115 ////throw new NotImplementedException("DEBUG: testing SearchResultReader consistency");
116 //if (ResultCount != ResultsRead)
117 //{
118 // throw new InvalidOperationException(string.Format("ResultCount does not match ResultsRead: 0x{0:x8} != 0x{1:x8}", ResultCount, ResultsRead));
119 //}
120 binReader.Close();
121 }
122 fs.Close();
123 }
124 }
125 catch (System.IO.EndOfStreamException) { }
126 }
127 #region ISearchResultReader members
128 public bool ReadCurrentAddess { get; private set; }
129 public bool ReadCurrentValue { get; private set; }
130
131 [Obsolete("GetNextResult has been replaced by GetResults")]
132 public ResultType<TValue> GetNextResult<TValue>() where TValue : IConvertible
133 {
134 return new ResultType<TValue>();
135 }
136 #endregion
137
138
139 public ResultItem[] GetResultItems(bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress)
140 {
141 var arr = GetResults(unsigned, datatype, update_progress);
142 ResultItem[] items = new ResultItem[arr.Count()];
143 for (int i = 0; i < items.Count(); i++)
144 {
145 var v = arr[i];
146 switch (datatype)
147 {
148 case SearchDataTypes._8bits:
149 if (unsigned) { items[i] = new ResultItem(v.Address, false, Convert.ToByte(v.Value)); }
150 else { items[i] = new ResultItem(v.Address, false, Convert.ToSByte(v.Value)); }
151 break;
152 case SearchDataTypes._16bits:
153 if (unsigned) { items[i] = new ResultItem(v.Address, false, Convert.ToUInt16(v.Value)); }
154 else { items[i] = new ResultItem(v.Address, false, Convert.ToInt16(v.Value)); }
155 break;
156 case SearchDataTypes._32bits:
157 if (unsigned) { items[i] = new ResultItem(v.Address, false, Convert.ToUInt32(v.Value)); }
158 else { items[i] = new ResultItem(v.Address, false, Convert.ToInt32(v.Value)); }
159 break;
160 case SearchDataTypes._64bits:
161 if (unsigned) { items[i] = new ResultItem(v.Address, false, Convert.ToUInt64(v.Value)); }
162 else { items[i] = new ResultItem(v.Address, false, Convert.ToInt64(v.Value)); }
163 break;
164 }
165 //arr[i] = null; // free memory used by the data
166 }
167 return items;
168 }
169
170
171 public uint[] GetResultAddresses(bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress)
172 {
173 var arr = GetResults(unsigned, datatype, update_progress);
174 uint[] items = new uint[arr.Count()];
175 for (int i = 0; i < items.Count(); i++)
176 {
177 var v = arr[i];
178 items[i] = v.Address;
179 //arr[i] = null; // free memory used by the data
180 }
181 return items;
182 }
183 public StructResultType<ulong>[] GetResults(bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress)
184 {
185 return GetResultsInternal(unsigned, datatype, update_progress);
186 }
187
188 private StructResultType<ulong>[] GetResultsInternal(bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress)
189 {
190 update_progress.Invoke(0, string.Empty);
191 int Last_Whole_Percent_Done = 0;
192
193 StructResultType<ulong>[] results = new StructResultType<ulong>[ResultCount];
194 using (FileStream fs = CreateReader())
195 {
196 using (BinaryReader binReader = new BinaryReader(fs))
197 {
198
199 binReader.BaseStream.Seek(ResultDataOffset, SeekOrigin.Begin); // seek to start of result data
200 for (int i = 0; i < ResultCount; i++)
201 {
202 uint Address = binReader.ReadUInt32();
203 ulong Value = 0;
204 switch (datatype)
205 {
206 case SearchDataTypes._8bits:
207 if (unsigned) { Value = binReader.ReadByte(); } else { Value = (ulong)binReader.ReadSByte(); }
208 break;
209 case SearchDataTypes._16bits:
210 if (unsigned) { Value = binReader.ReadUInt16(); } else { Value = (ulong)binReader.ReadInt16(); }
211 break;
212 case SearchDataTypes._32bits:
213 if (unsigned) { Value = binReader.ReadUInt32(); } else { Value = (ulong)binReader.ReadInt32(); }
214 break;
215 case SearchDataTypes._64bits:
216 if (unsigned) { Value = binReader.ReadUInt64(); } else { Value = (ulong)binReader.ReadInt64(); }
217 break;
218 }
219 results[i] = new StructResultType<ulong>(Address, Value);
220
221 double double_percent_done = 100.0 * (double)((double)i / (double)ResultCount);
222 int int_percent_done = (int)double_percent_done;
223 if (int_percent_done != Last_Whole_Percent_Done && i % 100000 == 0)
224 {
225 if (int_percent_done <= 100)
226 {
227 update_progress.Invoke(int_percent_done, string.Format(" -> Loading value for Address: 0x{0:x8}", Address));
228 Last_Whole_Percent_Done = int_percent_done;
229 }
230 }
231 }
232 }
233 }
234 update_progress.Invoke(0, string.Empty);
235 return results;
236 }
237
238 public uint[] GetAddressRangeAtIndex(int index, int count, bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress)
239 {
240 uint[] results = new uint[index + count];
241 for (int i = 0; i < count; i++)
242 {
243 uint result = GetAddressAtIndex(i + index, unsigned, datatype, update_progress);
244 results[i] = result;
245 //double percent = 100.0 * ((double)i / (double)count);
246 //update_progress.Invoke((int)percent, string.Format("-> Reading Address: 0x{1:x8} from index: 0x{1:x8}", results[i].Address, i + index));
247 }
248 return results;
249 }
250
251 public StructResultType<ulong>[] GetResultRangeAtIndex(int index, int count, bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress)
252 {
253 StructResultType<ulong>[] results = new StructResultType<ulong>[index + count];
254 for (int i = 0; i < count; i++)
255 {
256 StructResultType<ulong> result = GetResultAtIndex(i + index, unsigned, datatype, update_progress);
257 results[i] = result;
258 //double percent = 100.0 * ((double)i / (double)count);
259 //update_progress.Invoke((int)percent, string.Format("-> Reading Address: 0x{1:x8} from index: 0x{1:x8}", results[i].Address, i + index));
260 }
261 return results;
262 }
263 public uint GetAddressAtIndex(int index, bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress)
264 {
265 //update_progress.Invoke(0, string.Empty);
266 int data_size = sizeof(uint); // address size ... should be 4 bytes (could be 8, if we have a 64-bit address)
267 uint result = 0;
268 using (FileStream fs = CreateReader())
269 {
270 using (BinaryReader binReader = new BinaryReader(fs))
271 {
272 binReader.BaseStream.Seek(ResultDataOffset, SeekOrigin.Begin); // seek to start of result data
273 data_size += (int)datatype / 8;
274 long offset = data_size * index;
275 binReader.BaseStream.Seek(offset, SeekOrigin.Current);
276 uint Address = binReader.ReadUInt32();
277 object Value = 0;
278 switch (datatype)
279 {
280 case SearchDataTypes._8bits:
281 if (unsigned) { Value = binReader.ReadByte(); } else { Value = binReader.ReadSByte(); }
282 break;
283 case SearchDataTypes._16bits:
284 if (unsigned) { Value = binReader.ReadUInt16(); } else { Value = binReader.ReadInt16(); }
285 break;
286 case SearchDataTypes._32bits:
287 if (unsigned) { Value = binReader.ReadUInt32(); } else { Value = binReader.ReadInt32(); }
288 break;
289 case SearchDataTypes._64bits:
290 if (unsigned) { Value = binReader.ReadUInt64(); } else { Value = binReader.ReadInt64(); }
291 break;
292 }
293 result = Address;
294 }
295 }
296 return result;
297 }
298 public StructResultType<ulong> GetResultAtIndex(int index, bool unsigned, SearchDataTypes datatype, Action<int, string> update_progress)
299 {
300 //update_progress.Invoke(0, string.Empty);
301 int data_size = sizeof(uint); // address size ... should be 4 bytes (could be 8, if we have a 64-bit address)
302 StructResultType<ulong> result = StructResultType<ulong>.Empty;
303 using (FileStream fs = CreateReader())
304 {
305 using (BinaryReader binReader = new BinaryReader(fs))
306 {
307 binReader.BaseStream.Seek(ResultDataOffset, SeekOrigin.Begin); // seek to start of result data
308 data_size += (int)datatype / 8;
309 long offset = data_size * index;
310 binReader.BaseStream.Seek(offset, SeekOrigin.Current);
311 uint Address = binReader.ReadUInt32();
312 ulong Value = 0;
313 switch (datatype)
314 {
315 case SearchDataTypes._8bits:
316 if (unsigned) { Value = binReader.ReadByte(); } else { Value = (ulong)binReader.ReadSByte(); }
317 break;
318 case SearchDataTypes._16bits:
319 if (unsigned) { Value = binReader.ReadUInt16(); } else { Value = (ulong)binReader.ReadInt16(); }
320 break;
321 case SearchDataTypes._32bits:
322 if (unsigned) { Value = binReader.ReadUInt32(); } else { Value = (ulong)binReader.ReadInt32(); }
323 break;
324 case SearchDataTypes._64bits:
325 if (unsigned) { Value = binReader.ReadUInt64(); } else { Value = (ulong)binReader.ReadInt64(); }
326 break;
327 }
328 result = new StructResultType<ulong>(Address, Value);
329 }
330 }
331 return result;
332 }
333
334 public StructResultType<ulong>[] GetSearchAddressValueMatches(IAcceptsProcessAndConfig iapc, SearchType SearchArgs, Action<int, string> update_progress)
335 {
336
337 //int Last_Whole_Percent_Done = 0;
338 bool unsigned = SearchArgs.IsUnsignedDataType;
339 SearchDataTypes sdt = SearchArgs.DataType;
340 List<StructResultType<ulong>> foundAddresses = new List<StructResultType<ulong>>();
341 //var addresses = this.GetResultAddresses(unsigned, sdt, update_progress);
342 const int item_count = 0x1000;
343 int totalcount = this.ResultCount;
344 update_progress.Invoke(0, string.Format(" -> Reading 0x{1:x8} total Address Indices (0x{1:x8} indicies at a time) ... Please wait ...", this.ResultCount, item_count));
345 for (int i = 0; i < this.ResultCount; i += item_count)
346 {
347 //int count = 0;
348 var addresses = this.GetAddressRangeAtIndex(i, item_count, unsigned, sdt, update_progress);
349 uint STEP_SIZE = (uint)sdt / 8;
350 for (int j = 0; j < addresses.Length; j++)
351 {
352 var address = addresses[j];
353 //foreach (var address in addresses)
354 //{
355 #region t
356 byte[] data = new byte[0];
357 using (GenericMemoryProvider provider = new GenericMemoryProvider(iapc))
358 {
359 int bytesRead = 0;
360 provider.OpenProvider();
361 provider.ReadProcessMemory(address, STEP_SIZE, out bytesRead, out data);
362 provider.CloseProvider();
363 }
364 using (MemoryStream ms = new MemoryStream(data))
365 {
366 using (BinaryReader br = new BinaryReader(ms))
367 {
368 #region comparison
369 switch (sdt)
370 {
371 case SearchDataTypes._8bits:
372 if (unsigned)
373 {
374 #region 8bits - unsigned
375 var Value = br.ReadByte();
376 using (_8bit_unsigned_comparer_ comparer = new _8bit_unsigned_comparer_(SearchArgs, address))
377 {
378 byte value = 0;
379 if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
380 {
381 using (GenericMemoryProvider gmp = new GenericMemoryProvider(iapc))
382 {
383 try
384 {
385 gmp.OpenProvider();
386 gmp.ReadMemory(address, out value);
387 gmp.CloseProvider();
388 }
389 catch (Exception ex)
390 {
391 logger.VerboseError.WriteLine(ex.ToString());
392 }
393 }
394 comparer.Value = value;
395 }
396 else
397 {
398 value = Convert.ToByte(SearchArgs.CompareStartValue);
399 comparer.Value = value;
400 }
401 if (comparer.Compare(Convert.ToByte(Value), value))
402 {
403 foundAddresses.Add(new StructResultType<ulong>(comparer.Address, (ulong)comparer.Value));
404 }
405 }
406 #endregion
407 }
408 else
409 {
410 #region 8bits - signed
411 var Value = br.ReadSByte();
412 using (_8bit_signed_comparer_ comparer = new _8bit_signed_comparer_(SearchArgs, address))
413 {
414 sbyte value = 0;
415 if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
416 {
417 using (GenericMemoryProvider gmp = new GenericMemoryProvider(iapc))
418 {
419 try
420 {
421 gmp.OpenProvider();
422 gmp.ReadMemory(address, out value);
423 gmp.CloseProvider();
424 }
425 catch (Exception ex)
426 {
427 logger.VerboseError.WriteLine(ex.ToString());
428 }
429 }
430 comparer.Value = value;
431 }
432 else
433 {
434 value = Convert.ToSByte(SearchArgs.CompareStartValue);
435 comparer.Value = value;
436 }
437 if (comparer.Compare(Convert.ToSByte(Value), value))
438 {
439 foundAddresses.Add(new StructResultType<ulong>(comparer.Address, (ulong)comparer.Value));
440 }
441 }
442 #endregion
443 }
444 break;
445 case SearchDataTypes._16bits:
446 if (unsigned)
447 {
448 #region 16bits - unsigned
449 var Value = br.ReadUInt16();
450 using (_16bit_unsigned_comparer_ comparer = new _16bit_unsigned_comparer_(SearchArgs, address))
451 {
452 ushort value = 0;
453 if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
454 {
455 using (GenericMemoryProvider gmp = new GenericMemoryProvider(iapc))
456 {
457 try
458 {
459 gmp.OpenProvider();
460 gmp.ReadMemory(address, out value);
461 gmp.CloseProvider();
462 }
463 catch (Exception ex)
464 {
465 logger.VerboseError.WriteLine(ex.ToString());
466 }
467 }
468 comparer.Value = value;
469 }
470 else
471 {
472 value = Convert.ToUInt16(SearchArgs.CompareStartValue);
473 comparer.Value = value;
474 }
475 if (comparer.Compare(Convert.ToUInt16(Value), value))
476 {
477 foundAddresses.Add(new StructResultType<ulong>(comparer.Address, (ulong)comparer.Value));
478 }
479 }
480 #endregion
481 }
482 else
483 {
484 #region 16bits - signed
485 var Value = br.ReadInt16();
486 using (_16bit_signed_comparer_ comparer = new _16bit_signed_comparer_(SearchArgs, address))
487 {
488 short value = 0;
489 if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
490 {
491 using (GenericMemoryProvider gmp = new GenericMemoryProvider(iapc))
492 {
493 try
494 {
495 gmp.OpenProvider();
496 gmp.ReadMemory(address, out value);
497 gmp.CloseProvider();
498 }
499 catch (Exception ex)
500 {
501 logger.VerboseError.WriteLine(ex.ToString());
502 }
503 }
504 comparer.Value = value;
505 }
506 else
507 {
508 value = Convert.ToInt16(SearchArgs.CompareStartValue);
509 comparer.Value = value;
510 }
511 if (comparer.Compare(Convert.ToInt16(Value), value))
512 {
513 foundAddresses.Add(new StructResultType<ulong>(comparer.Address, (ulong)comparer.Value));
514 }
515 }
516 #endregion
517 }
518 break;
519 case SearchDataTypes._32bits:
520 if (unsigned)
521 {
522 #region 32bits - unsigned
523 var Value = br.ReadUInt32();
524 using (_32bit_unsigned_comparer_ comparer = new _32bit_unsigned_comparer_(SearchArgs, address))
525 {
526 uint value = 0;
527 if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
528 {
529 using (GenericMemoryProvider gmp = new GenericMemoryProvider(iapc))
530 {
531 try
532 {
533 gmp.OpenProvider();
534 gmp.ReadMemory(address, out value);
535 gmp.CloseProvider();
536 }
537 catch (Exception ex)
538 {
539 logger.VerboseError.WriteLine(ex.ToString());
540 }
541 }
542 comparer.Value = value;
543 }
544 else
545 {
546 value = Convert.ToUInt32(SearchArgs.CompareStartValue);
547 comparer.Value = value;
548 }
549 if (comparer.Compare(Convert.ToUInt32(Value), value))
550 {
551 foundAddresses.Add(new StructResultType<ulong>(comparer.Address, (ulong)comparer.Value));
552 }
553 }
554 #endregion
555 }
556 else
557 {
558 #region 32bits - signed
559 var Value = br.ReadInt32();
560 using (_32bit_signed_comparer_ comparer = new _32bit_signed_comparer_(SearchArgs, address))
561 {
562 int value = 0;
563 if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
564 {
565 using (GenericMemoryProvider gmp = new GenericMemoryProvider(iapc))
566 {
567 try
568 {
569 gmp.OpenProvider();
570 gmp.ReadMemory(address, out value);
571 gmp.CloseProvider();
572 }
573 catch (Exception ex)
574 {
575 logger.VerboseError.WriteLine(ex.ToString());
576 }
577 }
578 comparer.Value = value;
579 }
580 else
581 {
582 value = Convert.ToInt32(SearchArgs.CompareStartValue);
583 comparer.Value = value;
584 }
585 if (comparer.Compare(Convert.ToInt32(Value), value))
586 {
587 foundAddresses.Add(new StructResultType<ulong>(comparer.Address, (ulong)comparer.Value));
588 }
589 }
590 #endregion
591 }
592 break;
593 case SearchDataTypes._64bits:
594 if (unsigned)
595 {
596 #region 64bits - unsigned
597 var Value = br.ReadUInt64();
598 using (_64bit_unsigned_comparer_ comparer = new _64bit_unsigned_comparer_(SearchArgs, address))
599 {
600 ulong value = 0;
601 if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
602 {
603 using (GenericMemoryProvider gmp = new GenericMemoryProvider(iapc))
604 {
605 try
606 {
607 gmp.OpenProvider();
608 gmp.ReadMemory(address, out value);
609 gmp.CloseProvider();
610 }
611 catch (Exception ex)
612 {
613 logger.VerboseError.WriteLine(ex.ToString());
614 }
615 }
616 comparer.Value = value;
617 }
618 else
619 {
620 value = Convert.ToUInt64(SearchArgs.CompareStartValue);
621 comparer.Value = value;
622 }
623 if (comparer.Compare(Convert.ToUInt64(Value), value))
624 {
625 foundAddresses.Add(new StructResultType<ulong>(comparer.Address, (ulong)comparer.Value));
626 }
627 }
628 #endregion
629 }
630 else
631 {
632 #region 64bits - signed
633 var Value = br.ReadInt64();
634 using (_64bit_signed_comparer_ comparer = new _64bit_signed_comparer_(SearchArgs, address))
635 {
636 long value = 0;
637 if (SearchArgs.CompareValueType == CompareValueTypes.OldValue)
638 {
639 using (GenericMemoryProvider gmp = new GenericMemoryProvider(iapc))
640 {
641 try
642 {
643 gmp.OpenProvider();
644 gmp.ReadMemory(address, out value);
645 gmp.CloseProvider();
646 }
647 catch (Exception ex)
648 {
649 logger.VerboseError.WriteLine(ex.ToString());
650 }
651 }
652 comparer.Value = value;
653 }
654 else
655 {
656 value = Convert.ToInt64(SearchArgs.CompareStartValue);
657 comparer.Value = value;
658 }
659 if (comparer.Compare(Convert.ToInt64(Value), value))
660 {
661 foundAddresses.Add(new StructResultType<ulong>(comparer.Address, (ulong)comparer.Value));
662 }
663 }
664 #endregion
665 }
666 break;
667 }
668 #endregion
669 }
670 }
671
672 //double double_percent_done1 = 100.0 * (double)((double)j / (double)addresses.Length);
673 //int int_percent_done1 = (int)double_percent_done1;
674 //if (j % 10 == 0)
675 //{
676 // if (int_percent_done1 <= 100)
677 // {
678 // update_progress.Invoke(int_percent_done1, string.Format(" -> Reading Index: 0x{0:x8} of 0x{1:x8}", j, item_count));
679 // //Last_Whole_Percent_Done = int_percent_done1;
680 // }
681 //}
682
683 //count++;
684 #endregion
685 //}
686 }
687 double double_percent_done2 = 100.0 * (double)((double)i / (double)totalcount);
688 int int_percent_done2 = (int)double_percent_done2;
689 if (i % (item_count * 2) == 0)
690 {
691 if (int_percent_done2 <= 100)
692 {
693 update_progress.Invoke(int_percent_done2, string.Format(" -> Read 0x{0:x8} indicies for Address Indice: 0x{1:x8} of 0x{2:x8}", item_count, i, totalcount));
694 //Last_Whole_Percent_Done = int_percent_done;
695 }
696 }
697 }
698 return foundAddresses.ToArray();
699 }
700
701 }
702 }

  ViewVC Help
Powered by ViewVC 1.1.22