Fix build issue

This commit is contained in:
Cj 2024-06-18 21:06:37 -04:00
parent 9eb3780eaa
commit a8f496d34e
6 changed files with 73 additions and 37 deletions

View File

@ -145,6 +145,7 @@ partial class ReCodeItForm
CCMappingTreeView = new TreeView(); CCMappingTreeView = new TreeView();
CrossPatchRunButton = new Button(); CrossPatchRunButton = new Button();
groupBox3 = new GroupBox(); groupBox3 = new GroupBox();
CCAutoLoadLastProj = new CheckBox();
CCLoadProjButton = new Button(); CCLoadProjButton = new Button();
CCRemappedOutputButton = new Button(); CCRemappedOutputButton = new Button();
CCRemappedOutputText = new TextBox(); CCRemappedOutputText = new TextBox();
@ -160,7 +161,6 @@ partial class ReCodeItForm
groupBox2 = new GroupBox(); groupBox2 = new GroupBox();
SilentModeCheckbox = new CheckBox(); SilentModeCheckbox = new CheckBox();
DebugLoggingCheckbox = new CheckBox(); DebugLoggingCheckbox = new CheckBox();
CCAutoLoadLastProj = new CheckBox();
TabPageRemapper.SuspendLayout(); TabPageRemapper.SuspendLayout();
groupBox1.SuspendLayout(); groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)ConstuctorCountUpDown).BeginInit(); ((System.ComponentModel.ISupportInitialize)ConstuctorCountUpDown).BeginInit();
@ -262,6 +262,7 @@ partial class ReCodeItForm
ActiveProjectMappingsCheckbox.TabIndex = 39; ActiveProjectMappingsCheckbox.TabIndex = 39;
ActiveProjectMappingsCheckbox.Text = "Use Active Project Mappings"; ActiveProjectMappingsCheckbox.Text = "Use Active Project Mappings";
ActiveProjectMappingsCheckbox.UseVisualStyleBackColor = true; ActiveProjectMappingsCheckbox.UseVisualStyleBackColor = true;
ActiveProjectMappingsCheckbox.CheckedChanged += ActiveProjectMappingsCheckbox_CheckedChanged;
// //
// LoadedMappingFilePath // LoadedMappingFilePath
// //
@ -1481,6 +1482,19 @@ partial class ReCodeItForm
groupBox3.TabStop = false; groupBox3.TabStop = false;
groupBox3.Text = "ReCodeIt Proj Settings"; groupBox3.Text = "ReCodeIt Proj Settings";
// //
// CCAutoLoadLastProj
//
CCAutoLoadLastProj.AutoSize = true;
CCAutoLoadLastProj.Checked = true;
CCAutoLoadLastProj.CheckState = CheckState.Checked;
CCAutoLoadLastProj.Location = new Point(6, 247);
CCAutoLoadLastProj.Name = "CCAutoLoadLastProj";
CCAutoLoadLastProj.Size = new Size(259, 29);
CCAutoLoadLastProj.TabIndex = 34;
CCAutoLoadLastProj.Text = "Auto load last active project";
CCAutoLoadLastProj.UseVisualStyleBackColor = true;
CCAutoLoadLastProj.CheckedChanged += CCAutoLoadLastProj_CheckedChanged_1;
//
// CCLoadProjButton // CCLoadProjButton
// //
CCLoadProjButton.Location = new Point(475, 247); CCLoadProjButton.Location = new Point(475, 247);
@ -1632,16 +1646,6 @@ partial class ReCodeItForm
DebugLoggingCheckbox.UseVisualStyleBackColor = true; DebugLoggingCheckbox.UseVisualStyleBackColor = true;
DebugLoggingCheckbox.CheckedChanged += DebugLoggingCheckbox_CheckedChanged; DebugLoggingCheckbox.CheckedChanged += DebugLoggingCheckbox_CheckedChanged;
// //
// CCAutoLoadLastProj
//
CCAutoLoadLastProj.AutoSize = true;
CCAutoLoadLastProj.Location = new Point(6, 247);
CCAutoLoadLastProj.Name = "CCAutoLoadLastProj";
CCAutoLoadLastProj.Size = new Size(259, 29);
CCAutoLoadLastProj.TabIndex = 34;
CCAutoLoadLastProj.Text = "Auto load last active project";
CCAutoLoadLastProj.UseVisualStyleBackColor = true;
//
// ReCodeItForm // ReCodeItForm
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(10F, 25F);

View File

