/[RomCheater]/trunk/RomCheater/Docking/MemorySearch/NotInRangeComparer.cs
ViewVC logotype

Contents of /trunk/RomCheater/Docking/MemorySearch/NotInRangeComparer.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 384 - (show annotations) (download)
Tue Jun 19 10:15:53 2012 UTC (9 years, 3 months ago) by william
File size: 3950 byte(s)

1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.IO;
6
7 namespace RomCheater.Docking.MemorySearch
8 {
9 public class NotInRangeComparer : RangedComparer<object>, IRangeComparer<object>
10 {
11 public NotInRangeComparer(uint address, object value)
12 : base(address, value)
13 {
14 }
15
16 #region IRangeComparer<object> Members
17 public bool Compare(object Start, object End, SearchDataTypes bitsize, bool unsigned, byte[] buffered_mem)
18 {
19 //reader.BaseStream.Seek(this.Address, SeekOrigin.Begin);
20
21 ulong start_value, end_value;
22 start_value = new DataTypeConverter(Start).ToUInt64();
23 end_value = new DataTypeConverter(End).ToUInt64();
24 DataTypeConverter lookup_value;
25 if (bitsize == SearchDataTypes._8bits)
26 {
27 if (unsigned)
28 {
29 lookup_value = new DataTypeConverter(buffered_mem[this.Address]);
30 if (lookup_value.ToByte() < (byte)start_value || lookup_value.ToByte() > (byte)end_value) { this.Value = lookup_value.Value; return true; }
31 }
32 else
33 {
34 lookup_value = new DataTypeConverter(buffered_mem[this.Address]);
35 if (lookup_value.ToSByte() < (sbyte)start_value || lookup_value.ToSByte() > (sbyte)end_value) { this.Value = lookup_value.Value; return true; }
36 }
37 }
38 else if (bitsize == SearchDataTypes._16bits)
39 {
40 if (unsigned)
41 {
42 lookup_value = new DataTypeConverter(BitConverter.ToUInt16(buffered_mem, (int)this.Address));
43 if (lookup_value.ToUInt16() < (ushort)start_value || lookup_value.ToUInt16() > (ushort)end_value) { this.Value = lookup_value.Value; return true; }
44 }
45 else
46 {
47 lookup_value = new DataTypeConverter(BitConverter.ToInt16(buffered_mem, (int)this.Address));
48 if (lookup_value.ToInt16() < (short)start_value || lookup_value.ToInt16() > (short)end_value) { this.Value = lookup_value.Value; return true; }
49 }
50 }
51 else if (bitsize == SearchDataTypes._32bits)
52 {
53 if (unsigned)
54 {
55 lookup_value = new DataTypeConverter(BitConverter.ToUInt32(buffered_mem, (int)this.Address));
56 if (lookup_value.ToUInt32() < (uint)start_value || lookup_value.ToUInt32() > (uint)end_value) { this.Value = lookup_value.Value; return true; }
57 }
58 else
59 {
60 lookup_value = new DataTypeConverter(BitConverter.ToInt32(buffered_mem, (int)this.Address));
61 if (lookup_value.ToInt32() < (int)start_value || lookup_value.ToInt32() > (int)end_value) { this.Value = lookup_value.Value; return true; }
62 }
63 }
64 else if (bitsize == SearchDataTypes._64bits)
65 {
66 if (unsigned)
67 {
68 lookup_value = new DataTypeConverter(BitConverter.ToUInt64(buffered_mem, (int)this.Address));
69 if (lookup_value.ToUInt64() < (ulong)start_value || lookup_value.ToUInt64() > (ulong)end_value) { this.Value = lookup_value.Value; return true; }
70 }
71 else
72 {
73 lookup_value = new DataTypeConverter(BitConverter.ToInt64(buffered_mem, (int)this.Address));
74 if (lookup_value.ToInt64() < (long)start_value || lookup_value.ToInt64() > (long)end_value) { this.Value = lookup_value.Value; return true; }
75 }
76 }
77 return false;
78 }
79 #endregion
80 }
81 }

  ViewVC Help
Powered by ViewVC 1.1.22