Merge branch 'master' of https://dev.sp-tarkov.com/SPT/AssemblyTool into Dump-DnLib-Conversion

This commit is contained in:
CWX 2024-08-10 13:38:16 +01:00
commit 7c0575d423

View File

@ -28,10 +28,6 @@ public class ReCodeItRemapper
private string OutPath { get; set; } = string.Empty; private string OutPath { get; set; } = string.Empty;
private bool CrossMapMode { get; set; } = false;
private string AssemblyPath { get; set; }
private List<RemapModel> _remaps = []; private List<RemapModel> _remaps = [];
private List<string> _alreadyGivenNames = []; private List<string> _alreadyGivenNames = [];
@ -43,16 +39,12 @@ public class ReCodeItRemapper
List<RemapModel> remapModels, List<RemapModel> remapModels,
string assemblyPath, string assemblyPath,
string outPath, string outPath,
bool crossMapMode = false,
bool validate = false) bool validate = false)
{ {
_remaps = []; _remaps = [];
_remaps = remapModels; _remaps = remapModels;
Module = DataProvider.LoadModule(assemblyPath); Module = DataProvider.LoadModule(assemblyPath);
AssemblyPath = assemblyPath;
CrossMapMode = crossMapMode;
OutPath = outPath; OutPath = outPath;
if (!Validate(_remaps)) return; if (!Validate(_remaps)) return;
@ -458,11 +450,7 @@ public class ReCodeItRemapper
{ {
var moduleName = Module.Name; var moduleName = Module.Name;
moduleName = CrossMapMode OutPath = Path.Combine(OutPath, moduleName.Replace(".dll", "-Remapped.dll"));
? moduleName
: moduleName.Replace(".dll", "-Remapped.dll");
OutPath = Path.Combine(OutPath, moduleName);
try try
{ {
@ -474,17 +462,23 @@ public class ReCodeItRemapper
throw; throw;
} }
if (!CrossMapMode)
{
Logger.Log("Creating Hollow...", ConsoleColor.Yellow); Logger.Log("Creating Hollow...", ConsoleColor.Yellow);
Hollow(); Hollow();
var hollowedDir = Path.GetDirectoryName(OutPath); var hollowedDir = Path.GetDirectoryName(OutPath);
var hollowedPath = Path.Combine(hollowedDir, "Hollowed.dll"); var hollowedPath = Path.Combine(hollowedDir, "Hollowed.dll");
try
{
Module.Write(hollowedPath); Module.Write(hollowedPath);
}
catch (Exception e)
{
Logger.Log(e);
throw;
}
DisplayEndBanner(hollowedPath); DisplayEndBanner(hollowedPath);
}
if (DataProvider.Settings.Remapper.MappingPath != string.Empty) if (DataProvider.Settings.Remapper.MappingPath != string.Empty)
{ {