forked from ReClassNET/ReClass.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseMatrixNode.cs
More file actions
124 lines (94 loc) · 2.7 KB
/
BaseMatrixNode.cs
File metadata and controls
124 lines (94 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
using System.Diagnostics.Contracts;
using ReClassNET.UI;
namespace ReClassNET.Nodes
{
public abstract class BaseMatrixNode : BaseNode
{
public BaseMatrixNode()
{
levelsOpen.DefaultValue = true;
}
protected delegate void DrawMatrixValues(ref int x, ref int y, int defaultX);
protected int DrawMatrixType(ViewInfo view, int x, int y, string type, DrawMatrixValues drawValues)
{
Contract.Requires(view != null);
Contract.Requires(type != null);
Contract.Requires(drawValues != null);
if (IsHidden)
{
return DrawHidden(view, x, y);
}
AddSelection(view, x, y, view.Font.Height);
AddDelete(view, x, y);
AddTypeDrop(view, x, y);
x += TextPadding;
x = AddIcon(view, x, y, Icons.Matrix, HotSpot.NoneId, HotSpotType.None);
var tx = x;
x = AddAddressOffset(view, x, y);
x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width;
x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name);
x = AddOpenClose(view, x, y);
x += view.Font.Width;
x = AddComment(view, x, y);
if (levelsOpen[view.Level])
{
drawValues(ref x, ref y, tx);
}
return y + view.Font.Height;
}
protected delegate void DrawVectorValues(ref int x, ref int y);
protected int DrawVectorType(ViewInfo view, int x, int y, string type, DrawVectorValues drawValues)
{
Contract.Requires(view != null);
Contract.Requires(type != null);
Contract.Requires(drawValues != null);
if (IsHidden)
{
return DrawHidden(view, x, y);
}
AddSelection(view, x, y, view.Font.Height);
AddDelete(view, x, y);
AddTypeDrop(view, x, y);
x += TextPadding;
x = AddIcon(view, x, y, Icons.Vector, HotSpot.NoneId, HotSpotType.None);
x = AddAddressOffset(view, x, y);
x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width;
x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name);
x = AddOpenClose(view, x, y);
if (levelsOpen[view.Level])
{
drawValues(ref x, ref y);
}
x += view.Font.Width;
AddComment(view, x, y);
return y + view.Font.Height;
}
public override int CalculateHeight(ViewInfo view)
{
if (IsHidden)
{
return HiddenHeight;
}
var h = view.Font.Height;
if (levelsOpen[view.Level])
{
h += CalculateValuesHeight(view);
}
return h;
}
protected abstract int CalculateValuesHeight(ViewInfo view);
public void Update(HotSpot spot, int max)
{
Contract.Requires(spot != null);
base.Update(spot);
if (spot.Id >= 0 && spot.Id < max)
{
float val;
if (float.TryParse(spot.Text, out val))
{
spot.Memory.Process.WriteRemoteMemory(spot.Address, val);
}
}
}
}
}