|
| 1 | +using System; |
| 2 | +using System.Drawing; |
| 3 | +using System.Globalization; |
| 4 | +using ReClassNET.Controls; |
| 5 | +using ReClassNET.Extensions; |
| 6 | +using ReClassNET.Memory; |
| 7 | +using ReClassNET.UI; |
| 8 | + |
| 9 | +namespace ReClassNET.Nodes |
| 10 | +{ |
| 11 | + public class UIntNativeNode : BaseNumericNode |
| 12 | + { |
| 13 | + public override int MemorySize => 8; |
| 14 | + |
| 15 | + public override void GetUserInterfaceInfo(out string name, out Image icon) |
| 16 | + { |
| 17 | + name = "NUInt"; |
| 18 | + icon = Properties.Resources.B16x16_Button_UInt_64; |
| 19 | + } |
| 20 | + |
| 21 | + public override Size Draw(DrawContext context, int x, int y) |
| 22 | + { |
| 23 | + var value = ReadValueFromMemory(context.Memory); |
| 24 | + var uvalue = value.ToUInt64(); |
| 25 | + return DrawNumeric(context, x, y, context.IconProvider.Unsigned, "NUInt", uvalue.ToString(), "0x" + uvalue.ToString(Constants.AddressHexFormat)); |
| 26 | + } |
| 27 | + |
| 28 | + public override void Update(HotSpot spot) |
| 29 | + { |
| 30 | + base.Update(spot); |
| 31 | + |
| 32 | + if (spot.Id == 0 || spot.Id == 1) |
| 33 | + { |
| 34 | +#if RECLASSNET64 |
| 35 | + if (ulong.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && ulong.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) |
| 36 | + { |
| 37 | + spot.Process.WriteRemoteMemory(spot.Address, val); |
| 38 | + } |
| 39 | +#else |
| 40 | + if (uint.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && uint.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) |
| 41 | + { |
| 42 | + spot.Process.WriteRemoteMemory(spot.Address, val); |
| 43 | + } |
| 44 | +#endif |
| 45 | + } |
| 46 | + } |
| 47 | + |
| 48 | + public UIntPtr ReadValueFromMemory(MemoryBuffer memory) |
| 49 | + { |
| 50 | + return memory.ReadUIntPtr(Offset); |
| 51 | + } |
| 52 | + } |
| 53 | +} |
0 commit comments