Skip to content

Commit e77e25b

Browse files
committed
Revert targetMethod changes
1 parent eba67c7 commit e77e25b

File tree

234 files changed

+377
-406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

234 files changed

+377
-406
lines changed

Nitrox.Test/Patcher/Patches/Dynamic/BaseDeconstructable_Deconstruct_PatchTest.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ public class BaseDeconstructable_Deconstruct_PatchTest
1313
[TestMethod]
1414
public void Sanity()
1515
{
16-
BaseDeconstructable_Deconstruct_Patch patch = new BaseDeconstructable_Deconstruct_Patch();
17-
IEnumerable<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(patch.targetMethod);
16+
IEnumerable<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(BaseDeconstructable_Deconstruct_Patch.TARGET_METHOD);
1817
IEnumerable<CodeInstruction> transformedIl = BaseDeconstructable_Deconstruct_Patch.Transpiler(null, originalIl);
1918
originalIl.Count().Should().Be(transformedIl.Count() - BaseDeconstructable_Deconstruct_Patch.InstructionsToAdd(true).Count() * 2);
2019
}

Nitrox.Test/Patcher/Patches/Dynamic/BreakableResource_SpawnResourceFromPrefab_PatchTest.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ public class BreakableResource_SpawnResourceFromPrefab_PatchTest
1515
[TestMethod]
1616
public void Sanity()
1717
{
18-
BreakableResource_SpawnResourceFromPrefab_Patch patch = new();
19-
ReadOnlyCollection<CodeInstruction> originalIL = PatchTestHelper.GetInstructionsFromMethod(patch.targetMethod);
20-
IEnumerable<CodeInstruction> transformedIL = Transpiler(patch.targetMethod, originalIL);
18+
ReadOnlyCollection<CodeInstruction> originalIL = PatchTestHelper.GetInstructionsFromMethod(TARGET_METHOD);
19+
IEnumerable<CodeInstruction> transformedIL = Transpiler(TARGET_METHOD, originalIL);
2120
originalIL.Count.Should().Be(transformedIL.Count() - 2);
2221
}
2322
}

Nitrox.Test/Patcher/Patches/Dynamic/Builder_TryPlace_PatchTest.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ public class Builder_TryPlace_PatchTest
1313
[TestMethod]
1414
public void Sanity()
1515
{
16-
17-
Builder_TryPlace_Patch patch = new();
18-
IEnumerable<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(patch.targetMethod);
16+
IEnumerable<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(Builder_TryPlace_Patch.TARGET_METHOD);
1917
IEnumerable<CodeInstruction> transformedIl = Builder_TryPlace_Patch.Transpiler(null, originalIl);
2018
originalIl.Count().Should().Be(transformedIl.Count() - (Builder_TryPlace_Patch.InstructionsToAdd1.Count + Builder_TryPlace_Patch.InstructionsToAdd2.Count));
2119
}

Nitrox.Test/Patcher/Patches/Dynamic/ConstructableBase_SetState_PatchTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class ConstructableBase_SetState_PatchTest
1313
[TestMethod]
1414
public void Sanity()
1515
{
16-
IEnumerable<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(new ConstructableBase_SetState_Patch().targetMethod);
16+
IEnumerable<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(ConstructableBase_SetState_Patch.TARGET_METHOD);
1717
IEnumerable<CodeInstruction> transformedIl = ConstructableBase_SetState_Patch.Transpiler(null, originalIl);
1818
originalIl.Count().Should().Be(transformedIl.Count() - ConstructableBase_SetState_Patch.InstructionsToAdd.Count);
1919
}

Nitrox.Test/Patcher/Patches/Dynamic/Constructable_Construct_PatchTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class Constructable_Construct_PatchTest
1313
[TestMethod]
1414
public void Sanity()
1515
{
16-
IEnumerable<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(new Constructable_Construct_Patch().targetMethod);
16+
IEnumerable<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(Constructable_Construct_Patch.TARGET_METHOD);
1717
IEnumerable<CodeInstruction> transformedIl = Constructable_Construct_Patch.Transpiler(null, originalIl);
1818
originalIl.Count().Should().Be(transformedIl.Count() - Constructable_Construct_Patch.InstructionsToAdd.Count);
1919
}

Nitrox.Test/Patcher/Patches/Dynamic/Constructable_DeconstructAsync_PatchTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class Constructable_DeconstructAsync_PatchTest
1313
[TestMethod]
1414
public void Sanity()
1515
{
16-
IEnumerable<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(new Constructable_DeconstructAsync_Patch().targetMethod);
16+
IEnumerable<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(Constructable_DeconstructAsync_Patch.TARGET_METHOD);
1717
IEnumerable<CodeInstruction> transformedIl = Constructable_DeconstructAsync_Patch.Transpiler(null, originalIl);
1818
originalIl.Count().Should().Be(transformedIl.Count() - Constructable_DeconstructAsync_Patch.InstructionsToAdd.Count);
1919
}

