diff --git a/Assets/Dumper/DumpLib.dll b/Assets/Dumper/DumpLib.dll
index bd93e8d..88d09ae 100644
Binary files a/Assets/Dumper/DumpLib.dll and b/Assets/Dumper/DumpLib.dll differ
diff --git a/Assets/MonoCecil/Mono.Cecil.Mdb.dll b/Assets/MonoCecil/Mono.Cecil.Mdb.dll
new file mode 100644
index 0000000..bddf5cb
Binary files /dev/null and b/Assets/MonoCecil/Mono.Cecil.Mdb.dll differ
diff --git a/Assets/MonoCecil/Mono.Cecil.Pdb.dll b/Assets/MonoCecil/Mono.Cecil.Pdb.dll
new file mode 100644
index 0000000..9227f6d
Binary files /dev/null and b/Assets/MonoCecil/Mono.Cecil.Pdb.dll differ
diff --git a/Assets/MonoCecil/Mono.Cecil.Rocks.dll b/Assets/MonoCecil/Mono.Cecil.Rocks.dll
new file mode 100644
index 0000000..a77ac87
Binary files /dev/null and b/Assets/MonoCecil/Mono.Cecil.Rocks.dll differ
diff --git a/Assets/MonoCecil/Mono.Cecil.dll b/Assets/MonoCecil/Mono.Cecil.dll
new file mode 100644
index 0000000..18735f9
Binary files /dev/null and b/Assets/MonoCecil/Mono.Cecil.dll differ
diff --git a/ReCodeItCLI/Commands/Dumper.cs b/ReCodeItCLI/Commands/Dumper.cs
index 43c79c5..cb4208b 100644
--- a/ReCodeItCLI/Commands/Dumper.cs
+++ b/ReCodeItCLI/Commands/Dumper.cs
@@ -9,13 +9,8 @@ namespace ReCodeIt.Commands;
[Command("Dumper", Description = "Generates a dumper zip")]
public class Dumper : ICommand
{
- [CommandParameter(0, IsRequired = true, Description = "The absolute path to your DeObfuscated assembly file, folder must contain all references to be resolved.")]
- public string GameAssemblyPath { get; init; }
-
- [CommandParameter(1, IsRequired = true, Description = "The absolute path to your FileChecker.dll file, folder must contain all refgerences to be resolved.")]
- public string CheckerAssemblyPath { get; init; }
-
- private Dumpy _dumpy { get; set; }
+ [CommandParameter(0, IsRequired = true, Description = "The absolute path to your Managed folder for EFT, folder must contain all references to be resolved.")]
+ public string ManagedDirectory { get; init; }
public ValueTask ExecuteAsync(IConsole console)
{
@@ -23,10 +18,8 @@ public class Dumper : ICommand
DataProvider.LoadAppSettings();
Logger.Log("Creating Dumper...");
-
- _dumpy = new Dumpy(GameAssemblyPath, CheckerAssemblyPath, Path.GetDirectoryName(GameAssemblyPath));
- _dumpy.CreateDumpFolders();
- _dumpy.CreateDumper();
+
+ ReCodeItLib.Dumper.Dumper.CreateDumper(ManagedDirectory);
Logger.Log("Complete", ConsoleColor.Green);
diff --git a/RecodeItLib/Dumper/Dumper.cs b/RecodeItLib/Dumper/Dumper.cs
new file mode 100644
index 0000000..09f895f
--- /dev/null
+++ b/RecodeItLib/Dumper/Dumper.cs
@@ -0,0 +1,338 @@
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+using ReCodeIt.Utils;
+
+namespace ReCodeItLib.Dumper;
+
+public class Dumper
+{
+ public static void CreateDumper(string managedPath)
+ {
+ var resolver = new DefaultAssemblyResolver();
+ resolver.AddSearchDirectory(managedPath);
+
+ // remove these dirs so it resolves to managed folder only
+ resolver.RemoveSearchDirectory(".");
+ resolver.RemoveSearchDirectory("bin");
+
+ var readerParameters = new ReaderParameters { AssemblyResolver = resolver };
+
+ // Assembly-CSharp section
+ var assemblyPath = Path.Combine(managedPath, "Assembly-Csharp.dll");
+ var dumperOutputPath = Path.Combine(managedPath, "dumper");
+ var dumperBackupPath = Path.Combine(dumperOutputPath, "backup");
+ var dumperDataFolder = Path.Combine(dumperOutputPath, "DUMPDATA");
+ var newAssemblyPath = Path.Combine(dumperOutputPath, "Assembly-CSharp.dll");
+
+ Directory.CreateDirectory(dumperOutputPath);
+ Directory.CreateDirectory(dumperBackupPath);
+ Directory.CreateDirectory(dumperDataFolder);
+
+ File.Copy(Path.Combine(managedPath, "Assembly-CSharp.dll"), Path.Combine(dumperBackupPath, "Assembly-CSharp.dll"), true);
+ File.Copy(Path.Combine(managedPath, "FilesChecker.dll"), Path.Combine(dumperBackupPath, "FilesChecker.dll"), true);
+ File.Copy(".\\Assets\\Dumper\\DumpLib.dll", Path.Combine(dumperOutputPath, "DumpLib.dll"), true);
+ File.Copy(".\\Assets\\Dumper\\DUMPDATA\\botReqData.json", dumperDataFolder + "\\botreqData.json", true);
+ File.Copy(".\\Assets\\Dumper\\DUMPDATA\\config.json", dumperDataFolder + "\\config.json", true);
+ File.Copy(".\\Assets\\Dumper\\DUMPDATA\\raidSettings.json", dumperDataFolder + "\\raidSettings.json", true);
+
+ // loads assembly
+ var oldAssembly = AssemblyDefinition.ReadAssembly(assemblyPath, readerParameters);
+
+ // gets all types
+ var types = oldAssembly.MainModule.GetTypes().ToList();
+
+ // finds and checks for type with backRequest
+ var backRequestType = types.Where(DumpyTypeHelper.GetBackRequestType).ToList();
+ CheckNullOrMulti(backRequestType, "BackRequest");
+
+ // finds and checks for type with ValidateCertificate
+ var validateCertificateType = types.Where(DumpyTypeHelper.GetValidateCertificateType).ToList();
+ CheckNullOrMulti(validateCertificateType, "ValidateCertificate");
+
+ // finds and checks for type with RunValidation
+ var runValidationType = types.Where(DumpyTypeHelper.GetRunValidationType).ToList();
+ CheckNullOrMulti(runValidationType, "RunValidation");
+
+ var dumpyTaskType = types.Where(DumpyTypeHelper.GetMenuScreenType).ToList();
+ CheckNullOrMulti(dumpyTaskType, "DumpyTask");
+
+ // apply code changes
+ SetBackRequestCode(oldAssembly, backRequestType[0]);
+ SetValidateCertificateCode(validateCertificateType[0]);
+ SetRunValidationCode(oldAssembly, runValidationType[0]);
+ SetDumpyTaskCode(oldAssembly, dumpyTaskType[0]);
+
+ // write modified assembly to file
+ oldAssembly.Write(newAssemblyPath);
+
+ // FilesChecker section
+ var oldFilesCheckerPath = Path.Combine(managedPath, "FilesChecker.dll");
+ var oldFilesChecker = AssemblyDefinition.ReadAssembly(oldFilesCheckerPath, readerParameters);
+ var newFilesCheckerPath = Path.Combine(dumperOutputPath, Path.GetFileName(oldFilesCheckerPath));
+
+ // gets all types
+ types = oldFilesChecker.MainModule.GetTypes().ToList();
+
+ // finds and checks for type called EnsureConsistency
+ var ensureConsistencyType = types.Where(DumpyTypeHelper.GetEnsureConsistencyType).ToList();
+ CheckNullOrMulti(ensureConsistencyType, "EnsureConsistency");
+
+ // apply code changes
+ SetEnsureConsistencyCode(oldFilesChecker, ensureConsistencyType[0]);
+ SetEnsureConsistencySingleCode(oldFilesChecker, ensureConsistencyType[0]);
+
+ // Write modified assembly to file
+ oldFilesChecker.Write(newFilesCheckerPath);
+ }
+
+ ///
+ /// Finds the method with backRequest and bResponse as params.
+ /// Checks the method instructions before modification has a count of 269,
+ /// if this is not the case, this needs to be checked.
+ /// This type passed in is the only type with this method.
+ ///
+ ///
+ ///
+ private static void SetBackRequestCode(AssemblyDefinition oldAssembly, TypeDefinition type)
+ {
+ // find method
+ var method = type.Methods.First(x =>
+ x.Parameters.Any(p => p.Name is "backRequest") && x.Parameters.Any(p => p.Name == "bResponse"));
+
+ if (method == null || method.Body.Instructions.Count != 269)
+ {
+ Logger.Log($"BackRequest Instructions count has changed from 269 to {method.Body.Instructions.Count}", ConsoleColor.Red);
+ }
+
+ // where we insert the new instructions
+ var startOfInstructions = 252;
+
+ var processor = method.Body.GetILProcessor();
+
+ var liList = DumpyInstructionsHelper.GetBackRequestInstructions(oldAssembly, method);
+
+ var index = method.Body.Instructions[startOfInstructions];
+
+ foreach (var item in liList)
+ {
+ processor.InsertBefore(index, item);
+ }
+
+ var ins = Instruction.Create(OpCodes.Brfalse_S, method.Body.Instructions[startOfInstructions]); // create instruction to jump to index 252
+
+ method.Body.Instructions[220] = ins; // instruction to jump from 202 to 252
+ }
+
+ ///
+ /// Finds the method called ValidateCertificate.
+ /// Checks that we found two of these methods,
+ /// if this is not the case, this needs to be checked.
+ /// This type passed in is the only type with this method.
+ ///
+ ///
+ ///
+ private static void SetValidateCertificateCode(TypeDefinition type)
+ {
+ var methods = type.Methods.Where(x =>
+ x.Name == "ValidateCertificate"); // should be 2
+
+ // check make sure nothing has changed
+ var firstMethod = methods.FirstOrDefault(m => m.Parameters.Any(p => p.Name == "certificate"));
+ var secondMethod = methods.FirstOrDefault(m => m.Parameters.Any(p => p.Name == "certificateData"));
+
+ if (firstMethod?.Body.Instructions.Count != 55 || secondMethod?.Body.Instructions.Count != 14)
+ {
+ var errorMessage =
+ $"Instruction count has changed, method with 'certificate' as a param - before: 51, now: {firstMethod.Body.Instructions.Count}, " +
+ $"method with 'certificateData' as a param - before: 14, now: {secondMethod.Body.Instructions.Count}";
+ Logger.Log(errorMessage, ConsoleColor.Red);
+ }
+
+ if (methods.Count() != 2)
+ {
+ Logger.Log($"ValidateCertificate should be found twice, count was: {methods.Count()}", ConsoleColor.Red);
+ }
+
+ foreach (var method in methods)
+ {
+ // clear these from the body.
+ method.Body.Instructions.Clear();
+ method.Body.Variables.Clear();
+ method.Body.ExceptionHandlers.Clear();
+
+ // return true;
+ var ins = Instruction.Create(OpCodes.Ldc_I4_1);
+ var ins1 = Instruction.Create(OpCodes.Ret);
+
+ // add instructions
+ method.Body.Instructions.Add(ins);
+ method.Body.Instructions.Add(ins1);
+ }
+ }
+
+ ///
+ /// Finds the method called RunValidation and MoveNext.
+ /// Checks that we found two of these methods,
+ /// if this is not the case, this needs to be checked.
+ /// This type passed in is the only type with this method.
+ ///
+ ///
+ ///
+ private static void SetRunValidationCode(AssemblyDefinition oldAssembly, TypeDefinition type)
+ {
+ var method = type.Methods.First(x => x.Name == "RunValidation");
+ var method2 = type.NestedTypes[0].Methods.First(x => x.Name == "MoveNext");
+
+ if (method == null || method.Body.Instructions.Count != 25)
+ {
+ Logger.Log($"RunValidation Instructions count has changed from 25 to {method.Body.Instructions.Count}", ConsoleColor.Red);
+ }
+
+ if (method2 == null || method2.Body.Instructions.Count != 171)
+ {
+ Logger.Log($"RunValidation's MoveNext Instructions count has changed from 171 to {method2.Body.Instructions.Count}", ConsoleColor.Red);
+ }
+
+ // Clear these from the body of each method respectively
+ method.Body.Instructions.Clear();
+ method2.Body.Instructions.Clear();
+ method2.Body.Variables.Clear();
+ method2.Body.ExceptionHandlers.Clear();
+
+ var processor = method.Body.GetILProcessor();
+ var processor2 = method2.Body.GetILProcessor();
+
+ var liList = DumpyInstructionsHelper.GetRunValidationInstructions(oldAssembly, method);
+ var liList2 = DumpyInstructionsHelper.GetRunValidationInstructionsMoveNext(oldAssembly, method2);
+
+ foreach (var instruction in liList)
+ {
+ processor.Append(instruction);
+ }
+
+ foreach (var instruction in liList2)
+ {
+ processor2.Append(instruction);
+ }
+
+ var ins = Instruction.Create(OpCodes.Leave_S, method2.Body.Instructions[14]); // Create instruction to jump to index 14
+ var ins1 = Instruction.Create(OpCodes.Leave_S, method2.Body.Instructions[method2.Body.Instructions.IndexOf(method2.Body.Instructions.Last())]); // Create instruction to jump to last index
+
+ processor2.InsertAfter(method2.Body.Instructions[5], ins); // Instruction to jump from 5 to 14
+ processor2.InsertAfter(method2.Body.Instructions[14], ins1); // Instruction to jump from 14 to last index
+
+ // Create exception handler with defined indexes
+ var handler = new ExceptionHandler(ExceptionHandlerType.Catch)
+ {
+ TryStart = method2.Body.Instructions[3],
+ TryEnd = method2.Body.Instructions[7],
+ HandlerStart = method2.Body.Instructions[7],
+ HandlerEnd = method2.Body.Instructions[16],
+ CatchType = method2.Module.ImportReference(typeof(Exception)),
+ };
+
+ // Add exception handler to method body
+ method2.Body.ExceptionHandlers.Add(handler);
+ }
+
+ ///
+ /// Finds the method called EnsureConsistency.
+ /// if this is not the case, this needs to be checked.
+ /// This type passed in is the only type with this method.
+ ///
+ ///
+ ///
+ private static void SetEnsureConsistencyCode(AssemblyDefinition oldFileChecker, TypeDefinition type)
+ {
+ var method = type.Methods.First(x => x.Name == "EnsureConsistency");
+
+ if (method == null || method.Body.Instructions.Count != 152)
+ {
+ Logger.Log($"EnsureConsistency is null or Instructions count has changed from 152 to {method.Body.Instructions.Count}", ConsoleColor.Red);
+ }
+
+ var processor = method.Body.GetILProcessor();
+
+ // clear these from the method body
+ method.Body.Instructions.Clear();
+ method.Body.Variables.Clear();
+ method.Body.ExceptionHandlers.Clear();
+
+ var liList = DumpyInstructionsHelper.GetEnsureConsistencyInstructions(oldFileChecker, method);
+
+ foreach (var li in liList)
+ {
+ processor.Append(li);
+ }
+ }
+
+ ///
+ /// Finds the method called EnsureConsistencySingle.
+ /// if this is not the case, this needs to be checked.
+ /// This type passed in is the only type with this method.
+ ///
+ ///
+ ///
+ private static void SetEnsureConsistencySingleCode(AssemblyDefinition oldFileChecker, TypeDefinition type)
+ {
+ var method = type.Methods.First(x => x.Name == "EnsureConsistencySingle");
+
+ if (method == null || method.Body.Instructions.Count != 101)
+ {
+ Logger.Log($"EnsureConsistencySingle is null or Instructions count has changed from 101 to {method.Body.Instructions.Count}", ConsoleColor.Red);
+ }
+
+ // clear these from the method body
+ method.Body.Instructions.Clear();
+ method.Body.Variables.Clear();
+ method.Body.ExceptionHandlers.Clear();
+
+ var processor = method.Body.GetILProcessor();
+
+ var liList = DumpyInstructionsHelper.GetEnsureConsistencyInstructions(oldFileChecker, method);
+
+ foreach (var li in liList)
+ {
+ processor.Append(li);
+ }
+ }
+
+ private static void SetDumpyTaskCode(AssemblyDefinition oldAssembly, TypeDefinition type)
+ {
+ var method = type.Methods.First(x => x.Name == "Awake");
+
+ if (method == null || method.Body.Instructions.Count != 62)
+ {
+ Logger.Log($"MainMenu is null or instructions have changed from 62 to {method.Body.Instructions.Count}", ConsoleColor.Red);
+ }
+
+ var processor = method.Body.GetILProcessor();
+
+ var liList = DumpyInstructionsHelper.GetDumpyTaskInstructions(oldAssembly, method);
+
+ var index = method.Body.Instructions.First(x => x.OpCode == OpCodes.Ret);
+
+ foreach (var item in liList)
+ {
+ processor.InsertBefore(index, item);
+ }
+ }
+
+ ///
+ /// Checks for null or multiple types
+ ///
+ /// ICollection
+ /// string
+ public static void CheckNullOrMulti(List types, string name = "")
+ {
+ if (types == null)
+ {
+ Logger.Log($"{name} was null", ConsoleColor.Red);
+ }
+
+ if (types.Count > 1)
+ {
+ Logger.Log($"{name} count was more than 1", ConsoleColor.Red);
+ }
+ }
+}
\ No newline at end of file
diff --git a/RecodeItLib/Dumper/Dumpy.cs b/RecodeItLib/Dumper/Dumpy.cs
deleted file mode 100644
index b3b1b2a..0000000
--- a/RecodeItLib/Dumper/Dumpy.cs
+++ /dev/null
@@ -1,331 +0,0 @@
-using System.Collections;
-using dnlib.DotNet;
-using dnlib.DotNet.Emit;
-using ReCodeIt.Utils;
-
-namespace ReCodeItLib.Dumper;
-
-public class Dumpy
-{
- private ModuleDefMD? _gameModule { get; set; }
- private ModuleDefMD? _checkerModule { get; set; }
- private string _assemblyPath { get; set; }
- private string _fileCheckerPath { get; set; }
- private string _path { get; set; }
- private List? _gameTypes { get; set; }
- private List? _checkerTypes { get; set; }
-
- public Dumpy(string assemblyPath, string fileCheckerPath, string path)
- {
- _assemblyPath = assemblyPath;
- _fileCheckerPath = fileCheckerPath;
- _path = path;
-
- if (!File.Exists(_assemblyPath))
- {
- Logger.Log($"File does not exist at: {_assemblyPath}", ConsoleColor.Red);
- return;
- }
-
- if (!File.Exists(_fileCheckerPath))
- {
- Logger.Log($"File does not exist at: {_fileCheckerPath}", ConsoleColor.Red);
- return;
- }
-
- _gameModule = DataProvider.LoadModule(_assemblyPath);
- _checkerModule = DataProvider.LoadModule(_fileCheckerPath);
- _gameTypes = _gameModule.GetTypes().ToList();
- _checkerTypes = _checkerModule.GetTypes().ToList();
- }
-
- public void CreateDumper()
- {
- if (_gameModule == null || _gameTypes == null)
- {
- Logger.Log($"_gameModule or _gameTypes in Dumpy was null", ConsoleColor.Red);
- return;
- }
-
- if (_checkerModule == null || _checkerTypes == null)
- {
- Logger.Log($"_checkerModule or _checkerTypes in Dumpy was null", ConsoleColor.Red);
- return;
- }
-
- // make changes to assembly
-
- // get required types
- // var backRequestType = _gameTypes.Where(DumpyTypeHelper.GetBackRequestType).ToList();
- // var validateCertType = _gameTypes.Where(DumpyTypeHelper.GetValidateCertType).ToList();
- // var runValidationType = _gameTypes.Where(DumpyTypeHelper.GetRunValidationType).ToList();
- // var dumpyTaskType = _gameTypes.Where(DumpyTypeHelper.GetMenuscreenType).ToList();
-
- // check types
- // CheckNullOrMulti(backRequestType, "BackRequest");
- // CheckNullOrMulti(validateCertType, "ValidateCertificate");
- // CheckNullOrMulti(runValidationType, "RunValidation");
- // CheckNullOrMulti(dumpyTaskType, "DumpyTask");
-
- // apply code changes
- // SetBackRequestCode(backRequestType[0]);
- // SetValidateCertCode(validateCertificateType[0]);
- // SetRunValidationCode(runValidationType[0]);
- // SetDumpyTaskCode(dumpyTaskType[0]);
-
- // TODO: Write game assembly to file
-
- // get types
- // var ensureConsistencyTypes = _checkerTypes.Where(DumpyTypeHelper.GetEnsureConsistencyType).ToList();
- // check types
- // CheckNullOrMulti(ensureConsistencyTypes, "EnsureConsistency");
-
- // apply code changes
- // SetEnsureConsistencyCode(ensureConsistencyType[0]);
- // SetEnsureConsistencySingleCode(ensureConsistencyType[0]);
-
- // TODO: Write fileChecker assembly to file
- }
-
- public void CreateDumpFolders()
- {
- // create dumper folders
- }
-
- ///
- /// Checks for null or multiple types
- ///
- /// ICollection
- /// string
- private void CheckNullOrMulti(ICollection types, string name = "")
- {
- if (types == null)
- {
- Logger.Log($"{name} was null");
- }
-
- if (types.Count > 1)
- {
- Logger.Log($"{name} count was more than 1");
- }
- }
-
- ///
- /// Finds the method with backRequest and bResponse as params.
- /// Checks the method instructions before modification has a count of 269,
- /// if this is not the case, this needs to be checked.
- /// This type passed in is the only type with this method.
- ///
- ///
- ///
- private void SetBackRequestCode(TypeDef type)
- {
- // find method
- var method = type.Methods.First(x => x.Parameters.Any(p => p.Name is "backRequest" && x.Parameters.Any(p => p.Name == "bResponse")));
-
- if (method == null || method.Body.Instructions.Count != 269)
- {
- Logger.Log($"BackRequest Instructions count has changed from 269 to {method.Body.Instructions.Count}", ConsoleColor.Red);
- }
-
- var startOfInstructions = 252;
- // var liList = DumpyInstructionsHelper.GetBackRequestInstructions();
- var index = method.Body.Instructions[startOfInstructions];
-
- // foreach (var li in liList)
- // {
- // // something along these lines, this needs to be tested
- // method.Body.Instructions.InsertBefore(index, li);
- // }
-
- // create instruction
- var ins = Instruction.Create(OpCodes.Brfalse_S, method.Body.Instructions[startOfInstructions]);
-
- // replace instruction at 220 with this
- method.Body.Instructions[220] = ins;
- }
-
- ///
- /// Finds the method called ValidateCertificate.
- /// Checks that we found two of these methods,
- /// if this is not the case, this needs to be checked.
- /// This type passed in is the only type with this method.
- ///
- ///
- ///
- private void SetValidateCertCode(TypeDef type)
- {
- var methods = type.Methods.Where(x =>
- x.Name == "ValidateCertificate"); // should be 2
-
- // check make sure nothing has changed
- var firstMethod = methods.FirstOrDefault(m => m.Parameters.Any(p => p.Name == "certificate"));
- var secondMethod = methods.FirstOrDefault(m => m.Parameters.Any(p => p.Name == "certificateData"));
-
- if (firstMethod?.Body.Instructions.Count != 55 || secondMethod?.Body.Instructions.Count != 14)
- {
- Logger.Log($"Instruction count has changed, method with 'certificate' as a param - before: 51, now: {firstMethod.Body.Instructions.Count}, " +
- $"method with 'certificateData' as a param - before: 14, now: {secondMethod.Body.Instructions.Count}", ConsoleColor.Red);
- }
-
- if (methods.Count() != 2)
- {
- Logger.Log($"ValidateCertificate should be found twice, count was: {methods.Count()}", ConsoleColor.Red);
- }
-
- foreach (var method in methods)
- {
- // clear these from the body.
- method.Body.Instructions.Clear();
- method.Body.Variables.Clear();
- method.Body.ExceptionHandlers.Clear();
-
- // return true;
- var ins = Instruction.Create(OpCodes.Ldc_I4_1);
- var ins1 = Instruction.Create(OpCodes.Ret);
-
- // add instructions
- method.Body.Instructions.Add(ins);
- method.Body.Instructions.Add(ins1);
- }
- }
-
- ///
- /// Finds the method called RunValidation and MoveNext.
- /// Checks that we found two of these methods,
- /// if this is not the case, this needs to be checked.
- /// This type passed in is the only type with this method.
- ///
- ///
- ///
- private void SetRunValidationCode(TypeDef type)
- {
- var method = type.Methods.First(x => x.Name == "RunValidation");
- var method2 = type.NestedTypes[0].Methods.First(x => x.Name == "MoveNext");
-
- if (method == null || method.Body.Instructions.Count != 25)
- {
- Logger.Log($"RunValidation Instructions count has changed from 25 to {method.Body.Instructions.Count}");
- }
-
- if (method2 == null || method2.Body.Instructions.Count != 171)
- {
- Logger.Log($"RunValidation's MoveNext Instructions count has changed from 171 to {method2.Body.Instructions.Count}");
- }
-
- // Clear these from the body of each method respectively
- method.Body.Instructions.Clear();
- method2.Body.Instructions.Clear();
- method2.Body.Variables.Clear();
- method2.Body.ExceptionHandlers.Clear();
-
- // var liList = DumpyInstructionsHelper.GetRunValidationInstructions(oldAssembly, method);
- // var liList2 = DumpyInstructionsHelper.GetRunValidationInstructionsMoveNext(oldAssembly, method2);
-
- // foreach (var instruction in liList)
- // {
- // method.Body.Instructions.Append(instruction);
- // }
- //
- // foreach (var instruction in liList2)
- // {
- // method2.Body.Instructions.Append(instruction);
- // }
-
- var ins = Instruction.Create(OpCodes.Leave_S, method2.Body.Instructions[14]); // Create instruction to jump to index 14
- var ins1 = Instruction.Create(OpCodes.Leave_S, method2.Body.Instructions[method2.Body.Instructions.IndexOf(method2.Body.Instructions.Last())]); // Create instruction to jump to last index
-
- method2.Body.Instructions.InsertAfter(method2.Body.Instructions[5], ins); // Instruction to jump from 5 to 14
- method2.Body.Instructions.InsertAfter(method2.Body.Instructions[14], ins1); // Instruction to jump from 14 to last index
-
- // Create exception handler with defined indexes
- var handler = new ExceptionHandler(ExceptionHandlerType.Catch)
- {
- TryStart = method2.Body.Instructions[3],
- TryEnd = method2.Body.Instructions[7],
- HandlerStart = method2.Body.Instructions[7],
- HandlerEnd = method2.Body.Instructions[16],
- // CatchType = method2.Module.ImportReference(typeof(Exception)), // needs fixing
- };
-
- // Add exception handler to method body
- method2.Body.ExceptionHandlers.Add(handler);
- }
-
- private void SetDumpyTaskCode(TypeDef type)
- {
- var method = type.Methods.First(x => x.Name == "Awake");
-
- if (method == null || method.Body.Instructions.Count != 62)
- {
- Logger.Log($"MainMenu is null or isnt 62 instructions, SOMETHING HAD CHANGED!", ConsoleColor.Red);
- }
-
- // var liList = DumpyInstructionsHelper.GetDumpyTaskInstructions(oldAssembly, method);
-
- var index = method.Body.Instructions.First(x => x.OpCode == OpCodes.Ret);
-
- // foreach (var item in liList)
- // {
- // method.Body.Instructions.InsertBefore(index, item);
- // }
- }
-
- ///
- /// Finds the method called EnsureConsistency.
- /// if this is not the case, this needs to be checked.
- /// This type passed in is the only type with this method.
- ///
- ///
- ///
- private static void SetEnsureConsistencyCode(TypeDef type)
- {
- var method = type.Methods.First(x => x.Name == "EnsureConsistency");
-
- if (method == null || method.Body.Instructions.Count != 152)
- {
- Logger.Log($"EnsureConsistency Instructions count has changed from 152 to {method.Body.Instructions.Count}", ConsoleColor.Red);
- }
-
- // clear these from the method body
- method.Body.Instructions.Clear();
- method.Body.Variables.Clear();
- method.Body.ExceptionHandlers.Clear();
-
- // var liList = DumpyInstructionsHelper.GetEnsureConsistencyInstructions(oldFileChecker, method);
- //
- // foreach (var li in liList)
- // {
- // method.Body.Instructions.Append(li);
- // }
- }
-
- ///
- /// Finds the method called EnsureConsistencySingle.
- /// if this is not the case, this needs to be checked.
- /// This type passed in is the only type with this method.
- ///
- ///
- ///
- private static void SetEnsureConsistencySingleCode(TypeDef type)
- {
- var method = type.Methods.First(x => x.Name == "EnsureConsistencySingle");
-
- if (method == null || method.Body.Instructions.Count != 101)
- {
- Logger.Log($"EnsureConsistencySingle Instructions count has changed from 101 to {method.Body.Instructions.Count}", ConsoleColor.Red);
- }
-
- // clear these from the method body
- method.Body.Instructions.Clear();
- method.Body.Variables.Clear();
- method.Body.ExceptionHandlers.Clear();
-
- // var liList = DumpyInstructionsHelper.GetEnsureConsistencyInstructions(oldFileChecker, method);
- //
- // foreach (var li in liList)
- // {
- // method.Body.Instructions.Append(li);
- // }
- }
-}
\ No newline at end of file
diff --git a/RecodeItLib/Dumper/DumpyInstructionsHelper.cs b/RecodeItLib/Dumper/DumpyInstructionsHelper.cs
index dcf252f..8bcb40d 100644
--- a/RecodeItLib/Dumper/DumpyInstructionsHelper.cs
+++ b/RecodeItLib/Dumper/DumpyInstructionsHelper.cs
@@ -1,170 +1,172 @@
-// using System;
-// using System.Collections.Generic;
-// using System.Linq;
-// using System.Threading.Tasks;
-// using DumpLib;
-//
-// namespace ReCodeItLib.Dumper;
-//
-// public static class DumpyInstructionsHelper
-// {
-// ///
-// /// Sets up local variables and returns a List of instructions to add.
-// ///
-// /// AssemblyDefinition
-// /// MethodDefinition
-// /// List
-// public static List GetBackRequestInstructions(AssemblyDefinition assembly, MethodDefinition method)
-// {
-// return new List
-// {
-// Instruction.Create(OpCodes.Ldarg_1),
-// Instruction.Create(OpCodes.Ldloc_S, method.Body.Variables[6]),
-// Instruction.Create(OpCodes.Call, assembly.MainModule.ImportReference(typeof(DumpLib.DumpyTool).GetMethod("LogRequestResponse", new[] { typeof(object), typeof(object) })))
-// };
-// }
-//
-// ///
-// /// Returns a List of instructions to be added to the method.
-// /// This is an Async method so there is two parts, this part and a RunValidation method.
-// ///
-// /// AssemblyDefinition
-// /// MethodDefinition
-// /// List
-// public static List GetRunValidationInstructionsMoveNext(AssemblyDefinition assembly, MethodDefinition method)
-// {
-// // Add our own local variables
-//
-// // var1 index0 class1159Type
-// var sptClassType = assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType);
-// var sptClass = new VariableDefinition(sptClassType);
-// method.Body.Variables.Add(sptClass);
-//
-// // var2 index1 ExceptionType
-// var sptExceptionType = method.Module.ImportReference(typeof(Exception));
-// var sptException = new VariableDefinition(sptExceptionType);
-// method.Body.Variables.Add(sptException);
-//
-// return new List
-// {
-// // most of this is to keep the Async happy
-//
-// Instruction.Create(OpCodes.Ldarg_0),
-// Instruction.Create(OpCodes.Ldfld, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[2]),
-// Instruction.Create(OpCodes.Stloc_0),
-//
-// // this.Succeed = true;
-// Instruction.Create(OpCodes.Ldloc_0),
-// Instruction.Create(OpCodes.Ldc_I4_1),
-// Instruction.Create(OpCodes.Call, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).Methods.First(x => x.Name == "set_Succeed")),
-//
-// Instruction.Create(OpCodes.Stloc_1),
-// Instruction.Create(OpCodes.Ldarg_0),
-// Instruction.Create(OpCodes.Ldc_I4_S, (sbyte)-2),
-// Instruction.Create(OpCodes.Stfld, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[0]),
-// Instruction.Create(OpCodes.Ldarg_0),
-// Instruction.Create(OpCodes.Ldflda, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1]),
-// Instruction.Create(OpCodes.Ldloc_1),
-// Instruction.Create(OpCodes.Call,
-// method.Module.ImportReference(assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1].FieldType.Resolve().Methods.First(x => x.Name == "SetException"))),
-//
-// Instruction.Create(OpCodes.Ldarg_0),
-// Instruction.Create(OpCodes.Ldc_I4_S, (sbyte)-2),
-// Instruction.Create(OpCodes.Stfld, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[0]),
-//
-// Instruction.Create(OpCodes.Ldarg_0),
-// Instruction.Create(OpCodes.Ldflda, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1]),
-// Instruction.Create(OpCodes.Call, method.Module.ImportReference(assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1].FieldType.Resolve().Methods.First(x => x.Name == "SetResult"))),
-//
-// Instruction.Create(OpCodes.Ret),
-// };
-// }
-//
-// ///
-// /// Returns a List of instructions to be added to the method.
-// /// This is an Async method so there is two parts, this part and a RunValidation method.
-// ///
-// /// AssemblyDefinition
-// /// MethodDefinition
-// /// List
-// public static List GetEnsureConsistencyInstructions(AssemblyDefinition oldFileChecker, MethodDefinition method)
-// {
-// // init local vars
-// // var1 index0 TimeSpan type
-// var sptTimeSpanType = method.Module.ImportReference(typeof(TimeSpan));
-// var sptClass = new VariableDefinition(sptTimeSpanType);
-// method.Body.Variables.Add(sptClass);
-//
-// // Create genericInstance of a method
-// var type = oldFileChecker.MainModule.GetTypes().First(DumpyTypeHelper.GetEnsureConsistencyType).NestedTypes[0].Interfaces[0].InterfaceType;
-// var typeMethod = method.Module.ImportReference(typeof(Task).GetMethod("FromResult"));
-// var instanceType = new GenericInstanceMethod(typeMethod);
-// instanceType.GenericArguments.Add(type);
-//
-// return new List
-// {
-// // return Task.FromResult(ConsistencyController.CheckResult.Succeed(default(TimeSpan)));
-// Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
-// Instruction.Create(OpCodes.Initobj, method.Module.ImportReference(typeof(TimeSpan))),
-// Instruction.Create(OpCodes.Ldloc_0),
-// Instruction.Create(OpCodes.Call, oldFileChecker.MainModule.GetTypes().First(DumpyTypeHelper.GetEnsureConsistencyType).NestedTypes[0].Methods.First(x => x.Name == "Succeed")),
-// Instruction.Create(OpCodes.Call, instanceType),
-// Instruction.Create(OpCodes.Ret)
-// };
-// }
-//
-// ///
-// /// Returns a List of instructions to be added to the method.
-// /// This is an Async method so there is two parts, this part and a MoveNext method.
-// ///
-// /// AssemblyDefinition
-// /// MethodDefinition
-// /// List
-// public static List GetRunValidationInstructions(AssemblyDefinition assembly, MethodDefinition method)
-// {
-// // Create genericInstance of a method
-// var type = assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0];
-// var typeMethod = method.Module.ImportReference(assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1].FieldType.Resolve().Methods.First(x => x.Name == "Start"));
-// var instanceMethod = new GenericInstanceMethod(typeMethod);
-// instanceMethod.GenericArguments.Add(type);
-//
-// return new List
-// {
-// // d__.<>t__builder = AsyncTaskMethodBuilder.Create();
-// Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
-// Instruction.Create(OpCodes.Call, method.Module.ImportReference(assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1].FieldType.Resolve().Methods.First(x => x.Name == "Create"))),
-// Instruction.Create(OpCodes.Stfld, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1]),
-//
-// // d__.<>4__this = this;
-// Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
-// Instruction.Create(OpCodes.Ldarg_0),
-// Instruction.Create(OpCodes.Stfld, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[2]),
-//
-// // d__.<>1__state = -1;
-// Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
-// Instruction.Create(OpCodes.Ldc_I4_M1),
-// Instruction.Create(OpCodes.Stfld, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[0]),
-//
-// // d__.<>t__builder.Startd__0>(ref d__);
-// Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
-// Instruction.Create(OpCodes.Ldflda, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1]),
-// Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
-// Instruction.Create(OpCodes.Call, instanceMethod),
-//
-// // return d__.<>t__builder.Task;
-// Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
-// Instruction.Create(OpCodes.Ldflda, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1]),
-// Instruction.Create(OpCodes.Call, method.Module.ImportReference(assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1].FieldType.Resolve().Methods.First(x => x.Name == "get_Task"))),
-// Instruction.Create(OpCodes.Ret),
-// };
-// }
-//
-// public static List GetDumpyTaskInstructions(AssemblyDefinition oldAssembly, MethodDefinition method)
-// {
-// return new List
-// {
-// Instruction.Create(OpCodes.Call, oldAssembly.MainModule.ImportReference(typeof(DumpyTool).GetMethod("StartDumpyTask"))),
-// Instruction.Create(OpCodes.Pop)
-// };
-// }
-// }
\ No newline at end of file
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using DumpLib;
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+
+namespace ReCodeItLib.Dumper;
+
+public static class DumpyInstructionsHelper
+{
+ ///
+ /// Sets up local variables and returns a List of instructions to add.
+ ///
+ /// AssemblyDefinition
+ /// MethodDefinition
+ /// List
+ public static List GetBackRequestInstructions(AssemblyDefinition assembly, MethodDefinition method)
+ {
+ return new List
+ {
+ Instruction.Create(OpCodes.Ldarg_1),
+ Instruction.Create(OpCodes.Ldloc_S, method.Body.Variables[6]),
+ Instruction.Create(OpCodes.Call, assembly.MainModule.ImportReference(typeof(DumpLib.DumpyTool).GetMethod("LogRequestResponse", new[] { typeof(object), typeof(object) })))
+ };
+ }
+
+ ///
+ /// Returns a List of instructions to be added to the method.
+ /// This is an Async method so there is two parts, this part and a RunValidation method.
+ ///
+ /// AssemblyDefinition
+ /// MethodDefinition
+ /// List
+ public static List GetRunValidationInstructionsMoveNext(AssemblyDefinition assembly, MethodDefinition method)
+ {
+ // Add our own local variables
+
+ // var1 index0 class1159Type
+ var sptClassType = assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType);
+ var sptClass = new VariableDefinition(sptClassType);
+ method.Body.Variables.Add(sptClass);
+
+ // var2 index1 ExceptionType
+ var sptExceptionType = method.Module.ImportReference(typeof(Exception));
+ var sptException = new VariableDefinition(sptExceptionType);
+ method.Body.Variables.Add(sptException);
+
+ return new List
+ {
+ // most of this is to keep the Async happy
+
+ Instruction.Create(OpCodes.Ldarg_0),
+ Instruction.Create(OpCodes.Ldfld, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[2]),
+ Instruction.Create(OpCodes.Stloc_0),
+
+ // this.Succeed = true;
+ Instruction.Create(OpCodes.Ldloc_0),
+ Instruction.Create(OpCodes.Ldc_I4_1),
+ Instruction.Create(OpCodes.Call, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).Methods.First(x => x.Name == "set_Succeed")),
+
+ Instruction.Create(OpCodes.Stloc_1),
+ Instruction.Create(OpCodes.Ldarg_0),
+ Instruction.Create(OpCodes.Ldc_I4_S, (sbyte)-2),
+ Instruction.Create(OpCodes.Stfld, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[0]),
+ Instruction.Create(OpCodes.Ldarg_0),
+ Instruction.Create(OpCodes.Ldflda, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1]),
+ Instruction.Create(OpCodes.Ldloc_1),
+ Instruction.Create(OpCodes.Call,
+ method.Module.ImportReference(assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1].FieldType.Resolve().Methods.First(x => x.Name == "SetException"))),
+
+ Instruction.Create(OpCodes.Ldarg_0),
+ Instruction.Create(OpCodes.Ldc_I4_S, (sbyte)-2),
+ Instruction.Create(OpCodes.Stfld, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[0]),
+
+ Instruction.Create(OpCodes.Ldarg_0),
+ Instruction.Create(OpCodes.Ldflda, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1]),
+ Instruction.Create(OpCodes.Call, method.Module.ImportReference(assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1].FieldType.Resolve().Methods.First(x => x.Name == "SetResult"))),
+
+ Instruction.Create(OpCodes.Ret),
+ };
+ }
+
+ ///
+ /// Returns a List of instructions to be added to the method.
+ /// This is an Async method so there is two parts, this part and a RunValidation method.
+ ///
+ /// AssemblyDefinition
+ /// MethodDefinition
+ /// List
+ public static List GetEnsureConsistencyInstructions(AssemblyDefinition oldFileChecker, MethodDefinition method)
+ {
+ // init local vars
+ // var1 index0 TimeSpan type
+ var sptTimeSpanType = method.Module.ImportReference(typeof(TimeSpan));
+ var sptClass = new VariableDefinition(sptTimeSpanType);
+ method.Body.Variables.Add(sptClass);
+
+ // Create genericInstance of a method
+ var type = oldFileChecker.MainModule.GetTypes().First(DumpyTypeHelper.GetEnsureConsistencyType).NestedTypes[0].Interfaces[0].InterfaceType;
+ var typeMethod = method.Module.ImportReference(typeof(Task).GetMethod("FromResult"));
+ var instanceType = new GenericInstanceMethod(typeMethod);
+ instanceType.GenericArguments.Add(type);
+
+ return new List
+ {
+ // return Task.FromResult(ConsistencyController.CheckResult.Succeed(default(TimeSpan)));
+ Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
+ Instruction.Create(OpCodes.Initobj, method.Module.ImportReference(typeof(TimeSpan))),
+ Instruction.Create(OpCodes.Ldloc_0),
+ Instruction.Create(OpCodes.Call, oldFileChecker.MainModule.GetTypes().First(DumpyTypeHelper.GetEnsureConsistencyType).NestedTypes[0].Methods.First(x => x.Name == "Succeed")),
+ Instruction.Create(OpCodes.Call, instanceType),
+ Instruction.Create(OpCodes.Ret)
+ };
+ }
+
+ ///
+ /// Returns a List of instructions to be added to the method.
+ /// This is an Async method so there is two parts, this part and a MoveNext method.
+ ///
+ /// AssemblyDefinition
+ /// MethodDefinition
+ /// List
+ public static List GetRunValidationInstructions(AssemblyDefinition assembly, MethodDefinition method)
+ {
+ // Create genericInstance of a method
+ var type = assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0];
+ var typeMethod = method.Module.ImportReference(assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1].FieldType.Resolve().Methods.First(x => x.Name == "Start"));
+ var instanceMethod = new GenericInstanceMethod(typeMethod);
+ instanceMethod.GenericArguments.Add(type);
+
+ return new List
+ {
+ // d__.<>t__builder = AsyncTaskMethodBuilder.Create();
+ Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
+ Instruction.Create(OpCodes.Call, method.Module.ImportReference(assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1].FieldType.Resolve().Methods.First(x => x.Name == "Create"))),
+ Instruction.Create(OpCodes.Stfld, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1]),
+
+ // d__.<>4__this = this;
+ Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
+ Instruction.Create(OpCodes.Ldarg_0),
+ Instruction.Create(OpCodes.Stfld, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[2]),
+
+ // d__.<>1__state = -1;
+ Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
+ Instruction.Create(OpCodes.Ldc_I4_M1),
+ Instruction.Create(OpCodes.Stfld, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[0]),
+
+ // d__.<>t__builder.Startd__0>(ref d__);
+ Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
+ Instruction.Create(OpCodes.Ldflda, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1]),
+ Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
+ Instruction.Create(OpCodes.Call, instanceMethod),
+
+ // return d__.<>t__builder.Task;
+ Instruction.Create(OpCodes.Ldloca_S, method.Body.Variables[0]),
+ Instruction.Create(OpCodes.Ldflda, assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1]),
+ Instruction.Create(OpCodes.Call, method.Module.ImportReference(assembly.MainModule.GetTypes().First(DumpyTypeHelper.GetRunValidationType).NestedTypes[0].Fields[1].FieldType.Resolve().Methods.First(x => x.Name == "get_Task"))),
+ Instruction.Create(OpCodes.Ret),
+ };
+ }
+
+ public static List GetDumpyTaskInstructions(AssemblyDefinition oldAssembly, MethodDefinition method)
+ {
+ return new List
+ {
+ Instruction.Create(OpCodes.Call, oldAssembly.MainModule.ImportReference(typeof(DumpyTool).GetMethod("StartDumpyTask"))),
+ Instruction.Create(OpCodes.Pop)
+ };
+ }
+}
\ No newline at end of file
diff --git a/RecodeItLib/Dumper/DumpyTypeHelper.cs b/RecodeItLib/Dumper/DumpyTypeHelper.cs
index 92fdb6f..aa1407b 100644
--- a/RecodeItLib/Dumper/DumpyTypeHelper.cs
+++ b/RecodeItLib/Dumper/DumpyTypeHelper.cs
@@ -1,54 +1,54 @@
-// using System.Linq;
-// using Mono.Cecil;
-//
-// namespace ReCodeItLib.Dumper;
-//
-// public static class DumpyTypeHelper
-// {
-// ///
-// /// Gets the type that has a method called SendAndHandleRetries.
-// /// This type is the only one with method.
-// ///
-// /// TypeDefinition
-// /// boolean
-// public static bool GetBackRequestType(TypeDefinition type)
-// {
-// return type.Methods.Any(m => m.Name == "SendAndHandleRetries");
-// }
-//
-// ///
-// /// Gets the type that has a method called ValidateCertificate as the name.
-// ///
-// /// TypeDefinition
-// /// boolean
-// public static bool GetValidateCertificateType(TypeDefinition type)
-// {
-// return type.Methods.Any(m => m.Name == "ValidateCertificate");
-// }
-//
-// ///
-// /// Gets the type that has a method called RunValidation as the name.
-// ///
-// /// TypeDefinition
-// /// boolean
-// public static bool GetRunValidationType(TypeDefinition type)
-// {
-// return type.Methods.Any(m => m.Name == "RunValidation");
-// }
-//
-// ///
-// /// Gets the type that has ConsistencyController as the name.
-// /// FilesChecker.dll is not obfuscated.
-// ///
-// /// TypeDefinition
-// /// boolean
-// public static bool GetEnsureConsistencyType(TypeDefinition type)
-// {
-// return type.Name == "ConsistencyController";
-// }
-//
-// public static bool GetMenuScreenType(TypeDefinition type)
-// {
-// return type.Name == "MenuScreen";
-// }
-// }
\ No newline at end of file
+using System.Linq;
+using Mono.Cecil;
+
+namespace ReCodeItLib.Dumper;
+
+public static class DumpyTypeHelper
+{
+ ///
+ /// Gets the type that has a method called SendAndHandleRetries.
+ /// This type is the only one with method.
+ ///
+ /// TypeDefinition
+ /// boolean
+ public static bool GetBackRequestType(TypeDefinition type)
+ {
+ return type.Methods.Any(m => m.Name == "SendAndHandleRetries");
+ }
+
+ ///
+ /// Gets the type that has a method called ValidateCertificate as the name.
+ ///
+ /// TypeDefinition
+ /// boolean
+ public static bool GetValidateCertificateType(TypeDefinition type)
+ {
+ return type.Methods.Any(m => m.Name == "ValidateCertificate");
+ }
+
+ ///
+ /// Gets the type that has a method called RunValidation as the name.
+ ///
+ /// TypeDefinition
+ /// boolean
+ public static bool GetRunValidationType(TypeDefinition type)
+ {
+ return type.Methods.Any(m => m.Name == "RunValidation");
+ }
+
+ ///
+ /// Gets the type that has ConsistencyController as the name.
+ /// FilesChecker.dll is not obfuscated.
+ ///
+ /// TypeDefinition
+ /// boolean
+ public static bool GetEnsureConsistencyType(TypeDefinition type)
+ {
+ return type.Name == "ConsistencyController";
+ }
+
+ public static bool GetMenuScreenType(TypeDefinition type)
+ {
+ return type.Name == "MenuScreen";
+ }
+}
\ No newline at end of file
diff --git a/RecodeItLib/ReCodeItLib.csproj b/RecodeItLib/ReCodeItLib.csproj
index 38c7a49..b88cc57 100644
--- a/RecodeItLib/ReCodeItLib.csproj
+++ b/RecodeItLib/ReCodeItLib.csproj
@@ -183,5 +183,11 @@
Assets\DumpLib.dll
+
+ ..\Assets\MonoCecil\Mono.Cecil.dll
+
+
+ ..\Assets\MonoCecil\Mono.Cecil.Rocks.dll
+