|
1 | | -using System; |
2 | | -using System.Diagnostics.Contracts; |
3 | | - |
4 | 1 | namespace ReClassNET.MemoryScanner.Comparer |
5 | 2 | { |
6 | | - [ContractClass(typeof(ScanComparerContract))] |
7 | 3 | public interface IScanComparer |
8 | 4 | { |
9 | 5 | ScanCompareType CompareType { get; } |
10 | | - int ValueSize { get; } |
11 | | - |
12 | | - /// <summary> |
13 | | - /// Compares the data at the provided index to the current <see cref="CompareType"/>. |
14 | | - /// </summary> |
15 | | - /// <param name="data">The byte array to be compared.</param> |
16 | | - /// <param name="index">The index into the byte array.</param> |
17 | | - /// <param name="result">[out] The scan result if the <see cref="CompareType"/> matched.</param> |
18 | | - /// <returns>True if matched.</returns> |
19 | | - bool Compare(byte[] data, int index, out ScanResult result); |
20 | | - |
21 | | - /// <summary> |
22 | | - /// Compares the data at the provided index to the current <see cref="CompareType"/>. |
23 | | - /// The previous results may be used. |
24 | | - /// </summary> |
25 | | - /// <param name="data">The byte array to be compared.</param> |
26 | | - /// <param name="index">The index into the byte array.</param> |
27 | | - /// <param name="previous">Scan result to be compared.</param> |
28 | | - /// <param name="result">[out] The scan result if the <see cref="CompareType"/> matched.</param> |
29 | | - /// <returns>True if matched.</returns> |
30 | | - bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result); |
31 | | - } |
32 | | - |
33 | | - [ContractClassFor(typeof(IScanComparer))] |
34 | | - internal abstract class ScanComparerContract : IScanComparer |
35 | | - { |
36 | | - public ScanCompareType CompareType => throw new NotImplementedException(); |
37 | | - |
38 | | - public int ValueSize |
39 | | - { |
40 | | - get |
41 | | - { |
42 | | - Contract.Ensures(ValueSize > 0); |
43 | | - |
44 | | - throw new NotImplementedException(); |
45 | | - } |
46 | | - } |
47 | | - public bool Compare(byte[] data, int index, out ScanResult result) |
48 | | - { |
49 | | - Contract.Requires(data != null); |
50 | | - Contract.Requires(index >= 0); |
51 | | - |
52 | | - throw new NotImplementedException(); |
53 | | - } |
54 | | - |
55 | | - public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) |
56 | | - { |
57 | | - Contract.Requires(data != null); |
58 | | - Contract.Requires(index >= 0); |
59 | | - Contract.Requires(previous != null); |
60 | | - |
61 | | - throw new NotImplementedException(); |
62 | | - } |
63 | 6 | } |
64 | 7 | } |
0 commit comments