Nitrox.Test/Patcher/Patches/Dynamic/ConstructorInput_OnCraftingBegin_PatchTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Collections.ObjectModel;
33
using System.Linq;
44
using HarmonyLib;
@@ -24,8 +24,8 @@ public void Sanity()
2424
[TestMethod]
2525
public void InjectionSanity()
2626
{
27-
ReadOnlyCollection<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(new ConstructorInput_OnCraftingBegin_Patch().targetMethod);
28-
IEnumerable<CodeInstruction> result = ConstructorInput_OnCraftingBegin_Patch.Transpiler(new ConstructorInput_OnCraftingBegin_Patch().targetMethod, beforeInstructions);
27+
ReadOnlyCollection<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(ConstructorInput_OnCraftingBegin_Patch.TARGET_METHOD);
28+
IEnumerable<CodeInstruction> result = ConstructorInput_OnCraftingBegin_Patch.Transpiler(ConstructorInput_OnCraftingBegin_Patch.TARGET_METHOD, beforeInstructions);
2929

3030
Assert.IsTrue(beforeInstructions.Count < result.Count());
3131
}

Nitrox.Test/Patcher/Patches/Dynamic/CyclopsSonarButton_Update_PatchTest.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ namespace NitroxPatcher.Patches.Dynamic;
1212
[TestClass]
1313
public class CyclopsSonarButton_Update_PatchTest
1414
{
15-
CyclopsSonarButton_Update_Patch patch = new();
1615
[TestMethod]
1716
public void Sanity()
1817
{
@@ -21,23 +20,23 @@ public void Sanity()
2120
instructions.Add(new CodeInstruction(OpCodes.Callvirt, Reflect.Method((Player player) => player.GetMode())));
2221
instructions.Add(new CodeInstruction(OpCodes.Brtrue));
2322

24-
IEnumerable<CodeInstruction> result = CyclopsSonarButton_Update_Patch.Transpiler(patch.targetMethod, instructions, patch.targetMethod.GetILGenerator());
23+
IEnumerable<CodeInstruction> result = CyclopsSonarButton_Update_Patch.Transpiler(CyclopsSonarButton_Update_Patch.TARGET_METHOD, instructions, CyclopsSonarButton_Update_Patch.TARGET_METHOD.GetILGenerator());
2524
Assert.AreEqual(instructions.Count + 3, result.Count());
2625
}
2726

2827
[TestMethod]
2928
public void InjectionSanity()
3029
{
31-
List<CodeInstruction> beforeInstructions = PatchProcessor.GetCurrentInstructions(patch.targetMethod);
32-
IEnumerable<CodeInstruction> result = CyclopsSonarButton_Update_Patch.Transpiler(patch.targetMethod, beforeInstructions, patch.targetMethod.GetILGenerator());
30+
List<CodeInstruction> beforeInstructions = PatchProcessor.GetCurrentInstructions(CyclopsSonarButton_Update_Patch.TARGET_METHOD);
31+
IEnumerable<CodeInstruction> result = CyclopsSonarButton_Update_Patch.Transpiler(CyclopsSonarButton_Update_Patch.TARGET_METHOD, beforeInstructions, CyclopsSonarButton_Update_Patch.TARGET_METHOD.GetILGenerator());
3332

3433
Assert.IsTrue(beforeInstructions.Count < result.Count());
3534
}
3635

3736
[TestMethod]
3837
public void CheckMethodValidity()
3938
{
40-
ReadOnlyCollection<CodeInstruction> instructions = PatchTestHelper.GetInstructionsFromMethod(patch.targetMethod);
39+
ReadOnlyCollection<CodeInstruction> instructions = PatchTestHelper.GetInstructionsFromMethod(CyclopsSonarButton_Update_Patch.TARGET_METHOD);
4140
for (int i = 0; i < instructions.Count; i++)
4241
{
4342
CodeInstruction instruction = instructions[i];

Nitrox.Test/Patcher/Patches/Dynamic/DevConsole_Update_PatchTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.ObjectModel;
1+
using System.Collections.ObjectModel;
22
using System.Linq;
33
using FluentAssertions;
44
using HarmonyLib;
@@ -14,8 +14,8 @@ public class DevConsole_Update_PatchTest
1414
[TestMethod]
1515
public void Sanity()
1616
{
17-
ReadOnlyCollection<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(new DevConsole_Update_Patch().targetMethod);
18-
CodeInstruction[] transformedIl = Transpiler(new DevConsole_Update_Patch().targetMethod, originalIl.Clone()).ToArray();
17+
ReadOnlyCollection<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(TARGET_METHOD);
18+
CodeInstruction[] transformedIl = Transpiler(TARGET_METHOD, originalIl.Clone()).ToArray();
1919
originalIl.Count.Should().Be(transformedIl.Length, "the modified code shouldn't have a difference in size");
2020
transformedIl.Should().NotBeEquivalentTo(originalIl, "the patch should have changed the IL");
2121
}

Nitrox.Test/Patcher/Patches/Dynamic/Equipment_RemoveItem_PatchTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Collections.ObjectModel;
33
using System.Linq;
44
using HarmonyLib;
@@ -23,8 +23,8 @@ public void Sanity()
2323
[TestMethod]
2424
public void InjectionSanity()
2525
{
26-
ReadOnlyCollection<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(new Equipment_RemoveItem_Patch().targetMethod);
27-
IEnumerable<CodeInstruction> result = Equipment_RemoveItem_Patch.Transpiler(new Equipment_RemoveItem_Patch().targetMethod, beforeInstructions);
26+
ReadOnlyCollection<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(Equipment_RemoveItem_Patch.TARGET_METHOD);
27+
IEnumerable<CodeInstruction> result = Equipment_RemoveItem_Patch.Transpiler(Equipment_RemoveItem_Patch.TARGET_METHOD, beforeInstructions);
2828

2929
Assert.IsTrue(beforeInstructions.Count < result.Count());
3030
}

Nitrox.Test/Patcher/Patches/Dynamic/IngameMenu_QuitGameAsync_PatchTest.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Linq;
33
using System.Reflection.Emit;
44
using HarmonyLib;
@@ -24,7 +24,7 @@ public void Sanity()
2424
[TestMethod]
2525
public void InjectionSanity()
2626
{
27-
IEnumerable<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(new IngameMenu_QuitGameAsync_Patch().targetMethod);
27+
IEnumerable<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(IngameMenu_QuitGameAsync_Patch.TARGET_METHOD);
2828
IEnumerable<CodeInstruction> result = IngameMenu_QuitGameAsync_Patch.Transpiler(beforeInstructions);
2929

3030
Assert.IsTrue(beforeInstructions.Count() == result.Count()); // The ifs in the target method are all false in the testing environment

Nitrox.Test/Patcher/Patches/Dynamic/Inventory_LoseItems_PatchTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Linq;
33
using HarmonyLib;
44
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -22,8 +22,8 @@ public void Sanity()
2222
[TestMethod]
2323
public void InjectionSanity()
2424
{
25-
IEnumerable<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(new Inventory_LoseItems_Patch().targetMethod);
26-
IEnumerable<CodeInstruction> result = Inventory_LoseItems_Patch.Transpiler(new Inventory_LoseItems_Patch().targetMethod, beforeInstructions);
25+
IEnumerable<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(Inventory_LoseItems_Patch.TARGET_METHOD);
26+
IEnumerable<CodeInstruction> result = Inventory_LoseItems_Patch.Transpiler(Inventory_LoseItems_Patch.TARGET_METHOD, beforeInstructions);
2727

2828
Assert.IsTrue(beforeInstructions.Count() > result.Count());
2929
}

Nitrox.Test/Patcher/Patches/Dynamic/ItemsContainer_DestroyItem_PatchTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Collections.ObjectModel;
33
using System.Linq;
44
using FluentAssertions;
@@ -15,8 +15,8 @@ public class ItemsContainer_DestroyItem_PatchTest
1515
[TestMethod]
1616
public void Sanity()
1717
{
18-
ReadOnlyCollection<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(new ItemsContainer_DestroyItem_Patch().targetMethod) ;
19-
IEnumerable<CodeInstruction> transformedIl = Transpiler(new ItemsContainer_DestroyItem_Patch().targetMethod, originalIl);
18+
ReadOnlyCollection<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(TARGET_METHOD);
19+
IEnumerable<CodeInstruction> transformedIl = Transpiler(TARGET_METHOD, originalIl);
2020
originalIl.Count.Should().Be(transformedIl.Count() - 2);
2121
}
2222
}

Nitrox.Test/Patcher/Patches/Dynamic/LaunchRocket_OnHandClick_PatchTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Linq;
33
using HarmonyLib;
44
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -22,8 +22,8 @@ public void Sanity()
2222
[TestMethod]
2323
public void InjectionSanity()
2424
{
25-
IEnumerable<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(new LaunchRocket_OnHandClick_Patch().targetMethod);
26-
IEnumerable<CodeInstruction> result = LaunchRocket_OnHandClick_Patch.Transpiler(new LaunchRocket_OnHandClick_Patch().targetMethod, beforeInstructions);
25+
IEnumerable<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(LaunchRocket_OnHandClick_Patch.TARGET_METHOD);
26+
IEnumerable<CodeInstruction> result = LaunchRocket_OnHandClick_Patch.Transpiler(LaunchRocket_OnHandClick_Patch.TARGET_METHOD, beforeInstructions);
2727

2828
// We remove a lot of instructions in this transpiler
2929
Assert.IsTrue(beforeInstructions.Count() > result.Count());

Nitrox.Test/Patcher/Patches/Dynamic/PDAScanner_Scan_PatchTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ public void Sanity()
1818
List<CodeInstruction> instructions = PatchTestHelper.GenerateDummyInstructions(100);
1919
instructions.Add(new CodeInstruction(PDAScanner_Scan_Patch.INJECTION_OPCODE, PDAScanner_Scan_Patch.INJECTION_OPERAND));
2020

21-
IEnumerable<CodeInstruction> result = PDAScanner_Scan_Patch.Transpiler(new PDAScanner_Scan_Patch().targetMethod, instructions);
21+
IEnumerable<CodeInstruction> result = PDAScanner_Scan_Patch.Transpiler(PDAScanner_Scan_Patch.TARGET_METHOD, instructions);
2222

2323
Assert.AreEqual(instructions.Count + 3, result.Count());
2424
}
2525

2626
[TestMethod]
2727
public void InjectionSanity()
2828
{
29-
IEnumerable<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(new PDAScanner_Scan_Patch().targetMethod);
30-
IEnumerable<CodeInstruction> result = PDAScanner_Scan_Patch.Transpiler(new PDAScanner_Scan_Patch().targetMethod, beforeInstructions);
29+
IEnumerable<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(PDAScanner_Scan_Patch.TARGET_METHOD);
30+
IEnumerable<CodeInstruction> result = PDAScanner_Scan_Patch.Transpiler(PDAScanner_Scan_Patch.TARGET_METHOD, beforeInstructions);
3131

3232
Assert.AreEqual(beforeInstructions.Count() + 3, result.Count());
3333
}

Nitrox.Test/Patcher/Patches/Dynamic/SpawnOnKill_OnKill_PatchTest.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public class SpawnOnKill_OnKill_PatchTest
1515
[TestMethod]
1616
public void Sanity()
1717
{
18-
ReadOnlyCollection<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(new SpawnOnKill_OnKill_Patch().targetMethod);
19-
IEnumerable<CodeInstruction> transformedIl = Transpiler(new SpawnOnKill_OnKill_Patch().targetMethod, originalIl);
18+
ReadOnlyCollection<CodeInstruction> originalIl = PatchTestHelper.GetInstructionsFromMethod(TARGET_METHOD);
19+
IEnumerable<CodeInstruction> transformedIl = Transpiler(TARGET_METHOD, originalIl);
2020
originalIl.Count.Should().Be(transformedIl.Count() - 3);
2121
}
2222
}

Nitrox.Test/Patcher/Patches/Dynamic/uGUI_PDA_Initialize_PatchTest.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Collections.ObjectModel;
33
using System.Linq;
44
using HarmonyLib;
@@ -16,15 +16,15 @@ public void Sanity()
1616
List<CodeInstruction> instructions = PatchTestHelper.GenerateDummyInstructions(100);
1717
instructions.Add(new CodeInstruction(uGUI_PDA_Initialize_Patch.INJECTION_OPCODE, uGUI_PDA_Initialize_Patch.INJECTION_OPERAND));
1818

19-
IEnumerable<CodeInstruction> result = uGUI_PDA_Initialize_Patch.Transpiler(new uGUI_PDA_Initialize_Patch().targetMethod, instructions);
19+
IEnumerable<CodeInstruction> result = uGUI_PDA_Initialize_Patch.Transpiler(uGUI_PDA_Initialize_Patch.TARGET_METHOD, instructions);
2020
Assert.AreEqual(instructions.Count + 2, result.Count());
2121
}
2222

2323
[TestMethod]
2424
public void InjectionSanity()
2525
{
26-
ReadOnlyCollection<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(new uGUI_PDA_Initialize_Patch().targetMethod);
27-
IEnumerable<CodeInstruction> result = uGUI_PDA_Initialize_Patch.Transpiler(new uGUI_PDA_Initialize_Patch().targetMethod, beforeInstructions);
26+
ReadOnlyCollection<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(uGUI_PDA_Initialize_Patch.TARGET_METHOD);
27+
IEnumerable<CodeInstruction> result = uGUI_PDA_Initialize_Patch.Transpiler(uGUI_PDA_Initialize_Patch.TARGET_METHOD, beforeInstructions);
2828

2929
Assert.IsTrue(beforeInstructions.Count < result.Count());
3030
}

Nitrox.Test/Patcher/Patches/Dynamic/uGUI_PDA_SetTabs_PatchTest.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Collections.ObjectModel;
33
using System.Linq;
44
using HarmonyLib;
@@ -16,15 +16,15 @@ public void Sanity()
1616
List<CodeInstruction> instructions = PatchTestHelper.GenerateDummyInstructions(100);
1717
instructions.Add(new CodeInstruction(uGUI_PDA_SetTabs_Patch.INJECTION_OPCODE));
1818

19-
IEnumerable<CodeInstruction> result = uGUI_PDA_SetTabs_Patch.Transpiler(new uGUI_PDA_SetTabs_Patch().targetMethod, instructions);
19+
IEnumerable<CodeInstruction> result = uGUI_PDA_SetTabs_Patch.Transpiler(uGUI_PDA_SetTabs_Patch.TARGET_METHOD, instructions);
2020
Assert.AreEqual(instructions.Count + 3, result.Count());
2121
}
2222

