Skip to content

Commit 6940a8f

Browse files
committed
Made fields readonly.
1 parent 096c1e3 commit 6940a8f

12 files changed

+67
-68
lines changed

Core/InternalCoreFunctions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ internal class InternalCoreFunctions : NativeCoreWrapper
88
[return: MarshalAs(UnmanagedType.I1)]
99
private delegate bool DisassembleCodeDelegate(IntPtr address, IntPtr length, IntPtr virtualAddress, out InstructionData instruction);
1010

11-
private DisassembleCodeDelegate disassembleCodeDelegate;
11+
private readonly DisassembleCodeDelegate disassembleCodeDelegate;
1212

1313
public InternalCoreFunctions(IntPtr handle)
1414
: base(handle)

Core/NativeCoreWrapper.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ public class NativeCoreWrapper : ICoreProcessFunctions
4242
[return: MarshalAs(UnmanagedType.I1)]
4343
private delegate bool SetHardwareBreakpointDelegate(IntPtr id, IntPtr address, HardwareBreakpointRegister register, HardwareBreakpointTrigger trigger, HardwareBreakpointSize size, [param: MarshalAs(UnmanagedType.I1)] bool set);
4444

45-
private EnumerateProcessesDelegate enumerateProcessesDelegate;
46-
private EnumerateRemoteSectionsAndModulesDelegate enumerateRemoteSectionsAndModulesDelegate;
47-
private OpenRemoteProcessDelegate openRemoteProcessDelegate;
48-
private IsProcessValidDelegate isProcessValidDelegate;
49-
private CloseRemoteProcessDelegate closeRemoteProcessDelegate;
50-
private ReadRemoteMemoryDelegate readRemoteMemoryDelegate;
51-
private WriteRemoteMemoryDelegate writeRemoteMemoryDelegate;
52-
private ControlRemoteProcessDelegate controlRemoteProcessDelegate;
53-
private AttachDebuggerToProcessDelegate attachDebuggerToProcessDelegate;
54-
private DetachDebuggerFromProcessDelegate detachDebuggerFromProcessDelegate;
55-
private AwaitDebugEventDelegate awaitDebugEventDelegate;
56-
private HandleDebugEventDelegate handleDebugEventDelegate;
57-
private SetHardwareBreakpointDelegate setHardwareBreakpointDelegate;
45+
private readonly EnumerateProcessesDelegate enumerateProcessesDelegate;
46+
private readonly EnumerateRemoteSectionsAndModulesDelegate enumerateRemoteSectionsAndModulesDelegate;
47+
private readonly OpenRemoteProcessDelegate openRemoteProcessDelegate;
48+
private readonly IsProcessValidDelegate isProcessValidDelegate;
49+
private readonly CloseRemoteProcessDelegate closeRemoteProcessDelegate;
50+
private readonly ReadRemoteMemoryDelegate readRemoteMemoryDelegate;
51+
private readonly WriteRemoteMemoryDelegate writeRemoteMemoryDelegate;
52+
private readonly ControlRemoteProcessDelegate controlRemoteProcessDelegate;
53+
private readonly AttachDebuggerToProcessDelegate attachDebuggerToProcessDelegate;
54+
private readonly DetachDebuggerFromProcessDelegate detachDebuggerFromProcessDelegate;
55+
private readonly AwaitDebugEventDelegate awaitDebugEventDelegate;
56+
private readonly HandleDebugEventDelegate handleDebugEventDelegate;
57+
private readonly SetHardwareBreakpointDelegate setHardwareBreakpointDelegate;
5858

5959
#endregion
6060

DataExchange/ReClassNetFile.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public ReClassNetFile(ReClassNetProject project)
4848
this.project = project;
4949
}
5050

51-
private static Dictionary<string, Type> BuildInStringToTypeMap = new Type[]
51+
private static readonly Dictionary<string, Type> BuildInStringToTypeMap = new[]
5252
{
5353
typeof(BoolNode),
5454
typeof(BitFieldNode),
@@ -86,6 +86,6 @@ public ReClassNetFile(ReClassNetProject project)
8686
typeof(Vector4Node),
8787
typeof(VTableNode)
8888
}.ToDictionary(t => t.Name, t => t);
89-
private static Dictionary<Type, string> BuildInTypeToStringMap = BuildInStringToTypeMap.ToDictionary(kv => kv.Value, kv => kv.Key);
89+
private static readonly Dictionary<Type, string> BuildInTypeToStringMap = BuildInStringToTypeMap.ToDictionary(kv => kv.Value, kv => kv.Key);
9090
}
9191
}

Forms/FoundCodeForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ private class FoundCodeInfo
2525

2626
private readonly RemoteProcess process;
2727

28-
private DataTable data;
28+
private readonly DataTable data;
2929
private volatile bool acceptNewRecords = true;
3030

3131
public event StopEventHandler Stop;

