forked from Yohoki/TempAR-Vita
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PointerSearcherLog.cs
51 lines (46 loc) · 1.7 KB
/
PointerSearcherLog.cs
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
using System.Globalization;
using System.Text.RegularExpressions;
namespace TempAR
{
internal class PointerSearcherLog
{
public uint Address { get; }
public uint Offset { get; }
public uint Value { get; }
public bool Negative { get; }
public PointerSearcherLog(
uint address,
uint offset,
uint value,
bool negative,
uint memory_start)
{
Address = address;
Offset = offset;
Value = value;
Negative = negative;
if (Address >= memory_start)
return;
Address += memory_start;
}
public PointerSearcherLog(string s, uint memory_start)
{
var match = new Regex("地址:\\s*0x(.*);\\s*偏移:\\s*(-?)0x(.*);\\s*数值:\\s*0x(.*);").Match(s);
Address = uint.Parse(match.Groups[1].Value, NumberStyles.AllowHexSpecifier);
Negative = match.Groups[2].Value == "-";
Offset = uint.Parse(match.Groups[3].Value, NumberStyles.AllowHexSpecifier);
Value = uint.Parse(match.Groups[4].Value, NumberStyles.AllowHexSpecifier);
if (Address >= memory_start)
return;
Address += memory_start;
}
public override string ToString()
{
return $"地址: 0x{Address:X08}; 偏移: {(Negative ? "-" : "")}0x{Offset:X}; 数值: 0x{Value:X08};";
}
public string ToString(uint address_base)
{
return $"地址: 0x{(uint)((int)Address - (int)address_base):X08}; 偏移: {(Negative ? "-" : "")}0x{Offset:X}; 数值: 0x{(uint)((int)Value - (int)address_base):X08};";
}
}
}