From ce443442471e00384e349ea56ea823641b436c26 Mon Sep 17 00:00:00 2001
From: Cj <161484149+CJ-SPT@users.noreply.github.com>
Date: Fri, 14 Jun 2024 18:07:01 -0400
Subject: [PATCH] More gui work, add console project
---
.../{LibRemap.csproj => MapLib.csproj} | 4 +
AssemblyRemapper/Models/AppSettingsModel.cs | 21 +-
AssemblyRemapper/Remapper/Remapper.cs | 10 +-
AssemblyRemapper/Utils/DataProvider.cs | 40 +-
AssemblyRemapperGUI/Form1.Designer.cs | 294 +++++++++
AssemblyRemapperGUI/Form1.cs | 559 +++++++++---------
AssemblyRemapperGUI/Form1.resx | 6 +
AssemblyRemapperGUI/RemapperGUI.csproj | 2 +-
AssemblyRemapperGUI/SettingsController.cs | 113 ++++
Assembly_Tool.sln | 10 +-
.../Commands/CommandProcessor.cs | 0
RemapperConsole/Program.cs | 2 +
RemapperConsole/RemapperConsole.csproj | 14 +
Templates/Settings.jsonc | 18 +-
14 files changed, 766 insertions(+), 327 deletions(-)
rename AssemblyRemapper/{LibRemap.csproj => MapLib.csproj} (87%)
create mode 100644 AssemblyRemapperGUI/SettingsController.cs
rename {AssemblyRemapper => RemapperConsole}/Commands/CommandProcessor.cs (100%)
create mode 100644 RemapperConsole/Program.cs
create mode 100644 RemapperConsole/RemapperConsole.csproj
diff --git a/AssemblyRemapper/LibRemap.csproj b/AssemblyRemapper/MapLib.csproj
similarity index 87%
rename from AssemblyRemapper/LibRemap.csproj
rename to AssemblyRemapper/MapLib.csproj
index de044f1..399d830 100644
--- a/AssemblyRemapper/LibRemap.csproj
+++ b/AssemblyRemapper/MapLib.csproj
@@ -12,4 +12,8 @@
+
+
+
+
diff --git a/AssemblyRemapper/Models/AppSettingsModel.cs b/AssemblyRemapper/Models/AppSettingsModel.cs
index 85236ff..16ee4bd 100644
--- a/AssemblyRemapper/Models/AppSettingsModel.cs
+++ b/AssemblyRemapper/Models/AppSettingsModel.cs
@@ -15,26 +15,25 @@ public class AppSettings
{
public bool Debug { get; set; } = false;
public bool SilentMode { get; set; } = true;
- public bool MatchMode { get; set; } = false;
+ public string AssemblyPath { get; set; } = string.Empty;
+ public string OutputPath { get; set; } = string.Empty;
+ public string MappingPath { get; set; } = string.Empty;
+
+ public bool RenameFields { get; set; } = true;
+ public bool RenameProperties { get; set; } = true;
+
+ public bool Publicize { get; set; } = false;
+ public bool Unseal { get; set; } = false;
}
public class RemapperSettings
{
public int MaxMatchCount { get; set; } = 5;
-
- public bool Publicize { get; set; } = false;
- public bool Unseal { get; set; } = false;
-
- public string AssemblyPath { get; set; } = string.Empty;
- public string OutputPath { get; set; } = string.Empty;
- public string MappingPath { get; set; } = string.Empty;
}
public class AutoMapperSettings
{
public int RequiredMatches { get; set; } = 5;
- public bool MatchMode { get; set; } = true;
- public bool Publicize { get; set; } = false;
- public bool Unseal { get; set; } = false;
+
public List NamesToIgnore { get; set; } = [];
}
\ No newline at end of file
diff --git a/AssemblyRemapper/Remapper/Remapper.cs b/AssemblyRemapper/Remapper/Remapper.cs
index b3e588c..a5d39ec 100644
--- a/AssemblyRemapper/Remapper/Remapper.cs
+++ b/AssemblyRemapper/Remapper/Remapper.cs
@@ -36,12 +36,6 @@ public class Remapper
ChooseBestMatches();
- if (DataProvider.Settings.AppSettings.MatchMode)
- {
- IsRunning = false;
- return;
- }
-
// Dont publicize and unseal until after the remapping so we can use those as search parameters
if (!DataProvider.Settings.Remapper.Publicize)
{
@@ -229,8 +223,6 @@ public class Remapper
}
}
- if (DataProvider.Settings.AppSettings.MatchMode) { return; }
-
highestScore.ReMap.OriginalTypeName = highestScore.Definition.Name;
// Rename type and all associated type members
@@ -244,7 +236,7 @@ public class Remapper
///
private void WriteAssembly()
{
- var filename = Path.GetFileNameWithoutExtension(DataProvider.Settings.Remapper.AssemblyPath);
+ var filename = Path.GetFileNameWithoutExtension(DataProvider.Settings.AppSettings.AssemblyPath);
var strippedPath = Path.GetDirectoryName(filename);
filename = $"{filename}-Remapped.dll";
diff --git a/AssemblyRemapper/Utils/DataProvider.cs b/AssemblyRemapper/Utils/DataProvider.cs
index 6d47a3a..2b2bfaa 100644
--- a/AssemblyRemapper/Utils/DataProvider.cs
+++ b/AssemblyRemapper/Utils/DataProvider.cs
@@ -26,7 +26,7 @@ public static class DataProvider
if (!File.Exists(settingsPath))
{
- throw new InvalidOperationException($"path `{settingsPath}` does not exist...");
+ throw new FileNotFoundException($"path `{settingsPath}` does not exist...");
}
var jsonText = File.ReadAllText(settingsPath);
@@ -41,15 +41,29 @@ public static class DataProvider
Logger.Log($"Settings loaded from '{settingsPath}'");
}
+ public static void SaveAppSettings()
+ {
+ var settingsPath = Path.Combine(AppContext.BaseDirectory, "Data", "Settings.jsonc");
+
+ if (!File.Exists(settingsPath))
+ {
+ throw new FileNotFoundException($"path `{settingsPath}` does not exist...");
+ }
+
+ var jsonText = JsonConvert.SerializeObject(Settings);
+
+ File.WriteAllText(settingsPath, jsonText);
+ }
+
public static void LoadMappingFile(string path = "")
{
- if (!File.Exists(Settings.Remapper.MappingPath))
+ if (!File.Exists(Settings.AppSettings.MappingPath))
{
- throw new InvalidOperationException($"path `{Settings.Remapper.MappingPath}` does not exist...");
+ throw new InvalidOperationException($"path `{Settings.AppSettings.MappingPath}` does not exist...");
}
var fpath = path == string.Empty
- ? Settings.Remapper.MappingPath
+ ? Settings.AppSettings.MappingPath
: path;
var jsonText = File.ReadAllText(fpath);
@@ -72,7 +86,7 @@ public static class DataProvider
}
}
- Logger.Log($"Mapping file loaded from '{Settings.Remapper.MappingPath}'");
+ Logger.Log($"Mapping file loaded from '{Settings.AppSettings.MappingPath}'");
}
public static void SaveMapping()
@@ -85,14 +99,14 @@ public static class DataProvider
var jsonText = JsonConvert.SerializeObject(Remaps, settings);
- File.WriteAllText(Settings.Remapper.MappingPath, jsonText);
+ File.WriteAllText(Settings.AppSettings.MappingPath, jsonText);
}
public static void UpdateMapping()
{
- if (!File.Exists(Settings.Remapper.MappingPath))
+ if (!File.Exists(Settings.AppSettings.MappingPath))
{
- throw new FileNotFoundException($"path `{Settings.Remapper.MappingPath}` does not exist...");
+ throw new FileNotFoundException($"path `{Settings.AppSettings.MappingPath}` does not exist...");
}
JsonSerializerSettings settings = new()
@@ -120,9 +134,9 @@ public static class DataProvider
var jsonText = JsonConvert.SerializeObject(Remaps, settings);
- File.WriteAllText(Settings.Remapper.MappingPath, jsonText);
+ File.WriteAllText(Settings.AppSettings.MappingPath, jsonText);
- Logger.Log($"Mapping file saved to {Settings.Remapper.MappingPath}");
+ Logger.Log($"Mapping file saved to {Settings.AppSettings.MappingPath}");
}
public static void LoadAssemblyDefinition()
@@ -131,17 +145,17 @@ public static class DataProvider
ModuleDefinition = null;
DefaultAssemblyResolver resolver = new();
- resolver.AddSearchDirectory(Path.GetDirectoryName(Settings.Remapper.AssemblyPath)); // Replace with the correct path : (6/14) I have no idea what I met by that
+ resolver.AddSearchDirectory(Path.GetDirectoryName(Settings.AppSettings.AssemblyPath)); // Replace with the correct path : (6/14) I have no idea what I met by that
ReaderParameters parameters = new() { AssemblyResolver = resolver };
- AssemblyDefinition = AssemblyDefinition.ReadAssembly(Settings.Remapper.AssemblyPath, parameters);
+ AssemblyDefinition = AssemblyDefinition.ReadAssembly(Settings.AppSettings.AssemblyPath, parameters);
if (AssemblyDefinition is null)
{
throw new NullReferenceException("AssemblyDefinition was null...");
}
- var fileName = Path.GetFileName(Settings.Remapper.AssemblyPath);
+ var fileName = Path.GetFileName(Settings.AppSettings.AssemblyPath);
foreach (var module in AssemblyDefinition.Modules.ToArray())
{
diff --git a/AssemblyRemapperGUI/Form1.Designer.cs b/AssemblyRemapperGUI/Form1.Designer.cs
index 925178a..8bf9908 100644
--- a/AssemblyRemapperGUI/Form1.Designer.cs
+++ b/AssemblyRemapperGUI/Form1.Designer.cs
@@ -101,7 +101,29 @@ partial class AssemblyToolGUI
MethodCountEnabled = new CheckBox();
IsSealedUpDown = new DomainUpDown();
TabControlMain = new TabControl();
+ tabPage5 = new TabPage();
+ groupBox3 = new GroupBox();
+ label1 = new Label();
+ MaxMatchCountUpDown = new NumericUpDown();
+ groupBox4 = new GroupBox();
+ label2 = new Label();
+ AutoMapperRequiredMatchesUpDown = new NumericUpDown();
+ groupBox2 = new GroupBox();
+ MappingChooseButton = new Button();
+ UnsealCheckbox = new CheckBox();
+ RenamePropertiesCheckbox = new CheckBox();
+ PublicizeCheckbox = new CheckBox();
+ OutputDirectoryButton = new Button();
+ RenameFieldsCheckbox = new CheckBox();
+ PickAssemblyPathButton = new Button();
+ MappingPathTextBox = new TextBox();
+ OutputPathTextBox = new TextBox();
+ AssemblyPathTextBox = new TextBox();
+ SilentModeCheckbox = new CheckBox();
+ DebugLoggingCheckbox = new CheckBox();
colorDialog1 = new ColorDialog();
+ openFileDialog1 = new OpenFileDialog();
+ fileSystemWatcher1 = new FileSystemWatcher();
((System.ComponentModel.ISupportInitialize)bindingSource1).BeginInit();
TabPageRemapper.SuspendLayout();
groupBox1.SuspendLayout();
@@ -116,6 +138,13 @@ partial class AssemblyToolGUI
((System.ComponentModel.ISupportInitialize)MethodCountUpDown).BeginInit();
((System.ComponentModel.ISupportInitialize)NestedTypeCountUpDown).BeginInit();
TabControlMain.SuspendLayout();
+ tabPage5.SuspendLayout();
+ groupBox3.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)MaxMatchCountUpDown).BeginInit();
+ groupBox4.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)AutoMapperRequiredMatchesUpDown).BeginInit();
+ groupBox2.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)fileSystemWatcher1).BeginInit();
SuspendLayout();
//
// TabPageRemapper
@@ -827,12 +856,245 @@ partial class AssemblyToolGUI
// TabControlMain
//
TabControlMain.Controls.Add(TabPageRemapper);
+ TabControlMain.Controls.Add(tabPage5);
TabControlMain.Location = new Point(-5, 1);
TabControlMain.Name = "TabControlMain";
TabControlMain.SelectedIndex = 0;
TabControlMain.Size = new Size(1344, 991);
TabControlMain.TabIndex = 6;
//
+ // tabPage5
+ //
+ tabPage5.BackColor = SystemColors.ControlDarkDark;
+ tabPage5.Controls.Add(groupBox3);
+ tabPage5.Controls.Add(groupBox4);
+ tabPage5.Controls.Add(groupBox2);
+ tabPage5.Location = new Point(4, 34);
+ tabPage5.Name = "tabPage5";
+ tabPage5.Padding = new Padding(3);
+ tabPage5.Size = new Size(1336, 953);
+ tabPage5.TabIndex = 2;
+ tabPage5.Text = "Settings";
+ //
+ // groupBox3
+ //
+ groupBox3.Controls.Add(label1);
+ groupBox3.Controls.Add(MaxMatchCountUpDown);
+ groupBox3.Location = new Point(464, 6);
+ groupBox3.Name = "groupBox3";
+ groupBox3.Size = new Size(259, 285);
+ groupBox3.TabIndex = 1;
+ groupBox3.TabStop = false;
+ groupBox3.Text = "Remapper Settings";
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Location = new Point(69, 37);
+ label1.Name = "label1";
+ label1.Size = new Size(152, 25);
+ label1.TabIndex = 5;
+ label1.Text = "Max Match Count";
+ //
+ // MaxMatchCountUpDown
+ //
+ MaxMatchCountUpDown.Location = new Point(6, 35);
+ MaxMatchCountUpDown.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
+ MaxMatchCountUpDown.Name = "MaxMatchCountUpDown";
+ MaxMatchCountUpDown.Size = new Size(57, 31);
+ MaxMatchCountUpDown.TabIndex = 0;
+ MaxMatchCountUpDown.Value = new decimal(new int[] { 1, 0, 0, 0 });
+ MaxMatchCountUpDown.ValueChanged += MaxMatchCountUpDown_ValueChanged;
+ //
+ // groupBox4
+ //
+ groupBox4.Controls.Add(label2);
+ groupBox4.Controls.Add(AutoMapperRequiredMatchesUpDown);
+ groupBox4.Location = new Point(729, 6);
+ groupBox4.Name = "groupBox4";
+ groupBox4.Size = new Size(557, 285);
+ groupBox4.TabIndex = 1;
+ groupBox4.TabStop = false;
+ groupBox4.Text = "Auto Mapper Settings";
+ //
+ // label2
+ //
+ label2.AutoSize = true;
+ label2.Location = new Point(69, 37);
+ label2.Name = "label2";
+ label2.Size = new Size(153, 25);
+ label2.TabIndex = 6;
+ label2.Text = "Required Matches";
+ //
+ // AutoMapperRequiredMatchesUpDown
+ //
+ AutoMapperRequiredMatchesUpDown.Location = new Point(6, 35);
+ AutoMapperRequiredMatchesUpDown.Name = "AutoMapperRequiredMatchesUpDown";
+ AutoMapperRequiredMatchesUpDown.Size = new Size(57, 31);
+ AutoMapperRequiredMatchesUpDown.TabIndex = 5;
+ AutoMapperRequiredMatchesUpDown.ValueChanged += AutoMapperRequiredMatchesUpDown_ValueChanged;
+ //
+ // groupBox2
+ //
+ groupBox2.Controls.Add(MappingChooseButton);
+ groupBox2.Controls.Add(UnsealCheckbox);
+ groupBox2.Controls.Add(RenamePropertiesCheckbox);
+ groupBox2.Controls.Add(PublicizeCheckbox);
+ groupBox2.Controls.Add(OutputDirectoryButton);
+ groupBox2.Controls.Add(RenameFieldsCheckbox);
+ groupBox2.Controls.Add(PickAssemblyPathButton);
+ groupBox2.Controls.Add(MappingPathTextBox);
+ groupBox2.Controls.Add(OutputPathTextBox);
+ groupBox2.Controls.Add(AssemblyPathTextBox);
+ groupBox2.Controls.Add(SilentModeCheckbox);
+ groupBox2.Controls.Add(DebugLoggingCheckbox);
+ groupBox2.Location = new Point(13, 6);
+ groupBox2.Name = "groupBox2";
+ groupBox2.Size = new Size(445, 285);
+ groupBox2.TabIndex = 0;
+ groupBox2.TabStop = false;
+ groupBox2.Text = "App Settings";
+ //
+ // MappingChooseButton
+ //
+ MappingChooseButton.Location = new Point(308, 171);
+ MappingChooseButton.Name = "MappingChooseButton";
+ MappingChooseButton.Size = new Size(112, 34);
+ MappingChooseButton.TabIndex = 8;
+ MappingChooseButton.Text = "Choose";
+ MappingChooseButton.UseVisualStyleBackColor = true;
+ MappingChooseButton.Click += MappingChooseButton_Click;
+ //
+ // UnsealCheckbox
+ //
+ UnsealCheckbox.AutoSize = true;
+ UnsealCheckbox.Checked = true;
+ UnsealCheckbox.CheckState = CheckState.Checked;
+ UnsealCheckbox.Location = new Point(196, 246);
+ UnsealCheckbox.Name = "UnsealCheckbox";
+ UnsealCheckbox.Size = new Size(90, 29);
+ UnsealCheckbox.TabIndex = 2;
+ UnsealCheckbox.Text = "Unseal";
+ UnsealCheckbox.UseVisualStyleBackColor = true;
+ UnsealCheckbox.CheckedChanged += UnsealCheckbox_CheckedChanged;
+ //
+ // RenamePropertiesCheckbox
+ //
+ RenamePropertiesCheckbox.AutoSize = true;
+ RenamePropertiesCheckbox.Checked = true;
+ RenamePropertiesCheckbox.CheckState = CheckState.Checked;
+ RenamePropertiesCheckbox.Location = new Point(6, 246);
+ RenamePropertiesCheckbox.Name = "RenamePropertiesCheckbox";
+ RenamePropertiesCheckbox.Size = new Size(186, 29);
+ RenamePropertiesCheckbox.TabIndex = 4;
+ RenamePropertiesCheckbox.Text = "Rename Properties";
+ RenamePropertiesCheckbox.UseVisualStyleBackColor = true;
+ RenamePropertiesCheckbox.CheckedChanged += RenamePropertiesCheckbox_CheckedChanged;
+ //
+ // PublicizeCheckbox
+ //
+ PublicizeCheckbox.AutoSize = true;
+ PublicizeCheckbox.Checked = true;
+ PublicizeCheckbox.CheckState = CheckState.Checked;
+ PublicizeCheckbox.Location = new Point(196, 211);
+ PublicizeCheckbox.Name = "PublicizeCheckbox";
+ PublicizeCheckbox.Size = new Size(106, 29);
+ PublicizeCheckbox.TabIndex = 1;
+ PublicizeCheckbox.Text = "Publicize";
+ PublicizeCheckbox.UseVisualStyleBackColor = true;
+ PublicizeCheckbox.CheckedChanged += PublicizeCheckbox_CheckedChanged;
+ //
+ // OutputDirectoryButton
+ //
+ OutputDirectoryButton.Location = new Point(308, 134);
+ OutputDirectoryButton.Name = "OutputDirectoryButton";
+ OutputDirectoryButton.Size = new Size(112, 34);
+ OutputDirectoryButton.TabIndex = 7;
+ OutputDirectoryButton.Text = "Choose";
+ OutputDirectoryButton.UseVisualStyleBackColor = true;
+ OutputDirectoryButton.Click += OutputDirectoryButton_Click;
+ //
+ // RenameFieldsCheckbox
+ //
+ RenameFieldsCheckbox.AutoSize = true;
+ RenameFieldsCheckbox.Checked = true;
+ RenameFieldsCheckbox.CheckState = CheckState.Checked;
+ RenameFieldsCheckbox.Location = new Point(6, 211);
+ RenameFieldsCheckbox.Name = "RenameFieldsCheckbox";
+ RenameFieldsCheckbox.Size = new Size(151, 29);
+ RenameFieldsCheckbox.TabIndex = 3;
+ RenameFieldsCheckbox.Text = "Rename Fields";
+ RenameFieldsCheckbox.UseVisualStyleBackColor = true;
+ RenameFieldsCheckbox.CheckedChanged += RenameFieldsCheckbox_CheckedChanged;
+ //
+ // PickAssemblyPathButton
+ //
+ PickAssemblyPathButton.Location = new Point(308, 100);
+ PickAssemblyPathButton.Name = "PickAssemblyPathButton";
+ PickAssemblyPathButton.Size = new Size(112, 34);
+ PickAssemblyPathButton.TabIndex = 6;
+ PickAssemblyPathButton.Text = "Choose";
+ PickAssemblyPathButton.UseVisualStyleBackColor = true;
+ PickAssemblyPathButton.Click += PickAssemblyPathButton_Click;
+ //
+ // MappingPathTextBox
+ //
+ MappingPathTextBox.Location = new Point(6, 174);
+ MappingPathTextBox.Name = "MappingPathTextBox";
+ MappingPathTextBox.PlaceholderText = "Mapping.json path";
+ MappingPathTextBox.ReadOnly = true;
+ MappingPathTextBox.Size = new Size(296, 31);
+ MappingPathTextBox.TabIndex = 5;
+ //
+ // OutputPathTextBox
+ //
+ OutputPathTextBox.Location = new Point(6, 137);
+ OutputPathTextBox.Name = "OutputPathTextBox";
+ OutputPathTextBox.PlaceholderText = "Output Directory";
+ OutputPathTextBox.ReadOnly = true;
+ OutputPathTextBox.Size = new Size(296, 31);
+ OutputPathTextBox.TabIndex = 4;
+ //
+ // AssemblyPathTextBox
+ //
+ AssemblyPathTextBox.Location = new Point(6, 100);
+ AssemblyPathTextBox.Name = "AssemblyPathTextBox";
+ AssemblyPathTextBox.PlaceholderText = "Assembly Path (Including file name)";
+ AssemblyPathTextBox.ReadOnly = true;
+ AssemblyPathTextBox.Size = new Size(296, 31);
+ AssemblyPathTextBox.TabIndex = 3;
+ //
+ // SilentModeCheckbox
+ //
+ SilentModeCheckbox.AutoSize = true;
+ SilentModeCheckbox.Location = new Point(6, 65);
+ SilentModeCheckbox.Name = "SilentModeCheckbox";
+ SilentModeCheckbox.Size = new Size(133, 29);
+ SilentModeCheckbox.TabIndex = 2;
+ SilentModeCheckbox.Text = "Silent Mode";
+ SilentModeCheckbox.UseVisualStyleBackColor = true;
+ SilentModeCheckbox.CheckedChanged += SilentModeCheckbox_CheckedChanged;
+ //
+ // DebugLoggingCheckbox
+ //
+ DebugLoggingCheckbox.AutoSize = true;
+ DebugLoggingCheckbox.Location = new Point(6, 30);
+ DebugLoggingCheckbox.Name = "DebugLoggingCheckbox";
+ DebugLoggingCheckbox.Size = new Size(159, 29);
+ DebugLoggingCheckbox.TabIndex = 0;
+ DebugLoggingCheckbox.Text = "Debug logging";
+ DebugLoggingCheckbox.UseVisualStyleBackColor = true;
+ DebugLoggingCheckbox.CheckedChanged += DebugLoggingCheckbox_CheckedChanged;
+ //
+ // openFileDialog1
+ //
+ openFileDialog1.FileName = "openFileDialog1";
+ //
+ // fileSystemWatcher1
+ //
+ fileSystemWatcher1.EnableRaisingEvents = true;
+ fileSystemWatcher1.SynchronizingObject = this;
+ //
// AssemblyToolGUI
//
AutoScaleDimensions = new SizeF(10F, 25F);
@@ -862,6 +1124,16 @@ partial class AssemblyToolGUI
((System.ComponentModel.ISupportInitialize)MethodCountUpDown).EndInit();
((System.ComponentModel.ISupportInitialize)NestedTypeCountUpDown).EndInit();
TabControlMain.ResumeLayout(false);
+ tabPage5.ResumeLayout(false);
+ groupBox3.ResumeLayout(false);
+ groupBox3.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)MaxMatchCountUpDown).EndInit();
+ groupBox4.ResumeLayout(false);
+ groupBox4.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)AutoMapperRequiredMatchesUpDown).EndInit();
+ groupBox2.ResumeLayout(false);
+ groupBox2.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)fileSystemWatcher1).EndInit();
ResumeLayout(false);
}
@@ -940,4 +1212,26 @@ partial class AssemblyToolGUI
private CheckBox ConstructorCountEnabled;
private NumericUpDown MethodCountUpDown;
private CheckBox MethodCountEnabled;
+ private TabPage tabPage5;
+ private GroupBox groupBox3;
+ private GroupBox groupBox4;
+ private GroupBox groupBox2;
+ private CheckBox SilentModeCheckbox;
+ private CheckBox DebugLoggingCheckbox;
+ private Button MappingChooseButton;
+ private Button OutputDirectoryButton;
+ private Button PickAssemblyPathButton;
+ private TextBox MappingPathTextBox;
+ private TextBox OutputPathTextBox;
+ private TextBox AssemblyPathTextBox;
+ private OpenFileDialog openFileDialog1;
+ private FileSystemWatcher fileSystemWatcher1;
+ private CheckBox RenamePropertiesCheckbox;
+ private CheckBox RenameFieldsCheckbox;
+ private CheckBox UnsealCheckbox;
+ private CheckBox PublicizeCheckbox;
+ private NumericUpDown MaxMatchCountUpDown;
+ private NumericUpDown AutoMapperRequiredMatchesUpDown;
+ private Label label1;
+ private Label label2;
}
diff --git a/AssemblyRemapperGUI/Form1.cs b/AssemblyRemapperGUI/Form1.cs
index 04ae10b..35de81a 100644
--- a/AssemblyRemapperGUI/Form1.cs
+++ b/AssemblyRemapperGUI/Form1.cs
@@ -4,354 +4,351 @@ using AssemblyRemapper.Remapper;
using AssemblyRemapper.Utils;
using RemapperGUI.Utils;
-namespace AssemblyRemapperGUI
+namespace AssemblyRemapperGUI;
+
+public partial class AssemblyToolGUI : Form
{
- public partial class AssemblyToolGUI : Form
+ public static Remapper Remapper { get; private set; } = new();
+
+ public AssemblyToolGUI()
{
- public static Remapper Remapper { get; private set; } = new();
+ InitializeComponent();
+ PopulateDomainUpDowns();
- public AssemblyToolGUI()
+ Remapper.OnComplete += ReloadTreeView;
+ ReloadTreeView(this, EventArgs.Empty);
+ }
+
+ #region BUTTONS
+
+ #region MAIN_BUTTONS
+
+ ///
+ /// Construct a new remap when the button is pressed
+ ///
+ ///
+ ///
+ private void AddRemapButton_Click(object sender, EventArgs e)
+ {
+ if (NewTypeName.Text == string.Empty)
{
- InitializeComponent();
- PopulateDomainUpDowns();
-
- Remapper.OnComplete += ReloadTreeView;
- ReloadTreeView(this, EventArgs.Empty);
+ MessageBox.Show("Please enter a new type name", "Invalid data");
+ return;
}
- #region BUTTONS
-
- #region MAIN_BUTTONS
-
- ///
- /// Construct a new remap when the button is pressed
- ///
- ///
- ///
- private void AddRemapButton_Click(object sender, EventArgs e)
+ var remap = new RemapModel
{
- if (NewTypeName.Text == string.Empty)
+ Succeeded = false,
+ FailureReason = EFailureReason.None,
+ NewTypeName = NewTypeName.Text,
+ OriginalTypeName = OriginalTypeName.Text == string.Empty ? null : OriginalTypeName.Text,
+ UseForceRename = ForceRenameCheckbox.Checked,
+ SearchParams = new SearchParams
{
- MessageBox.Show("Please enter a new type name", "Invalid data");
- return;
+ IsPublic = IsPublicUpDown.GetEnabled(),
+ IsAbstract = IsAbstractUpDown.GetEnabled(),
+ IsInterface = IsInterfaceUpDown.GetEnabled(),
+ IsEnum = IsEnumUpDown.GetEnabled(),
+ IsNested = IsNestedUpDown.GetEnabled(),
+ IsSealed = IsSealedUpDown.GetEnabled(),
+ HasAttribute = HasAttributeUpDown.GetEnabled(),
+ IsDerived = IsDerivedUpDown.GetEnabled(),
+ HasGenericParameters = HasGenericParametersUpDown.GetEnabled(),
+
+ ParentName = NestedTypeParentName.Text == string.Empty
+ ? null
+ : NestedTypeParentName.Text,
+
+ MatchBaseClass = BaseClassIncludeTextFIeld.Text == string.Empty
+ ? null
+ : BaseClassIncludeTextFIeld.Text,
+
+ IgnoreBaseClass = BaseClassExcludeTextField.Text == string.Empty
+ ? null
+ : BaseClassExcludeTextField.Text,
+
+ // Constructor - TODO
+ ConstructorParameterCount = ConstructorCountEnabled.GetCount(ConstuctorCountUpDown),
+ MethodCount = MethodCountEnabled.GetCount(MethodCountUpDown),
+ FieldCount = FieldCountEnabled.GetCount(FieldCountUpDown),
+ PropertyCount = PropertyCountEnabled.GetCount(PropertyCountUpDown),
+ NestedTypeCount = NestedTypeCountEnabled.GetCount(NestedTypeCountUpDown),
+ IncludeMethods = GUI.GetAllEntriesFromListBox(MethodIncludeBox),
+ ExcludeMethods = GUI.GetAllEntriesFromListBox(MethodExcludeBox),
+ IncludeFields = GUI.GetAllEntriesFromListBox(FieldIncludeBox),
+ ExcludeFields = GUI.GetAllEntriesFromListBox(FieldExcludeBox),
+ IncludeProperties = GUI.GetAllEntriesFromListBox(PropertiesIncludeBox),
+ ExcludeProperties = GUI.GetAllEntriesFromListBox(PropertiesExcludeBox),
+ IncludeNestedTypes = GUI.GetAllEntriesFromListBox(NestedTypesIncludeBox),
+ ExcludeNestedTypes = GUI.GetAllEntriesFromListBox(NestedTypesExcludeBox),
}
+ };
- var remap = new RemapModel
- {
- Succeeded = false,
- FailureReason = EFailureReason.None,
- NewTypeName = NewTypeName.Text,
- OriginalTypeName = OriginalTypeName.Text == string.Empty ? null : OriginalTypeName.Text,
- UseForceRename = ForceRenameCheckbox.Checked,
- SearchParams = new SearchParams
- {
- IsPublic = IsPublicUpDown.GetEnabled(),
- IsAbstract = IsAbstractUpDown.GetEnabled(),
- IsInterface = IsInterfaceUpDown.GetEnabled(),
- IsEnum = IsEnumUpDown.GetEnabled(),
- IsNested = IsNestedUpDown.GetEnabled(),
- IsSealed = IsSealedUpDown.GetEnabled(),
- HasAttribute = HasAttributeUpDown.GetEnabled(),
- IsDerived = IsDerivedUpDown.GetEnabled(),
- HasGenericParameters = HasGenericParametersUpDown.GetEnabled(),
+ RemapTreeView.Nodes.Add(GUI.GenerateTreeNode(remap, this));
+ DataProvider.Remaps.Add(remap);
+ ResetAll();
+ }
- ParentName = NestedTypeParentName.Text == string.Empty
- ? null
- : NestedTypeParentName.Text,
+ private void RemoveRemapButton_Click(object sender, EventArgs e)
+ {
+ DataProvider.Remaps?.RemoveAt(RemapTreeView.SelectedNode.Index);
+ RemapTreeView.SelectedNode?.Remove();
+ }
- MatchBaseClass = BaseClassIncludeTextFIeld.Text == string.Empty
- ? null
- : BaseClassIncludeTextFIeld.Text,
+ private void RunRemapButton_Click(object sender, EventArgs e)
+ {
+ if (Remapper.IsRunning) { return; }
- IgnoreBaseClass = BaseClassExcludeTextField.Text == string.Empty
- ? null
- : BaseClassExcludeTextField.Text,
+ Console.Clear();
- // Constructor - TODO
- ConstructorParameterCount = ConstructorCountEnabled.GetCount(ConstuctorCountUpDown),
- MethodCount = MethodCountEnabled.GetCount(MethodCountUpDown),
- FieldCount = FieldCountEnabled.GetCount(FieldCountUpDown),
- PropertyCount = PropertyCountEnabled.GetCount(PropertyCountUpDown),
- NestedTypeCount = NestedTypeCountEnabled.GetCount(NestedTypeCountUpDown),
- IncludeMethods = GUI.GetAllEntriesFromListBox(MethodIncludeBox),
- ExcludeMethods = GUI.GetAllEntriesFromListBox(MethodExcludeBox),
- IncludeFields = GUI.GetAllEntriesFromListBox(FieldIncludeBox),
- ExcludeFields = GUI.GetAllEntriesFromListBox(FieldExcludeBox),
- IncludeProperties = GUI.GetAllEntriesFromListBox(PropertiesIncludeBox),
- ExcludeProperties = GUI.GetAllEntriesFromListBox(PropertiesExcludeBox),
- IncludeNestedTypes = GUI.GetAllEntriesFromListBox(NestedTypesIncludeBox),
- ExcludeNestedTypes = GUI.GetAllEntriesFromListBox(NestedTypesExcludeBox),
- }
- };
+ Remapper.InitializeRemap();
+ }
+ private void SaveMappingFileButton_Click(object sender, EventArgs e)
+ {
+ if (MessageBox.Show(
+ "Are you sure?",
+ "Confirmation",
+ MessageBoxButtons.YesNo,
+ MessageBoxIcon.Exclamation,
+ MessageBoxDefaultButton.Button2) == DialogResult.Yes)
+ {
+ DataProvider.SaveMapping();
+ }
+ }
+
+ private void LoadMappingFileButton_Click(object sender, EventArgs e)
+ {
+ var fDialog = new OpenFileDialog
+ {
+ Title = "Select a mapping file",
+ Filter = "JSON Files (*.json)|*.json|JSONC Files (*.jsonc)|*.jsonc|All Files (*.*)|*.*",
+ Multiselect = false
+ };
+
+ if (fDialog.ShowDialog() == DialogResult.OK)
+ {
+ DataProvider.LoadMappingFile(fDialog.FileName);
+ }
+
+ RemapTreeView.Nodes.Clear();
+
+ foreach (var remap in DataProvider.Remaps)
+ {
RemapTreeView.Nodes.Add(GUI.GenerateTreeNode(remap, this));
- DataProvider.Remaps.Add(remap);
- ResetAll();
}
+ }
- private void RemoveRemapButton_Click(object sender, EventArgs e)
+ #endregion MAIN_BUTTONS
+
+ #region LISTBOX_BUTTONS
+
+ private void MethodIncludeAddButton_Click(object sender, EventArgs e)
+ {
+ if (!MethodIncludeBox.Items.Contains(IncludeMethodTextBox.Text))
{
- DataProvider.Remaps?.RemoveAt(RemapTreeView.SelectedNode.Index);
- RemapTreeView.SelectedNode?.Remove();
+ MethodIncludeBox.Items.Add(IncludeMethodTextBox.Text);
}
+ }
- private void RunRemapButton_Click(object sender, EventArgs e)
+ private void MethodIncludeRemoveButton_Click(object sender, EventArgs e)
+ {
+ if (MethodIncludeBox.SelectedItem != null)
{
- if (Remapper.IsRunning) { return; }
-
- Console.Clear();
-
- Remapper.InitializeRemap();
+ MethodIncludeBox.Items.Remove(MethodIncludeBox.SelectedItem);
}
+ }
- private void SaveMappingFileButton_Click(object sender, EventArgs e)
+ private void MethodExcludeAddButton_Click(object sender, EventArgs e)
+ {
+ if (!MethodExcludeBox.Items.Contains(ExcludeMethodTextBox.Text))
{
- if (MessageBox.Show(
- "Are you sure?",
- "Confirmation",
- MessageBoxButtons.YesNo,
- MessageBoxIcon.Exclamation,
- MessageBoxDefaultButton.Button2) == DialogResult.Yes)
- {
- DataProvider.SaveMapping();
- }
+ MethodExcludeBox.Items.Add(ExcludeMethodTextBox.Text);
}
+ }
- private void LoadMappingFileButton_Click(object sender, EventArgs e)
+ private void MethodExcludeRemoveButton_Click(object sender, EventArgs e)
+ {
+ if (MethodExcludeBox.SelectedItem != null)
{
- var fDialog = new OpenFileDialog
- {
- Title = "Select a mapping file",
- Filter = "JSON Files (*.json)|*.json|JSONC Files (*.jsonc)|*.jsonc|All Files (*.*)|*.*",
- Multiselect = false
- };
-
- if (fDialog.ShowDialog() == DialogResult.OK)
- {
- var fileName = fDialog.FileName;
-
- DataProvider.LoadMappingFile(fileName);
- }
-
- RemapTreeView.Nodes.Clear();
-
- foreach (var remap in DataProvider.Remaps)
- {
- RemapTreeView.Nodes.Add(GUI.GenerateTreeNode(remap, this));
- }
+ MethodExcludeBox.Items.Remove(MethodExcludeBox.SelectedItem);
}
+ }
- #endregion MAIN_BUTTONS
-
- #region LISTBOX_BUTTONS
-
- private void MethodIncludeAddButton_Click(object sender, EventArgs e)
+ private void FIeldIncludeAddButton_Click(object sender, EventArgs e)
+ {
+ if (!FieldIncludeBox.Items.Contains(FieldsIncludeTextInput.Text))
{
- if (!MethodIncludeBox.Items.Contains(IncludeMethodTextBox.Text))
- {
- MethodIncludeBox.Items.Add(IncludeMethodTextBox.Text);
- }
+ FieldIncludeBox.Items.Add(FieldsIncludeTextInput.Text);
}
+ }
- private void MethodIncludeRemoveButton_Click(object sender, EventArgs e)
+ private void FieldIncludeRemoveButton_Click(object sender, EventArgs e)
+ {
+ if (FieldIncludeBox.SelectedItem != null)
{
- if (MethodIncludeBox.SelectedItem != null)
- {
- MethodIncludeBox.Items.Remove(MethodIncludeBox.SelectedItem);
- }
+ FieldIncludeBox.Items.Remove(FieldIncludeBox.SelectedItem);
}
+ }
- private void MethodExcludeAddButton_Click(object sender, EventArgs e)
+ private void FieldExcludeAddButton_Click(object sender, EventArgs e)
+ {
+ if (!FieldExcludeBox.Items.Contains(FieldsExcludeTextInput.Text))
{
- if (!MethodExcludeBox.Items.Contains(ExcludeMethodTextBox.Text))
- {
- MethodExcludeBox.Items.Add(ExcludeMethodTextBox.Text);
- }
+ FieldExcludeBox.Items.Add(FieldsExcludeTextInput.Text);
}
+ }
- private void MethodExcludeRemoveButton_Click(object sender, EventArgs e)
+ private void FieldExcludeRemoveButton_Click(object sender, EventArgs e)
+ {
+ if (FieldExcludeBox.SelectedItem != null)
{
- if (MethodExcludeBox.SelectedItem != null)
- {
- MethodExcludeBox.Items.Remove(MethodExcludeBox.SelectedItem);
- }
+ FieldExcludeBox.Items.Remove(FieldExcludeBox.SelectedItem);
}
+ }
- private void FIeldIncludeAddButton_Click(object sender, EventArgs e)
+ private void PropertiesIncludeAddButton_Click(object sender, EventArgs e)
+ {
+ if (!PropertiesIncludeBox.Items.Contains(PropertiesIncludeTextField.Text))
{
- if (!FieldIncludeBox.Items.Contains(FieldsIncludeTextInput.Text))
- {
- FieldIncludeBox.Items.Add(FieldsIncludeTextInput.Text);
- }
+ PropertiesIncludeBox.Items.Add(PropertiesIncludeTextField.Text);
}
+ }
- private void FieldIncludeRemoveButton_Click(object sender, EventArgs e)
+ private void PropertiesIncludeRemoveButton_Click(object sender, EventArgs e)
+ {
+ if (PropertiesIncludeBox.SelectedItem != null)
{
- if (FieldIncludeBox.SelectedItem != null)
- {
- FieldIncludeBox.Items.Remove(FieldIncludeBox.SelectedItem);
- }
+ PropertiesIncludeBox.Items.Remove(PropertiesIncludeBox.SelectedItem);
}
+ }
- private void FieldExcludeAddButton_Click(object sender, EventArgs e)
+ private void PropertiesExcludeAddButton_Click(object sender, EventArgs e)
+ {
+ if (!PropertiesExcludeBox.Items.Contains(PropertiesExcludeTextField.Text))
{
- if (!FieldExcludeBox.Items.Contains(FieldsExcludeTextInput.Text))
- {
- FieldExcludeBox.Items.Add(FieldsExcludeTextInput.Text);
- }
+ PropertiesExcludeBox.Items.Add(PropertiesExcludeTextField.Text);
}
+ }
- private void FieldExcludeRemoveButton_Click(object sender, EventArgs e)
+ private void PropertiesExcludeRemoveButton_Click(object sender, EventArgs e)
+ {
+ if (PropertiesExcludeBox.SelectedItem != null)
{
- if (FieldExcludeBox.SelectedItem != null)
- {
- FieldExcludeBox.Items.Remove(FieldExcludeBox.SelectedItem);
- }
+ PropertiesExcludeBox.Items.Remove(PropertiesExcludeBox.SelectedItem);
}
+ }
- private void PropertiesIncludeAddButton_Click(object sender, EventArgs e)
+ private void NestedTypesAddButton_Click(object sender, EventArgs e)
+ {
+ if (!NestedTypesIncludeBox.Items.Contains(NestedTypesIncludeTextField.Text))
{
- if (!PropertiesIncludeBox.Items.Contains(PropertiesIncludeTextField.Text))
- {
- PropertiesIncludeBox.Items.Add(PropertiesIncludeTextField.Text);
- }
+ NestedTypesIncludeBox.Items.Add(NestedTypesIncludeTextField.Text);
}
+ }
- private void PropertiesIncludeRemoveButton_Click(object sender, EventArgs e)
+ private void NestedTypesRemoveButton_Click(object sender, EventArgs e)
+ {
+ if (NestedTypesIncludeBox.SelectedItem != null)
{
- if (PropertiesIncludeBox.SelectedItem != null)
- {
- PropertiesIncludeBox.Items.Remove(PropertiesIncludeBox.SelectedItem);
- }
+ NestedTypesIncludeBox.Items.Remove(NestedTypesIncludeBox.SelectedItem);
}
+ }
- private void PropertiesExcludeAddButton_Click(object sender, EventArgs e)
+ private void NestedTypesExlcudeAddButton_Click(object sender, EventArgs e)
+ {
+ if (!NestedTypesExcludeBox.Items.Contains(NestedTypesExcludeTextField.Text))
{
- if (!PropertiesExcludeBox.Items.Contains(PropertiesExcludeTextField.Text))
- {
- PropertiesExcludeBox.Items.Add(PropertiesExcludeTextField.Text);
- }
+ NestedTypesExcludeBox.Items.Add(NestedTypesExcludeTextField.Text);
}
+ }
- private void PropertiesExcludeRemoveButton_Click(object sender, EventArgs e)
+ private void NestedTypesExcludeRemoveButton_Click(object sender, EventArgs e)
+ {
+ if (NestedTypesExcludeBox.SelectedItem != null)
{
- if (PropertiesExcludeBox.SelectedItem != null)
- {
- PropertiesExcludeBox.Items.Remove(PropertiesExcludeBox.SelectedItem);
- }
+ NestedTypesExcludeBox.Items.Remove(NestedTypesExcludeBox.SelectedItem);
}
+ }
- private void NestedTypesAddButton_Click(object sender, EventArgs e)
+ #endregion LISTBOX_BUTTONS
+
+ #endregion BUTTONS
+
+ // Reset All UI elements to default
+ private void ResetAll()
+ {
+ PopulateDomainUpDowns();
+
+ // Text fields
+
+ NewTypeName.Clear();
+ BaseClassIncludeTextFIeld.Clear();
+ BaseClassExcludeTextField.Clear();
+ NestedTypeParentName.Clear();
+ BaseClassExcludeTextField.Clear();
+ IncludeMethodTextBox.Clear();
+ ExcludeMethodTextBox.Clear();
+ FieldsIncludeTextInput.Clear();
+ FieldsExcludeTextInput.Clear();
+ PropertiesIncludeTextField.Clear();
+ PropertiesExcludeTextField.Clear();
+ NestedTypesIncludeTextField.Clear();
+ NestedTypesExcludeTextField.Clear();
+
+ // Numeric UpDowns
+
+ MethodCountUpDown.Value = 0;
+ FieldCountUpDown.Value = 0;
+ PropertyCountUpDown.Value = 0;
+ NestedTypeCountUpDown.Value = 0;
+
+ // Check boxes
+
+ ForceRenameCheckbox.Checked = false;
+ MethodCountEnabled.Checked = false;
+ FieldCountEnabled.Checked = false;
+ PropertyCountEnabled.Checked = false;
+ NestedTypeCountEnabled.Checked = false;
+
+ // List boxes
+
+ MethodIncludeBox.Items.Clear();
+ MethodExcludeBox.Items.Clear();
+ FieldIncludeBox.Items.Clear();
+ FieldExcludeBox.Items.Clear();
+ PropertiesIncludeBox.Items.Clear();
+ PropertiesExcludeBox.Items.Clear();
+ NestedTypesIncludeBox.Items.Clear();
+ NestedTypesExcludeBox.Items.Clear();
+ }
+
+ private void PopulateDomainUpDowns()
+ {
+ // Clear them all first just incase
+ IsPublicUpDown.BuildStringList("IsPublic");
+ IsAbstractUpDown.BuildStringList("IsAbstract");
+ IsInterfaceUpDown.BuildStringList("IsInterface");
+ IsEnumUpDown.BuildStringList("IsEnum");
+ IsNestedUpDown.BuildStringList("IsNested");
+ IsSealedUpDown.BuildStringList("IsSealed");
+ HasAttributeUpDown.BuildStringList("HasAttribute");
+ IsDerivedUpDown.BuildStringList("IsDerived");
+ HasGenericParametersUpDown.BuildStringList("HasGenericParams");
+ }
+
+ ///
+ /// Subscribes the the remappers OnComplete event
+ ///
+ ///
+ ///
+ private void ReloadTreeView(object sender, EventArgs e)
+ {
+ RemapTreeView.Nodes.Clear();
+
+ foreach (var remap in DataProvider.Remaps)
{
- if (!NestedTypesIncludeBox.Items.Contains(NestedTypesIncludeTextField.Text))
- {
- NestedTypesIncludeBox.Items.Add(NestedTypesIncludeTextField.Text);
- }
- }
-
- private void NestedTypesRemoveButton_Click(object sender, EventArgs e)
- {
- if (NestedTypesIncludeBox.SelectedItem != null)
- {
- NestedTypesIncludeBox.Items.Remove(NestedTypesIncludeBox.SelectedItem);
- }
- }
-
- private void NestedTypesExlcudeAddButton_Click(object sender, EventArgs e)
- {
- if (!NestedTypesExcludeBox.Items.Contains(NestedTypesExcludeTextField.Text))
- {
- NestedTypesExcludeBox.Items.Add(NestedTypesExcludeTextField.Text);
- }
- }
-
- private void NestedTypesExcludeRemoveButton_Click(object sender, EventArgs e)
- {
- if (NestedTypesExcludeBox.SelectedItem != null)
- {
- NestedTypesExcludeBox.Items.Remove(NestedTypesExcludeBox.SelectedItem);
- }
- }
-
- #endregion LISTBOX_BUTTONS
-
- #endregion BUTTONS
-
- // Reset All UI elements to default
- private void ResetAll()
- {
- PopulateDomainUpDowns();
-
- // Text fields
-
- NewTypeName.Clear();
- BaseClassIncludeTextFIeld.Clear();
- BaseClassExcludeTextField.Clear();
- NestedTypeParentName.Clear();
- BaseClassExcludeTextField.Clear();
- IncludeMethodTextBox.Clear();
- ExcludeMethodTextBox.Clear();
- FieldsIncludeTextInput.Clear();
- FieldsExcludeTextInput.Clear();
- PropertiesIncludeTextField.Clear();
- PropertiesExcludeTextField.Clear();
- NestedTypesIncludeTextField.Clear();
- NestedTypesExcludeTextField.Clear();
-
- // Numeric UpDowns
-
- MethodCountUpDown.Value = 0;
- FieldCountUpDown.Value = 0;
- PropertyCountUpDown.Value = 0;
- NestedTypeCountUpDown.Value = 0;
-
- // Check boxes
-
- ForceRenameCheckbox.Checked = false;
- MethodCountEnabled.Checked = false;
- FieldCountEnabled.Checked = false;
- PropertyCountEnabled.Checked = false;
- NestedTypeCountEnabled.Checked = false;
-
- // List boxes
-
- MethodIncludeBox.Items.Clear();
- MethodExcludeBox.Items.Clear();
- FieldIncludeBox.Items.Clear();
- FieldExcludeBox.Items.Clear();
- PropertiesIncludeBox.Items.Clear();
- PropertiesExcludeBox.Items.Clear();
- NestedTypesIncludeBox.Items.Clear();
- NestedTypesExcludeBox.Items.Clear();
- }
-
- private void PopulateDomainUpDowns()
- {
- // Clear them all first just incase
- IsPublicUpDown.BuildStringList("IsPublic");
- IsAbstractUpDown.BuildStringList("IsAbstract");
- IsInterfaceUpDown.BuildStringList("IsInterface");
- IsEnumUpDown.BuildStringList("IsEnum");
- IsNestedUpDown.BuildStringList("IsNested");
- IsSealedUpDown.BuildStringList("IsSealed");
- HasAttributeUpDown.BuildStringList("HasAttribute");
- IsDerivedUpDown.BuildStringList("IsDerived");
- HasGenericParametersUpDown.BuildStringList("HasGenericParams");
- }
-
- ///
- /// Subscribes the the remappers OnComplete event
- ///
- ///
- ///
- private void ReloadTreeView(object sender, EventArgs e)
- {
- RemapTreeView.Nodes.Clear();
-
- foreach (var remap in DataProvider.Remaps)
- {
- RemapTreeView.Nodes.Add(GUI.GenerateTreeNode(remap, this));
- }
+ RemapTreeView.Nodes.Add(GUI.GenerateTreeNode(remap, this));
}
}
}
\ No newline at end of file
diff --git a/AssemblyRemapperGUI/Form1.resx b/AssemblyRemapperGUI/Form1.resx
index a86c301..87197fd 100644
--- a/AssemblyRemapperGUI/Form1.resx
+++ b/AssemblyRemapperGUI/Form1.resx
@@ -123,4 +123,10 @@
367, 17
+
+ 536, 17
+
+
+ 767, 17
+
\ No newline at end of file
diff --git a/AssemblyRemapperGUI/RemapperGUI.csproj b/AssemblyRemapperGUI/RemapperGUI.csproj
index 28b82f0..ea147a4 100644
--- a/AssemblyRemapperGUI/RemapperGUI.csproj
+++ b/AssemblyRemapperGUI/RemapperGUI.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/AssemblyRemapperGUI/SettingsController.cs b/AssemblyRemapperGUI/SettingsController.cs
new file mode 100644
index 0000000..43d47ad
--- /dev/null
+++ b/AssemblyRemapperGUI/SettingsController.cs
@@ -0,0 +1,113 @@
+using AssemblyRemapper.Utils;
+
+namespace AssemblyRemapperGUI;
+
+internal partial class AssemblyToolGUI
+{
+ #region SETTINGS_BUTTONS
+
+ private void PickAssemblyPathButton_Click(object sender, EventArgs e)
+ {
+ OpenFileDialog fDialog = new()
+ {
+ Title = "Select a DLL file",
+ Filter = "DLL Files (*.dll)|*.dll|All Files (*.*)|*.*",
+ Multiselect = false
+ };
+
+ if (fDialog.ShowDialog() == DialogResult.OK)
+ {
+ DataProvider.Settings.AppSettings.AssemblyPath = fDialog.FileName;
+ DataProvider.LoadAssemblyDefinition();
+ AssemblyPathTextBox.Text = fDialog.FileName;
+ }
+ }
+
+ private void OutputDirectoryButton_Click(object sender, EventArgs e)
+ {
+ using FolderBrowserDialog fDialog = new();
+
+ fDialog.Description = "Select a directory";
+ fDialog.ShowNewFolderButton = true;
+
+ if (fDialog.ShowDialog() == DialogResult.OK)
+ {
+ DataProvider.Settings.AppSettings.OutputPath = fDialog.SelectedPath;
+ OutputPathTextBox.Text = fDialog.SelectedPath;
+ }
+ }
+
+ private void MappingChooseButton_Click(object sender, EventArgs e)
+ {
+ var fDialog = new OpenFileDialog
+ {
+ Title = "Select a mapping file",
+ Filter = "JSON Files (*.json)|*.json|JSONC Files (*.jsonc)|*.jsonc|All Files (*.*)|*.*",
+ Multiselect = false
+ };
+
+ if (fDialog.ShowDialog() == DialogResult.OK)
+ {
+ DataProvider.LoadMappingFile(fDialog.FileName);
+ MappingPathTextBox.Text = fDialog.FileName;
+ }
+ }
+
+ #endregion SETTINGS_BUTTONS
+
+ #region CHECKBOXES
+
+ private void DebugLoggingCheckbox_CheckedChanged(object sender, EventArgs e)
+ {
+ DataProvider.Settings.AppSettings.Debug = DebugLoggingCheckbox.Checked;
+ DataProvider.SaveAppSettings();
+ }
+
+ private void SilentModeCheckbox_CheckedChanged(object sender, EventArgs e)
+ {
+ DataProvider.Settings.AppSettings.SilentMode = SilentModeCheckbox.Checked;
+ DataProvider.SaveAppSettings();
+ }
+
+ private void RenameFieldsCheckbox_CheckedChanged(object sender, EventArgs e)
+ {
+ DataProvider.Settings.AppSettings.RenameFields = RenameFieldsCheckbox.Checked;
+ DataProvider.SaveAppSettings();
+ }
+
+ private void RenamePropertiesCheckbox_CheckedChanged(object sender, EventArgs e)
+ {
+ DataProvider.Settings.AppSettings.RenameProperties = RenamePropertiesCheckbox.Checked;
+ DataProvider.SaveAppSettings();
+ }
+
+ private void PublicizeCheckbox_CheckedChanged(object sender, EventArgs e)
+ {
+ DataProvider.Settings.AppSettings.Publicize = PublicizeCheckbox.Checked;
+ DataProvider.SaveAppSettings();
+ }
+
+ private void UnsealCheckbox_CheckedChanged(object sender, EventArgs e)
+ {
+ DataProvider.Settings.AppSettings.Unseal = UnsealCheckbox.Checked;
+ DataProvider.SaveAppSettings();
+ }
+
+ #endregion CHECKBOXES
+
+ #region UPDOWNS
+
+ private void MaxMatchCountUpDown_ValueChanged(object sender, EventArgs e)
+ {
+ DataProvider.Settings.Remapper.MaxMatchCount = (int)MaxMatchCountUpDown.Value;
+ DataProvider.SaveAppSettings();
+ }
+
+ private void AutoMapperRequiredMatchesUpDown_ValueChanged(object sender, EventArgs e)
+ {
+ DataProvider.Settings.AutoMapper.RequiredMatches = (int)AutoMapperRequiredMatchesUpDown.Value;
+ DataProvider.SaveAppSettings();
+ }
+
+ #endregion UPDOWNS
+}
\ No newline at end of file
diff --git a/Assembly_Tool.sln b/Assembly_Tool.sln
index acbf148..7f817d9 100644
--- a/Assembly_Tool.sln
+++ b/Assembly_Tool.sln
@@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34728.123
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibRemap", "AssemblyRemapper\LibRemap.csproj", "{84BF5F6E-9EEC-4B08-BE72-9F419A369124}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapLib", "AssemblyRemapper\MapLib.csproj", "{84BF5F6E-9EEC-4B08-BE72-9F419A369124}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemapperGUI", "AssemblyRemapperGUI\RemapperGUI.csproj", "{A854A2C9-EB8B-4B70-BB79-17F689756F48}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RemapperGUI", "AssemblyRemapperGUI\RemapperGUI.csproj", "{A854A2C9-EB8B-4B70-BB79-17F689756F48}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemapperConsole", "RemapperConsole\RemapperConsole.csproj", "{8D53FC01-49FD-47FB-9789-3DD6E53D6A7D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -21,6 +23,10 @@ Global
{A854A2C9-EB8B-4B70-BB79-17F689756F48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A854A2C9-EB8B-4B70-BB79-17F689756F48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A854A2C9-EB8B-4B70-BB79-17F689756F48}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8D53FC01-49FD-47FB-9789-3DD6E53D6A7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8D53FC01-49FD-47FB-9789-3DD6E53D6A7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8D53FC01-49FD-47FB-9789-3DD6E53D6A7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8D53FC01-49FD-47FB-9789-3DD6E53D6A7D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/AssemblyRemapper/Commands/CommandProcessor.cs b/RemapperConsole/Commands/CommandProcessor.cs
similarity index 100%
rename from AssemblyRemapper/Commands/CommandProcessor.cs
rename to RemapperConsole/Commands/CommandProcessor.cs
diff --git a/RemapperConsole/Program.cs b/RemapperConsole/Program.cs
new file mode 100644
index 0000000..3751555
--- /dev/null
+++ b/RemapperConsole/Program.cs
@@ -0,0 +1,2 @@
+// See https://aka.ms/new-console-template for more information
+Console.WriteLine("Hello, World!");
diff --git a/RemapperConsole/RemapperConsole.csproj b/RemapperConsole/RemapperConsole.csproj
new file mode 100644
index 0000000..2c1e9a0
--- /dev/null
+++ b/RemapperConsole/RemapperConsole.csproj
@@ -0,0 +1,14 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/Templates/Settings.jsonc b/Templates/Settings.jsonc
index 6c7a155..b2a1e20 100644
--- a/Templates/Settings.jsonc
+++ b/Templates/Settings.jsonc
@@ -2,21 +2,19 @@
"AppSettings": {
"Debug": false, // Enables extra debug logging, slows down the program by alot
"SilentMode": true, // The tool will stop and prompt you to continue on every remapping if disabled
- "MatchMode": false // The assembly will not be written back to disk used only to score mappings
- },
- "Remapper": {
- "MaxMatchCount": 5, // Max matches the remapper will return
- "Publicize": true, // Publicize all types, methods, and properties : NOTE: Not run until after the remap has completed
- "Unseal": true, // Unseal all types : NOTE: Not run until after the remap has completed
"AssemblyPath": "./Data/Managed/Assembly-CSharp.dll", // Path to the assembly we want to remap
"OutputPath": "./Data/Assembly-CSharp-Remapped.dll", // Path including the filename and extension we want to write the changes to
- "MappingPath": "./Data/Mappings.jsonc" // Path to the mapping file
+ "MappingPath": "./Data/Mappings.jsonc", // Path to the mapping file
+ "RenameFields": true, // Names of fields of the matched type will be renamed to the type name with approproiate convention
+ "RenameProperties": true, // Names of properties of the matched type will be renamed to the type name with approproiate convention
+ "Publicize": true, // Publicize all types, methods, and properties : NOTE: Not run until after the remap has completed
+ "Unseal": true // Unseal all types : NOTE: Not run until after the remap has completed
+ },
+ "Remapper": {
+ "MaxMatchCount": 5 // Max matches the remapper will return
},
"AutoMapper": {
"RequiredMatches": 5, // Minimum number of times a member must have this name in the assembly before considering it for remapping
- "MatchMode": true, // Disable making changes, only find matches and log
- "Publicize": false, // Publicize all types, methods, and properties : NOTE: Not run until after the remap has completed
- "Unseal": false, // Unseal all types : NOTE: Not run until after the remap has completed
"NamesToIgnore": [ // Any member name you want to ignore while iterating through the assembly
]