@ -28,13 +28,15 @@ public partial class ReCodeItForm : Form
DataProvider.LoadMappingFile(DataProvider.Settings.Remapper.MappingPath); DataProvider.LoadMappingFile(DataProvider.Settings.Remapper.MappingPath);
LoadedMappingFilePath.Text = DataProvider.Settings.Remapper.MappingPath; LoadedMappingFilePath.Text = DataProvider.Settings.Remapper.MappingPath;
PopulateDomainUpDowns(); PopulateDomainUpDowns();
RefreshSettingsPage(); RefreshSettingsPage();
RefreshAutoMapperPage(); RefreshAutoMapperPage();
RefreshCrossPatchPage(); RefreshCrossCompilerPage();
RemapTreeView.NodeMouseDoubleClick += EditSelectedRemap;
RemapTreeView.NodeMouseDoubleClick += EditSelectedRemap;
Remapper.OnComplete += ReloadTreeView; Remapper.OnComplete += ReloadTreeView;
ReloadTreeView(this, EventArgs.Empty); ReloadTreeView(this, EventArgs.Empty);
} }
@ -641,8 +643,29 @@ public partial class ReCodeItForm : Form
#region CROSS_COMPILER #region CROSS_COMPILER
private void RefreshCrossPatchPage() private void RefreshCrossCompilerPage()
{ {
var ccSettings = DataProvider.Settings.CrossCompiler;
CCAutoLoadLastProj.Checked = ccSettings.AutoLoadLastActiveProject;
if (ccSettings.AutoLoadLastActiveProject)
{
// Dont continue if its an empty string, it hasnt been set yet
if (ccSettings.LastLoadedProject == string.Empty)
{
return;
}
if (!File.Exists(ccSettings.LastLoadedProject))
{
MessageBox.Show("Couldnt find last loaded project");
return;
}
ProjectManager.LoadProject(ccSettings.LastLoadedProject);
}
if (CrossCompiler.ActiveProject == null) if (CrossCompiler.ActiveProject == null)
{ {
return; return;
@ -663,7 +686,6 @@ public partial class ReCodeItForm : Form
if (result != string.Empty) if (result != string.Empty)
{ {
DataProvider.Settings.CrossCompiler.OriginalAssemblyPath = result;
CCOriginalAssemblyText.Text = result; CCOriginalAssemblyText.Text = result;
DataProvider.SaveAppSettings(); DataProvider.SaveAppSettings();
} }
@ -675,7 +697,6 @@ public partial class ReCodeItForm : Form
if (result != string.Empty) if (result != string.Empty)
{ {
DataProvider.Settings.CrossCompiler.RemappedOutput = result;
CCRemappedOutputText.Text = result; CCRemappedOutputText.Text = result;
DataProvider.SaveAppSettings(); DataProvider.SaveAppSettings();
} }
@ -687,7 +708,6 @@ public partial class ReCodeItForm : Form
if (result != string.Empty) if (result != string.Empty)
{ {
DataProvider.Settings.CrossCompiler.VisualStudioSolutionPath = result;
CCVisualStudioProjDirText.Text = result; CCVisualStudioProjDirText.Text = result;
DataProvider.SaveAppSettings(); DataProvider.SaveAppSettings();
} }
@ -699,7 +719,6 @@ public partial class ReCodeItForm : Form
if (result != string.Empty) if (result != string.Empty)
{ {
DataProvider.Settings.CrossCompiler.BuildPath = result;
CCBuildDirText.Text = result; CCBuildDirText.Text = result;
DataProvider.SaveAppSettings(); DataProvider.SaveAppSettings();
} }
@ -745,6 +764,18 @@ public partial class ReCodeItForm : Form
} }
} }
private void CCAutoLoadLastProj_CheckedChanged_1(object sender, EventArgs e)
{
DataProvider.Settings.CrossCompiler.AutoLoadLastActiveProject = CCAutoLoadLastProj.Checked;
DataProvider.SaveAppSettings();
}
// Use the projects remap list on the remap tab
private void ActiveProjectMappingsCheckbox_CheckedChanged(object sender, EventArgs e)
{
// TODO
}
#endregion CROSS_COMPILER #endregion CROSS_COMPILER
// Reset All UI elements to default // Reset All UI elements to default
@ -904,7 +935,7 @@ public partial class ReCodeItForm : Form
private void tabPage5_Click(object sender, EventArgs e) private void tabPage5_Click(object sender, EventArgs e)
{ {
RefreshCrossPatchPage(); RefreshCrossCompilerPage();
} }
private void SettingsTab_Click(object sender, EventArgs e) private void SettingsTab_Click(object sender, EventArgs e)

View File

