mirror of
https://github.com/sp-tarkov/assembly-tool.git
synced 2025-02-13 09:50:44 -05:00
Fix some compiler warnings
This commit is contained in:
parent
65041c3e3b
commit
1505b01bba
@ -10,7 +10,7 @@ namespace ReCodeItCLI.Commands;
|
|||||||
public class DeObfuscate : ICommand
|
public class DeObfuscate : ICommand
|
||||||
{
|
{
|
||||||
[CommandParameter(0, IsRequired = true, Description = "The absolute path to your obfuscated assembly or exe file, folder must contain all references to be resolved.")]
|
[CommandParameter(0, IsRequired = true, Description = "The absolute path to your obfuscated assembly or exe file, folder must contain all references to be resolved.")]
|
||||||
public string AssemblyPath { get; init; }
|
public required string AssemblyPath { get; init; }
|
||||||
|
|
||||||
[CommandParameter(1, IsRequired = false, Description = "Is the target the EFT launcher?")]
|
[CommandParameter(1, IsRequired = false, Description = "Is the target the EFT launcher?")]
|
||||||
public bool IsLauncher { get; init; } = false;
|
public bool IsLauncher { get; init; } = false;
|
||||||
|
@ -10,7 +10,7 @@ namespace ReCodeItCLI.Commands;
|
|||||||
public class Dumper : ICommand
|
public class Dumper : ICommand
|
||||||
{
|
{
|
||||||
[CommandParameter(0, IsRequired = true, Description = "The absolute path to your Managed folder for EFT, folder must contain all references to be resolved. Assembly-CSharp-cleaned.dll, mscorlib.dll, FilesChecker.dll")]
|
[CommandParameter(0, IsRequired = true, Description = "The absolute path to your Managed folder for EFT, folder must contain all references to be resolved. Assembly-CSharp-cleaned.dll, mscorlib.dll, FilesChecker.dll")]
|
||||||
public string ManagedDirectory { get; init; }
|
public required string ManagedDirectory { get; init; }
|
||||||
|
|
||||||
public ValueTask ExecuteAsync(IConsole console)
|
public ValueTask ExecuteAsync(IConsole console)
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ namespace ReCodeItCLI.Commands;
|
|||||||
public class GenRefList : ICommand
|
public class GenRefList : ICommand
|
||||||
{
|
{
|
||||||
[CommandParameter(0, IsRequired = true, Description = "The absolute path to your de-obfuscated and remapped dll.")]
|
[CommandParameter(0, IsRequired = true, Description = "The absolute path to your de-obfuscated and remapped dll.")]
|
||||||
public string AssemblyPath { get; init; }
|
public required string AssemblyPath { get; init; }
|
||||||
|
|
||||||
private static readonly List<string> Match = new()
|
private static readonly List<string> Match = new()
|
||||||
{
|
{
|
||||||
@ -28,23 +28,22 @@ public class GenRefList : ICommand
|
|||||||
// Sort and display the top 10 most referenced types
|
// Sort and display the top 10 most referenced types
|
||||||
foreach (var pair in references.OrderByDescending(p => p.Value).Take(100))
|
foreach (var pair in references.OrderByDescending(p => p.Value).Take(100))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"{pair.Key}: {pair.Value}");
|
console.Output.WriteLine($"{pair.Key}: {pair.Value}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return default;
|
return default;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Dictionary<string, int> CountTypeReferences(string assemblyPath)
|
private static Dictionary<string, int> CountTypeReferences(string assemblyPath)
|
||||||
{
|
{
|
||||||
var typeReferenceCounts = new Dictionary<string, int>();
|
var typeReferenceCounts = new Dictionary<string, int>();
|
||||||
|
|
||||||
using (var module = ModuleDefMD.Load(assemblyPath))
|
using var module = ModuleDefMD.Load(assemblyPath);
|
||||||
{
|
|
||||||
foreach (var type in module.GetTypes())
|
foreach (var type in module.GetTypes())
|
||||||
{
|
{
|
||||||
CountReferencesInType(type, typeReferenceCounts);
|
CountReferencesInType(type, typeReferenceCounts);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return typeReferenceCounts;
|
return typeReferenceCounts;
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,10 @@ public class ReMap : ICommand
|
|||||||
private ReCodeItRemapper _remapper { get; set; } = new();
|
private ReCodeItRemapper _remapper { get; set; } = new();
|
||||||
|
|
||||||
[CommandParameter(0, IsRequired = true, Description = "The absolute path to your mapping.json file, supports .json and .jsonc")]
|
[CommandParameter(0, IsRequired = true, Description = "The absolute path to your mapping.json file, supports .json and .jsonc")]
|
||||||
public string MappingJsonPath { get; init; }
|
public required string MappingJsonPath { get; init; }
|
||||||
|
|
||||||
[CommandParameter(1, IsRequired = true, Description = "The absolute path to your de-obfuscated dll, containing all references that it needs to resolve.")]
|
[CommandParameter(1, IsRequired = true, Description = "The absolute path to your de-obfuscated dll, containing all references that it needs to resolve.")]
|
||||||
public string AssemblyPath { get; init; }
|
public required string AssemblyPath { get; init; }
|
||||||
|
|
||||||
[CommandParameter(2, IsRequired = true, Description = "If true, the re-mapper will publicize all types, methods, and properties")]
|
[CommandParameter(2, IsRequired = true, Description = "If true, the re-mapper will publicize all types, methods, and properties")]
|
||||||
public bool Publicize { get; init; }
|
public bool Publicize { get; init; }
|
||||||
@ -37,7 +37,14 @@ public class ReMap : ICommand
|
|||||||
|
|
||||||
var remaps = DataProvider.LoadMappingFile(MappingJsonPath);
|
var remaps = DataProvider.LoadMappingFile(MappingJsonPath);
|
||||||
|
|
||||||
_remapper.InitializeRemap(remaps, AssemblyPath, Path.GetDirectoryName(AssemblyPath));
|
var outPath = Path.GetDirectoryName(AssemblyPath);
|
||||||
|
|
||||||
|
if (outPath is null)
|
||||||
|
{
|
||||||
|
throw new DirectoryNotFoundException("OutPath could not be resolved.");
|
||||||
|
}
|
||||||
|
|
||||||
|
_remapper.InitializeRemap(remaps, AssemblyPath, outPath);
|
||||||
|
|
||||||
// Wait for log termination
|
// Wait for log termination
|
||||||
Logger.Terminate();
|
Logger.Terminate();
|
||||||
|
@ -26,11 +26,11 @@
|
|||||||
<Output TaskParameter="OutputItems" ItemName="OutputPath" />
|
<Output TaskParameter="OutputItems" ItemName="OutputPath" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
<Target Name="PreBuild" BeforeTargets="PreBuildEvent" Condition="'$(Configuration)' == '$(Configuration)'">
|
||||||
<RemoveDir Directories="$(SolutionDir)Build\**\*.*" />
|
<RemoveDir Directories="$(SolutionDir)Build\**\*.*" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == '$(Configuration)'">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<de4dot Include="$(SolutionDir)de4dot\$(Configuration)\net48\*.*" />
|
<de4dot Include="$(SolutionDir)de4dot\$(Configuration)\net48\*.*" />
|
||||||
<templates Include="$(SolutionDir)Assets\Templates\**\*.*" />
|
<templates Include="$(SolutionDir)Assets\Templates\**\*.*" />
|
||||||
|
@ -60,6 +60,7 @@ public static class Deobfuscator
|
|||||||
: $"--un-name \"!^<>[a-z0-9]$&!^<>[a-z0-9]__.*$&![A-Z][A-Z]\\$<>.*$&^[a-zA-Z_<{{$][a-zA-Z_0-9<>{{}}$.`-]*$\" \"{assemblyPath}\" --strtyp delegate --strtok \"{token}\"";
|
: $"--un-name \"!^<>[a-z0-9]$&!^<>[a-z0-9]__.*$&![A-Z][A-Z]\\$<>.*$&^[a-zA-Z_<{{$][a-zA-Z_0-9<>{{}}$.`-]*$\" \"{assemblyPath}\" --strtyp delegate --strtok \"{token}\"";
|
||||||
|
|
||||||
var executablePath = Path.Combine(AppContext.BaseDirectory, "de4dot", "de4dot-x64.exe");
|
var executablePath = Path.Combine(AppContext.BaseDirectory, "de4dot", "de4dot-x64.exe");
|
||||||
|
var two = 2;
|
||||||
|
|
||||||
var process = Process.Start(executablePath, cmd);
|
var process = Process.Start(executablePath, cmd);
|
||||||
process.WaitForExit();
|
process.WaitForExit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user