From 0c08b56faad62720bb4707574775f560037c4572 Mon Sep 17 00:00:00 2001 From: CWX Date: Mon, 12 Aug 2024 12:20:01 +0100 Subject: [PATCH] now creates dir, copies files, and creates dumper zip --- ReCodeItCLI/Commands/Dumper.cs | 2 ++ RecodeItLib/Dumper/DumperClass.cs | 27 ++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ReCodeItCLI/Commands/Dumper.cs b/ReCodeItCLI/Commands/Dumper.cs index c3c498b..47b70b7 100644 --- a/ReCodeItCLI/Commands/Dumper.cs +++ b/ReCodeItCLI/Commands/Dumper.cs @@ -22,6 +22,8 @@ public class Dumper : ICommand var dumper = new DumperClass(ManagedDirectory); dumper.CreateDumpFolders(); dumper.CreateDumper(); + dumper.CopyFiles(); + dumper.ZipFiles(); Logger.Log("Complete", ConsoleColor.Green); diff --git a/RecodeItLib/Dumper/DumperClass.cs b/RecodeItLib/Dumper/DumperClass.cs index 0746c28..6da596e 100644 --- a/RecodeItLib/Dumper/DumperClass.cs +++ b/RecodeItLib/Dumper/DumperClass.cs @@ -3,6 +3,7 @@ using System.Runtime.CompilerServices; using dnlib.DotNet; using dnlib.DotNet.Emit; using ReCodeIt.Utils; +using System.IO.Compression; namespace ReCodeItLib.Dumper; @@ -108,7 +109,31 @@ public class DumperClass public void CreateDumpFolders() { - // TODO: create dumper folders + Directory.CreateDirectory(Path.Combine(_managedPath, "DumperZip")); + Directory.CreateDirectory(Path.Combine(_managedPath, "Dumper/DUMPDATA")); + Directory.CreateDirectory(Path.Combine(_managedPath, "Dumper/EscapeFromTarkov_Data/Managed/backup")); + } + + public void CopyFiles() + { + File.Copy(Path.Combine(_managedPath, "Assembly-CSharp.dll"), Path.Combine(_managedPath, "Dumper/EscapeFromTarkov_Data/Managed/backup/Assembly-CSharp.dll"), true); + File.Copy(Path.Combine(_managedPath, "FilesChecker.dll"), Path.Combine(_managedPath, "Dumper/EscapeFromTarkov_Data/Managed/backup/FilesChecker.dll"), true); + File.Copy(Path.Combine(_managedPath, "Assembly-CSharp-dumper.dll"), Path.Combine(_managedPath, "Dumper/EscapeFromTarkov_Data/Managed/Assembly-CSharp.dll"), true); + File.Copy(Path.Combine(_managedPath, "FilesChecker-dumper.dll"), Path.Combine(_managedPath, "Dumper/EscapeFromTarkov_Data/Managed/FilesChecker.dll"), true); + File.Copy("./DumpLib.dll", Path.Combine(_managedPath, "Dumper/EscapeFromTarkov_Data/Managed/DumpLib.dll"), true); + File.Copy("./DUMPDATA/botReqData.json", Path.Combine(_managedPath, "Dumper/DUMPDATA/botReqData.json"), true); + File.Copy("./DUMPDATA/config.json", Path.Combine(_managedPath, "Dumper/DUMPDATA/config.json"), true); + File.Copy("./DUMPDATA/raidSettings.json", Path.Combine(_managedPath, "Dumper/DUMPDATA/raidSettings.json"), true); + } + + public void ZipFiles() + { + if (File.Exists(Path.Combine(_managedPath, "DumperZip/Dumper.zip"))) + { + File.Delete(Path.Combine(_managedPath, "DumperZip/Dumper.zip")); + } + + ZipFile.CreateFromDirectory(Path.Combine(_managedPath, "Dumper"), Path.Combine(_managedPath, "DumperZip/Dumper.zip"), CompressionLevel.Optimal, false); } ///