-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathInt32Node.cs
More file actions
44 lines (38 loc) · 1.08 KB
/
Int32Node.cs
File metadata and controls
44 lines (38 loc) · 1.08 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
using System.Drawing;
using System.Globalization;
using ReClassNET.Controls;
using ReClassNET.Extensions;
using ReClassNET.Memory;
using ReClassNET.UI;
namespace ReClassNET.Nodes
{
public class Int32Node : BaseNumericNode
{
public override int MemorySize => 4;
public override void GetUserInterfaceInfo(out string name, out Image icon)
{
name = "Int32";
icon = Properties.Resources.B16x16_Button_Int_32;
}
public override Size Draw(DrawContext context, int x, int y)
{
var value = ReadValueFromMemory(context.Memory);
return DrawNumeric(context, x, y, context.IconProvider.Signed, "Int32", value.ToString(), $"0x{value:X}");
}
public override void Update(HotSpot spot)
{
base.Update(spot);
if (spot.Id == 0 || spot.Id == 1)
{
if (int.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && int.TryParse(hexValue, NumberStyles.HexNumber, null, out val))
{
spot.Process.WriteRemoteMemory(spot.Address, val);
}
}
}
public int ReadValueFromMemory(MemoryBuffer memory)
{
return memory.ReadInt32(Offset);
}
}
}