-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathHex32Node.cs
More file actions
59 lines (47 loc) · 1.76 KB
/
Hex32Node.cs
File metadata and controls
59 lines (47 loc) · 1.76 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
using System;
using System.Drawing;
using ReClassNET.Memory;
using ReClassNET.UI;
namespace ReClassNET.Nodes
{
public class Hex32Node : BaseHexCommentNode
{
/// <summary>Size of the node in bytes.</summary>
public override int MemorySize => 4;
public override bool UseMemoryPreviewToolTip(HotSpot spot, MemoryBuffer memory, out IntPtr address)
{
var value = memory.ReadObject<UInt32FloatData>(Offset);
address = value.IntPtr;
return memory.Process?.GetNamedAddress(value.IntPtr) != null;
}
/// <summary>Gets informations about this node to show in a tool tip.</summary>
/// <param name="spot">The spot.</param>
/// <param name="memory">The process memory.</param>
/// <returns>The information to show in a tool tip.</returns>
public override string GetToolTipText(HotSpot spot, MemoryBuffer memory)
{
var value = memory.ReadObject<UInt32FloatData>(Offset);
return $"Int32: {value.IntValue}\nUInt32: 0x{value.UIntValue:X08}\nFloat: {value.FloatValue:0.000}";
}
/// <summary>Draws this node.</summary>
/// <param name="view">The view information.</param>
/// <param name="x">The x coordinate.</param>
/// <param name="y">The y coordinate.</param>
/// <returns>The pixel size the node occupies.</returns>
public override Size Draw(ViewInfo view, int x, int y)
{
return Draw(view, x, y, view.Settings.ShowNodeText ? view.Memory.ReadPrintableAsciiString(Offset, 4) + " " : null, 4);
}
public override void Update(HotSpot spot)
{
Update(spot, 4);
}
protected override int AddComment(ViewInfo view, int x, int y)
{
x = base.AddComment(view, x, y);
var value = view.Memory.ReadObject<UInt32FloatData>(Offset);
x = AddComment(view, x, y, value.FloatValue, value.IntPtr, value.UIntPtr);
return x;
}
}
}