2323
[TestMethod]
2424
public void InjectionSanity()
2525
{
26-
ReadOnlyCollection<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(new uGUI_PDA_SetTabs_Patch().targetMethod);
27-
IEnumerable<CodeInstruction> result = uGUI_PDA_SetTabs_Patch.Transpiler(new uGUI_PDA_SetTabs_Patch().targetMethod, beforeInstructions);
26+
ReadOnlyCollection<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(uGUI_PDA_SetTabs_Patch.TARGET_METHOD);
27+
IEnumerable<CodeInstruction> result = uGUI_PDA_SetTabs_Patch.Transpiler(uGUI_PDA_SetTabs_Patch.TARGET_METHOD, beforeInstructions);
2828

2929
Assert.IsTrue(beforeInstructions.Count < result.Count());
3030
}

Nitrox.Test/Patcher/Patches/Dynamic/uGUI_Pings_IsVisibleNow_PatchTest.cs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Collections.ObjectModel;
33
using System.Linq;
44
using System.Reflection.Emit;
@@ -14,22 +14,20 @@ public class uGUI_Pings_IsVisibleNow_PatchTest
1414
[TestMethod]
1515
public void Sanity()
1616
{
17-
uGUI_Pings_IsVisibleNow_Patch patch = new();
1817
List<CodeInstruction> beforeInstructions = PatchTestHelper.GenerateDummyInstructions(100);
1918
beforeInstructions.Add(new CodeInstruction(OpCodes.Ldc_I4_0));
2019
beforeInstructions.Add(new CodeInstruction(OpCodes.Ret));
2120

22-
IEnumerable<CodeInstruction> result = uGUI_Pings_IsVisibleNow_Patch.Transpiler(patch.targetMethod, beforeInstructions.ToList());
21+
IEnumerable<CodeInstruction> result = uGUI_Pings_IsVisibleNow_Patch.Transpiler(uGUI_Pings_IsVisibleNow_Patch.TargetMethod, beforeInstructions.ToList());
2322
Assert.AreEqual(beforeInstructions.Count, result.Count());
2423
Assert.IsFalse(beforeInstructions.SequenceEqual(result));
2524
}
2625

2726
[TestMethod]
2827
public void InjectionSanity()
2928
{
30-
uGUI_Pings_IsVisibleNow_Patch patch = new();
31-
ReadOnlyCollection<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(patch.targetMethod);
32-
IEnumerable<CodeInstruction> result = uGUI_Pings_IsVisibleNow_Patch.Transpiler(patch.targetMethod, beforeInstructions.ToList());
29+
ReadOnlyCollection<CodeInstruction> beforeInstructions = PatchTestHelper.GetInstructionsFromMethod(uGUI_Pings_IsVisibleNow_Patch.TargetMethod);
30+
IEnumerable<CodeInstruction> result = uGUI_Pings_IsVisibleNow_Patch.Transpiler(uGUI_Pings_IsVisibleNow_Patch.TargetMethod, beforeInstructions.ToList());
3331

3432
Assert.AreEqual(beforeInstructions.Count, result.Count());
3533
Assert.IsFalse(beforeInstructions.SequenceEqual(result));

0 commit comments

Comments
 (0)