@ -6,21 +6,9 @@ namespace ReCodeIt.CrossCompiler;
public static class ProjectManager public static class ProjectManager
{ {
/// <summary>
/// Key: Path of the project, Value: Project file
/// </summary>
public static Dictionary<string, CrossCompilerProjectModel> Projects { get; private set; } = [];
public static CrossCompilerProjectModel ActiveProject { get; private set; } public static CrossCompilerProjectModel ActiveProject { get; private set; }
private static CrossCompilerSettings Settings => DataProvider.Settings.CrossCompiler; private static CrossCompilerSettings Settings => DataProvider.Settings.CrossCompiler;
private static HashSet<string> CopyIgnoreDirectories { get; } =
[
".vs",
".git"
];
public static void CreateProject( public static void CreateProject(
string OrigAssemblyPath, string OrigAssemblyPath,
string RemappedAssemblyOutputPath, string RemappedAssemblyOutputPath,
@ -55,7 +43,7 @@ public static class ProjectManager
Logger.Log($"Found Solution: {ActiveProject.SolutionName}", ConsoleColor.Yellow); Logger.Log($"Found Solution: {ActiveProject.SolutionName}", ConsoleColor.Yellow);
Logger.Log($"Original Assembly Checksum: {ActiveProject.OriginalAssemblyHash}", ConsoleColor.Yellow); Logger.Log($"Original Assembly Checksum: {ActiveProject.OriginalAssemblyHash}", ConsoleColor.Yellow);
Logger.Log($"Project Generated to: {DataProvider.Settings.CrossCompiler.LastActiveProjectPath}", ConsoleColor.Green); Logger.Log($"Project Generated to: {DataProvider.Settings.CrossCompiler.LastLoadedProject}", ConsoleColor.Green);
Logger.Log("-----------------------------------------------", ConsoleColor.Yellow); Logger.Log("-----------------------------------------------", ConsoleColor.Yellow);
} }
@ -119,9 +107,16 @@ public static class ProjectManager
file.CopyTo(tempPath, true); file.CopyTo(tempPath, true);
} }
// We dont want git and vs directories they are often locked leading to problems
List<string> copyIgnoreDirectories =
[
".vs",
".git"
];
foreach (DirectoryInfo subdir in dirs) foreach (DirectoryInfo subdir in dirs)
{ {
if (CopyIgnoreDirectories.Contains(subdir.Name)) { continue; } if (copyIgnoreDirectories.Contains(subdir.Name)) { continue; }
string tempPath = Path.Combine(destinationDirPath, subdir.Name); string tempPath = Path.Combine(destinationDirPath, subdir.Name);
CopyProjectRecursive(subdir.FullName, tempPath); CopyProjectRecursive(subdir.FullName, tempPath);
@ -141,7 +136,7 @@ public static class ProjectManager
File.WriteAllText(path, jsonText); File.WriteAllText(path, jsonText);
DataProvider.Settings.CrossCompiler.LastActiveProjectPath = path; DataProvider.Settings.CrossCompiler.LastLoadedProject = path;
DataProvider.SaveAppSettings(); DataProvider.SaveAppSettings();
Logger.Log($"Cross Compiler project json generated to {path}", ConsoleColor.Green); Logger.Log($"Cross Compiler project json generated to {path}", ConsoleColor.Green);
@ -158,7 +153,7 @@ public static class ProjectManager
var model = JsonConvert.DeserializeObject<CrossCompilerProjectModel>(jsonText); var model = JsonConvert.DeserializeObject<CrossCompilerProjectModel>(jsonText);
DataProvider.Settings.CrossCompiler.LastActiveProjectPath = path; DataProvider.Settings.CrossCompiler.LastLoadedProject = path;
DataProvider.SaveAppSettings(); DataProvider.SaveAppSettings();
Logger.Log($"Loaded Cross Compiler Project: {model?.RemappedAssemblyPath}"); Logger.Log($"Loaded Cross Compiler Project: {model?.RemappedAssemblyPath}");

View File

@ -24,7 +24,7 @@ public class ReCodeItCrossCompiler
public void StartRemap() public void StartRemap()
{ {
ChangedTypes.Clear(); ChangedTypes.Clear();
Remapper.InitializeRemap(Settings.OriginalAssemblyPath, Settings.RemappedOutput, true); Remapper.InitializeRemap(ActiveProject.OriginalAssemblyPath, ActiveProject.RemappedAssemblyPath, true);
if (ActiveProject == null) if (ActiveProject == null)
{ {

View File

@ -107,7 +107,12 @@ public class CrossCompilerSettings
/// <summary> /// <summary>
/// Last Loaded Project Path /// Last Loaded Project Path
/// </summary> /// </summary>
public string LastActiveProjectPath { get; set; } public string LastLoadedProject { get; set; }
/// <summary>
/// Should the last active project be auto loaded
/// </summary>
public bool AutoLoadLastActiveProject { get; set; }
} }
/// <summary> /// <summary>

View File

@ -66,6 +66,7 @@
] ]
}, },
"CrossCompiler": { "CrossCompiler": {
"AutoLoadLastActiveProject": true, // Autoload last active project
"LastLoadedProject": "" // Last loaded project path "LastLoadedProject": "" // Last loaded project path
} }
} }