Native/NativeMethods.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace ReClassNET.Native
66
{
77
public static class NativeMethods
88
{
9-
private static INativeMethods nativeMethods;
9+
private static readonly INativeMethods nativeMethods;
1010

1111
static NativeMethods()
1212
{

Nodes/Matrix3x3Node.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ public class Matrix3x3Node : BaseMatrixNode
1010
struct Matrix3x3Data
1111
{
1212
[FieldOffset(0)]
13-
public float _11;
13+
public readonly float _11;
1414
[FieldOffset(4)]
15-
public float _12;
15+
public readonly float _12;
1616
[FieldOffset(8)]
17-
public float _13;
17+
public readonly float _13;
1818
[FieldOffset(12)]
19-
public float _21;
19+
public readonly float _21;
2020
[FieldOffset(16)]
21-
public float _22;
21+
public readonly float _22;
2222
[FieldOffset(20)]
23-
public float _23;
23+
public readonly float _23;
2424
[FieldOffset(24)]
25-
public float _31;
25+
public readonly float _31;
2626
[FieldOffset(28)]
27-
public float _32;
27+
public readonly float _32;
2828
[FieldOffset(32)]
29-
public float _33;
29+
public readonly float _33;
3030
}
3131

3232
/// <summary>Size of the node in bytes.</summary>
@@ -71,7 +71,7 @@ public override int Draw(ViewInfo view, int x2, int y2)
7171
x = AddText(view, x, y, view.Settings.ValueColor, 7, $"{value._32,14:0.000}");
7272
x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ",");
7373
x = AddText(view, x, y, view.Settings.ValueColor, 8, $"{value._33,14:0.000}");
74-
x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|");
74+
AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|");
7575
});
7676
}
7777

Nodes/Matrix3x4Node.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@ public class Matrix3x4Node : BaseMatrixNode
99
struct Matrix3x4Data
1010
{
1111
[FieldOffset(0)]
12-
public float _11;
12+
public readonly float _11;
1313
[FieldOffset(4)]
14-
public float _12;
14+
public readonly float _12;
1515
[FieldOffset(8)]
16-
public float _13;
16+
public readonly float _13;
1717
[FieldOffset(12)]
18-
public float _14;
18+
public readonly float _14;
1919
[FieldOffset(16)]
20-
public float _21;
20+
public readonly float _21;
2121
[FieldOffset(20)]
22-
public float _22;
22+
public readonly float _22;
2323
[FieldOffset(24)]
24-
public float _23;
24+
public readonly float _23;
2525
[FieldOffset(28)]
26-
public float _24;
26+
public readonly float _24;
2727
[FieldOffset(32)]
28-
public float _31;
28+
public readonly float _31;
2929
[FieldOffset(36)]
30-
public float _32;
30+
public readonly float _32;
3131
[FieldOffset(40)]
32-
public float _33;
32+
public readonly float _33;
3333
[FieldOffset(44)]
34-
public float _34;
34+
public readonly float _34;
3535
}
3636

3737
/// <summary>Size of the node in bytes.</summary>
@@ -82,7 +82,7 @@ public override int Draw(ViewInfo view, int x2, int y2)
8282
x = AddText(view, x, y, view.Settings.ValueColor, 10, $"{value._33,14:0.000}");
8383
x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, ",");
8484
x = AddText(view, x, y, view.Settings.ValueColor, 11, $"{value._34,14:0.000}");
85-
x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|");
85+
AddText(view, x, y, view.Settings.NameColor, HotSpot.NoneId, "|");
8686
});
8787
}
8888

Nodes/Matrix4x4Node.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,37 @@ public class Matrix4x4Node : BaseMatrixNode
99
struct Matrix4x4Data
1010
{
1111
[FieldOffset(0)]
12-
public float _11;
12+
public readonly float _11;
1313
[FieldOffset(4)]
14-
public float _12;
14+
public readonly float _12;
1515
[FieldOffset(8)]
16-
public float _13;
16+
public readonly float _13;
1717
[FieldOffset(12)]
18-
public float _14;
18+
public readonly float _14;
1919
[FieldOffset(16)]
20-
public float _21;
20+
public readonly float _21;
2121
[FieldOffset(20)]
22-
public float _22;
22+
public readonly float _22;
2323
[FieldOffset(24)]
24-
public float _23;
24+
public readonly float _23;
2525
[FieldOffset(28)]
26-
public float _24;
26+
public readonly float _24;
2727
[FieldOffset(32)]
28-
public float _31;
28+
public readonly float _31;
2929
[FieldOffset(36)]
30-
public float _32;
30+
public readonly float _32;
3131
[FieldOffset(40)]
32-
public float _33;
32+
public readonly float _33;
3333
[FieldOffset(44)]
34-
public float _34;
34+
public readonly float _34;
3535
[FieldOffset(48)]
36-
public float _41;
36+
public readonly float _41;
3737
[FieldOffset(52)]
38-
public float _42;
38+
public readonly float _42;
3939
[FieldOffset(56)]
40-
public float _43;
40+
public readonly float _43;
4141
[FieldOffset(60)]
42-
public float _44;
42+
public readonly float _44;
4343
}
4444

4545
/// <summary>Size of the node in bytes.</summary>

Nodes/Vector2Node.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ public class Vector2Node : BaseMatrixNode
99
struct Vector2Data
1010
{
1111
[FieldOffset(0)]
12-
public float X;
12+
public readonly float X;
1313
[FieldOffset(4)]
14-
public float Y;
14+
public readonly float Y;
1515
}
1616

1717
/// <summary>Size of the node in bytes.</summary>

Nodes/Vector3Node.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ public class Vector3Node : BaseMatrixNode
99
struct Vector3Data
1010
{
1111
[FieldOffset(0)]
12-
public float X;
12+
public readonly float X;
1313
[FieldOffset(4)]
14-
public float Y;
14+
public readonly float Y;
1515
[FieldOffset(8)]
16-
public float Z;
16+
public readonly float Z;
1717
}
1818

1919
/// <summary>Size of the node in bytes.</summary>

0 commit comments

Comments
 (0)