Skip to content

Commit 10b81f4

Browse files
committed
Moved union types.
1 parent 984ced4 commit 10b81f4

File tree

6 files changed

+77
-77
lines changed

6 files changed

+77
-77
lines changed

Memory/UnionDataType.cs

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
4+
namespace ReClassNET.Memory
5+
{
6+
[StructLayout(LayoutKind.Explicit)]
7+
struct UInt8Data
8+
{
9+
[FieldOffset(0)]
10+
public sbyte SByteValue;
11+
12+
[FieldOffset(0)]
13+
public byte ByteValue;
14+
}
15+
16+
[StructLayout(LayoutKind.Explicit)]
17+
struct UInt16Data
18+
{
19+
[FieldOffset(0)]
20+
public short ShortValue;
21+
22+
[FieldOffset(0)]
23+
public ushort UShortValue;
24+
}
25+
26+
[StructLayout(LayoutKind.Explicit)]
27+
struct UInt32FloatData
28+
{
29+
[FieldOffset(0)]
30+
public int IntValue;
31+
32+
public IntPtr IntPtr => unchecked((IntPtr)IntValue);
33+
34+
[FieldOffset(0)]
35+
public uint UIntValue;
36+
37+
public UIntPtr UIntPtr => unchecked((UIntPtr)UIntValue);
38+
39+
[FieldOffset(0)]
40+
public float FloatValue;
41+
}
42+
43+
[StructLayout(LayoutKind.Explicit)]
44+
struct UInt64FloatDoubleData
45+
{
46+
[FieldOffset(0)]
47+
public long LongValue;
48+
49+
public IntPtr IntPtr =>
50+
#if WIN32
51+
unchecked((IntPtr)(int)LongValue);
52+
#else
53+
unchecked((IntPtr)LongValue);
54+
#endif
55+
56+
[FieldOffset(0)]
57+
public ulong ULongValue;
58+
59+
public UIntPtr UIntPtr =>
60+
#if WIN32
61+
unchecked((UIntPtr)(uint)ULongValue);
62+
#else
63+
unchecked((UIntPtr)ULongValue);
64+
#endif
65+
66+
[FieldOffset(0)]
67+
public float FloatValue;
68+
69+
[FieldOffset(0)]
70+
public double DoubleValue;
71+
}
72+
}

Nodes/Hex16Node.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1-
using System.Runtime.InteropServices;
2-
using ReClassNET.Memory;
1+
using ReClassNET.Memory;
32
using ReClassNET.UI;
43

54
namespace ReClassNET.Nodes
65
{
76
public class Hex16Node : BaseHexNode
87
{
9-
[StructLayout(LayoutKind.Explicit)]
10-
struct UInt16Data
11-
{
12-
[FieldOffset(0)]
13-
public short ShortValue;
14-
15-
[FieldOffset(0)]
16-
public ushort UShortValue;
17-
}
18-
198
/// <summary>Size of the node in bytes.</summary>
209
public override int MemorySize => 2;
2110

Nodes/Hex32Node.cs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,10 @@
1-
using System;
2-
using System.Runtime.InteropServices;
3-
using ReClassNET.Memory;
1+
using ReClassNET.Memory;
42
using ReClassNET.UI;
53

64
namespace ReClassNET.Nodes
75
{
86
public class Hex32Node : BaseHexCommentNode
97
{
10-
[StructLayout(LayoutKind.Explicit)]
11-
struct UInt32FloatData
12-
{
13-
[FieldOffset(0)]
14-
public int IntValue;
15-
16-
public IntPtr IntPtr => unchecked((IntPtr)IntValue);
17-
18-
[FieldOffset(0)]
19-
public uint UIntValue;
20-
21-
public UIntPtr UIntPtr => unchecked((UIntPtr)UIntValue);
22-
23-
[FieldOffset(0)]
24-
public float FloatValue;
25-
}
26-
278
/// <summary>Size of the node in bytes.</summary>
289
public override int MemorySize => 4;
2910

Nodes/Hex64Node.cs

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,10 @@
1-
using System;
2-
using System.Runtime.InteropServices;
3-
using ReClassNET.Memory;
1+
using ReClassNET.Memory;
42
using ReClassNET.UI;
53

64
namespace ReClassNET.Nodes
75
{
86
public class Hex64Node : BaseHexCommentNode
97
{
10-
[StructLayout(LayoutKind.Explicit)]
11-
struct UInt64FloatDoubleData
12-
{
13-
[FieldOffset(0)]
14-
public long LongValue;
15-
16-
public IntPtr IntPtr =>
17-
#if WIN32
18-
unchecked((IntPtr)(int)LongValue);
19-
#else
20-
unchecked((IntPtr)LongValue);
21-
#endif
22-
23-
[FieldOffset(0)]
24-
public ulong ULongValue;
25-
26-
public UIntPtr UIntPtr =>
27-
#if WIN32
28-
unchecked((UIntPtr)(uint)ULongValue);
29-
#else
30-
unchecked((UIntPtr)ULongValue);
31-
#endif
32-
33-
[FieldOffset(0)]
34-
public float FloatValue;
35-
36-
[FieldOffset(0)]
37-
public double DoubleValue;
38-
}
39-
408
/// <summary>Size of the node in bytes.</summary>
419
public override int MemorySize => 8;
4210

Nodes/Hex8Node.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1-
using System.Runtime.InteropServices;
2-
using ReClassNET.Memory;
1+
using ReClassNET.Memory;
32
using ReClassNET.UI;
43

54
namespace ReClassNET.Nodes
65
{
76
public class Hex8Node : BaseHexNode
87
{
9-
[StructLayout(LayoutKind.Explicit)]
10-
struct UInt8Data
11-
{
12-
[FieldOffset(0)]
13-
public sbyte SByteValue;
14-
15-
[FieldOffset(0)]
16-
public byte ByteValue;
17-
}
18-
198
/// <summary>Size of the node in bytes.</summary>
209
public override int MemorySize => 1;
2110

ReClass.NET.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
<Compile Include="Forms\InputBytesForm.Designer.cs">
151151
<DependentUpon>InputBytesForm.cs</DependentUpon>
152152
</Compile>
153+
<Compile Include="Memory\UnionDataType.cs" />
153154
<Compile Include="UI\BannerBox.cs">
154155
<SubType>Component</SubType>
155156
</Compile>

0 commit comments

Comments
 (0)