AssemblyTool/RecodeItLib/CrossCompiler/ReCodeItCrossCompiler.cs

55 lines
2.0 KiB
C#
Raw Normal View History

2024-06-18 17:35:31 -04:00
using ReCodeIt.Models;
using ReCodeIt.ReMapper;
using ReCodeIt.Utils;
namespace ReCodeIt.CrossCompiler;
2024-06-18 17:35:31 -04:00
public class ReCodeItCrossCompiler
{
public ReCodeItCrossCompiler()
{
Remapper = new(this);
}
private ReCodeItRemapper Remapper { get; }
public CrossCompilerSettings Settings => DataProvider.Settings.CrossCompiler;
public CrossCompilerProjectModel ActiveProject => ProjectManager.ActiveProject;
2024-06-18 17:35:31 -04:00
/// <summary>
/// Key: Remapped name, value: old name
/// </summary>
public Dictionary<string, string> ChangedTypes { get; set; } = [];
public void StartRemap()
{
ChangedTypes.Clear();
Remapper.InitializeRemap(Settings.OriginalAssemblyPath, Settings.RemappedOutput, true);
if (ActiveProject == null)
2024-06-18 17:35:31 -04:00
{
Logger.Log("ERROR: No Cross Compiler Project is loaded, create or load one first.", ConsoleColor.Red);
return;
}
if (ActiveProject.ReCodeItProjectPath == string.Empty)
2024-06-18 17:35:31 -04:00
{
Logger.Log("ERROR: No ReCodeIt Project directory is set. (Project Creation Failed)", ConsoleColor.Red);
return;
}
Logger.Log("-----------------------------------------------", ConsoleColor.Yellow);
Logger.Log($"Cross patch remap result", ConsoleColor.Yellow);
Logger.Log($"Changed {ChangedTypes.Count} types", ConsoleColor.Yellow);
Logger.Log($"Original assembly path: {ActiveProject.OriginalAssemblyPath}", ConsoleColor.Yellow);
Logger.Log($"Original assembly hash: {ActiveProject.OriginalAssemblyHash}", ConsoleColor.Yellow);
Logger.Log($"Original patched assembly path: {ActiveProject.RemappedAssemblyPath}", ConsoleColor.Yellow);
Logger.Log($"Original patched assembly hash: {ActiveProject.RemappedAssemblyHash}", ConsoleColor.Yellow);
2024-06-18 17:35:31 -04:00
Logger.Log("-----------------------------------------------", ConsoleColor.Yellow);
}
public void StartCrossCompile()
{
//CopyVisualStudioProject();
}
}