1 |
using System; |
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
|
6 |
namespace RomCheater.Docking.MemorySearch |
7 |
{ |
8 |
[Serializable()] |
9 |
public class OnlySearchType : IOnlySearchType |
10 |
{ |
11 |
#region Implicit Concersion |
12 |
public static implicit operator OnlySearchType(SearchType search) |
13 |
{ |
14 |
OnlySearchType _search_type = new OnlySearchType(search.DataType, search.IsUnsignedDataType, search.CompareType, search.CompareValueType, search.CompareStartValue, search.CompareEndValue); |
15 |
_search_type.IsFirstSearch = search.IsFirstSearch; |
16 |
//_search_type.Results = search.Results; |
17 |
return _search_type; |
18 |
} |
19 |
#endregion |
20 |
//const SearchDataTypes Default_DataType = SearchDataTypes._8bits; |
21 |
const bool Default_UnsignedState = true; |
22 |
const SearchCompareTypes Default_CompareType = SearchCompareTypes.Equal; |
23 |
const CompareValueTypes Default_CompareValueType = CompareValueTypes.OldValue; |
24 |
const byte Default_CompareValue = 0; |
25 |
|
26 |
#region default constructors |
27 |
public OnlySearchType() : this(Default_CompareValue, Default_CompareValue, Default_UnsignedState, Default_CompareType, Default_CompareValueType) { } |
28 |
public OnlySearchType(SearchDataTypes _data_type, bool _is_unsigned, SearchCompareTypes _compare_type, CompareValueTypes _compare_value_type, object start_value, object end_value) |
29 |
{ |
30 |
this.DataType = _data_type; |
31 |
this.IsUnsignedDataType = _is_unsigned; |
32 |
this.CompareType = _compare_type; |
33 |
this.CompareValueType = _compare_value_type; |
34 |
this.CompareStartValue = start_value; |
35 |
this.CompareEndValue = end_value; |
36 |
|
37 |
} |
38 |
#endregion |
39 |
|
40 |
#region 8bit specific constructors |
41 |
public OnlySearchType(byte start_value, byte end_value, bool _is_unsigned, SearchCompareTypes _compare_type, CompareValueTypes _compare_value_type) |
42 |
: this((ulong)start_value, (ulong)end_value, _is_unsigned, _compare_type, _compare_value_type) |
43 |
{ |
44 |
this.DataType = SearchDataTypes._8bits; |
45 |
} |
46 |
|
47 |
#endregion |
48 |
|
49 |
#region 16bit specific constructors |
50 |
public OnlySearchType(ushort start_value, ushort end_value, bool _is_unsigned, SearchCompareTypes _compare_type, CompareValueTypes _compare_value_type) |
51 |
: this((ulong)start_value, (ulong)end_value, _is_unsigned, _compare_type, _compare_value_type) |
52 |
{ |
53 |
this.DataType = SearchDataTypes._16bits; |
54 |
} |
55 |
|
56 |
#endregion |
57 |
|
58 |
#region 32bit specific constructors |
59 |
public OnlySearchType(uint start_value, uint end_value, bool _is_unsigned, SearchCompareTypes _compare_type, CompareValueTypes _compare_value_type) |
60 |
: this((ulong)start_value, (ulong)end_value, _is_unsigned, _compare_type, _compare_value_type) |
61 |
{ |
62 |
this.DataType = SearchDataTypes._32bits; |
63 |
} |
64 |
|
65 |
#endregion |
66 |
|
67 |
#region 64bit specific constructors |
68 |
public OnlySearchType(ulong start_value, ulong end_value, bool _is_unsigned, SearchCompareTypes _compare_type, CompareValueTypes _compare_value_type) |
69 |
{ |
70 |
this.DataType = SearchDataTypes._64bits; |
71 |
this.IsUnsignedDataType = _is_unsigned; |
72 |
this.CompareType = _compare_type; |
73 |
this.CompareValueType = _compare_value_type; |
74 |
this.CompareStartValue = start_value; |
75 |
this.CompareEndValue = end_value; |
76 |
} |
77 |
#endregion |
78 |
|
79 |
#region ISearchType Members |
80 |
|
81 |
private SearchDataTypes _DataType; |
82 |
private bool _IsUnsignedDataType; |
83 |
private SearchCompareTypes _CompareType; |
84 |
private CompareValueTypes _CompareValueType; |
85 |
private object _CompareStartValue; |
86 |
private object _CompareEndValue; |
87 |
|
88 |
|
89 |
private bool _IsFirstSearch; |
90 |
//private List<ResultType<object>> _Results = new List<ResultType<object>>(); |
91 |
|
92 |
public SearchDataTypes DataType { get { return _DataType; } set { _DataType = value; } } |
93 |
public bool IsUnsignedDataType { get { return _IsUnsignedDataType; } set { _IsUnsignedDataType = value; } } |
94 |
public SearchCompareTypes CompareType { get { return _CompareType; } set { _CompareType = value; } } |
95 |
public CompareValueTypes CompareValueType { get { return _CompareValueType; } set { _CompareValueType = value; } } |
96 |
|
97 |
public object CompareStartValue { get { return _CompareStartValue; } set { _CompareStartValue = value; } } |
98 |
public object CompareEndValue { get { return _CompareEndValue; } set { _CompareEndValue = value; } } |
99 |
|
100 |
public bool IsFirstSearch { get { return _IsFirstSearch; } set { _IsFirstSearch = value; } } |
101 |
|
102 |
//public List<ResultType<object>> Results { get { return _Results; } set { _Results = value; } } |
103 |
|
104 |
|
105 |
#endregion |
106 |
} |
107 |
} |