-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathFloatNode.cs
More file actions
42 lines (36 loc) · 932 Bytes
/
FloatNode.cs
File metadata and controls
42 lines (36 loc) · 932 Bytes
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
using System.Drawing;
using ReClassNET.Controls;
using ReClassNET.Extensions;
using ReClassNET.Memory;
using ReClassNET.UI;
namespace ReClassNET.Nodes
{
public class FloatNode : BaseNumericNode
{
public override int MemorySize => 4;
public override void GetUserInterfaceInfo(out string name, out Image icon)
{
name = "Float";
icon = Properties.Resources.B16x16_Button_Float;
}
public override Size Draw(DrawContext context, int x, int y)
{
return DrawNumeric(context, x, y, context.IconProvider.Float, "Float", ReadValueFromMemory(context.Memory).ToString("0.000"), null);
}
public override void Update(HotSpot spot)
{
base.Update(spot);
if (spot.Id == 0)
{
if (float.TryParse(spot.Text, out var val))
{
spot.Process.WriteRemoteMemory(spot.Address, val);
}
}
}
public float ReadValueFromMemory(MemoryBuffer memory)
{
return memory.ReadFloat(Offset);
}
}
}