From 03552ed4114cfdd7244de5f3c0568b72b6e17587 Mon Sep 17 00:00:00 2001 From: Cj <161484149+CJ-SPT@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:29:26 -0400 Subject: [PATCH] Complete changes for manual mapper --- RecodeItGUI/GUI/Main.Designer.cs | 519 ++++++++++--------- RecodeItGUI/GUI/Main.cs | 133 ++--- RecodeItGUI/Program.cs | 1 - RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs | 4 +- RecodeItLib/Models/AppSettingsModel.cs | 21 +- RecodeItLib/Remapper/ReCodeItRemapper.cs | 19 +- RecodeItLib/Utils/DataProvider.cs | 59 +-- Templates/Settings.jsonc | 13 +- 8 files changed, 373 insertions(+), 396 deletions(-) diff --git a/RecodeItGUI/GUI/Main.Designer.cs b/RecodeItGUI/GUI/Main.Designer.cs index 97b85bd..0d75189 100644 --- a/RecodeItGUI/GUI/Main.Designer.cs +++ b/RecodeItGUI/GUI/Main.Designer.cs @@ -31,8 +31,17 @@ partial class ReCodeItForm TabPageRemapper = new TabPage(); RemapTreeView = new TreeView(); groupBox1 = new GroupBox(); + RemapperUseForceRename = new CheckBox(); + RemapperUnseal = new CheckBox(); + RemapperPublicicize = new CheckBox(); + RemapperOutputDirectoryPath = new TextBox(); + TargetAssemblyPath = new TextBox(); + RenamePropertiesCheckbox = new CheckBox(); + OutputDirectoryButton = new Button(); EditRemapButton = new Button(); + PickAssemblyPathButton = new Button(); ConstuctorCountUpDown = new NumericUpDown(); + RenameFieldsCheckbox = new CheckBox(); ConstructorCountEnabled = new CheckBox(); LoadMappingFileButton = new Button(); SaveMappingFileButton = new Button(); @@ -123,31 +132,23 @@ partial class ReCodeItForm AutoMapperExcludeTypesAddButton = new Button(); AutoMapperTypesExcludeBox = new ListBox(); tabPage5 = new TabPage(); + groupBox4 = new GroupBox(); + CrossPatcherUnsealEnabled = new CheckBox(); + CrossPatchingPublicizeEnabled = new CheckBox(); + groupBox3 = new GroupBox(); + CrossPatchingRunButton = new Button(); + textBox4 = new TextBox(); + CrossPatchingBuildDirButton = new Button(); + textBox3 = new TextBox(); + textBox1 = new TextBox(); + textBox2 = new TextBox(); + CrossPatchingMappingChooseButton = new Button(); + CrossPatchingOrigAssemblyButton = new Button(); + CrossMappingOutputChooseButton = new Button(); SettingsTab = new TabPage(); groupBox2 = new GroupBox(); SilentModeCheckbox = new CheckBox(); DebugLoggingCheckbox = new CheckBox(); - CrossPatchingBuildDirButton = new Button(); - textBox1 = new TextBox(); - CrossPatchingMappingChooseButton = new Button(); - CrossMappingOutputChooseButton = new Button(); - CrossPatchingOrigAssemblyButton = new Button(); - textBox2 = new TextBox(); - textBox3 = new TextBox(); - textBox4 = new TextBox(); - groupBox3 = new GroupBox(); - groupBox4 = new GroupBox(); - CrossPatcherUnsealEnabled = new CheckBox(); - CrossPatchingPublicizeEnabled = new CheckBox(); - CrossPatchingRunButton = new Button(); - this.RemapperUnsealCheckbox = new CheckBox(); - RenamePropertiesCheckbox = new CheckBox(); - this.RemapperPublicizeCheckbox = new CheckBox(); - OutputDirectoryButton = new Button(); - RenameFieldsCheckbox = new CheckBox(); - PickAssemblyPathButton = new Button(); - this.RemapperOutputPathTextBox = new TextBox(); - this.RemapperAssemblyPathTextBox = new TextBox(); TabPageRemapper.SuspendLayout(); groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)ConstuctorCountUpDown).BeginInit(); @@ -165,10 +166,10 @@ partial class ReCodeItForm ((System.ComponentModel.ISupportInitialize)AutoMapperMinLengthUpDown).BeginInit(); ((System.ComponentModel.ISupportInitialize)AutoMapperRequiredMatchesUpDown).BeginInit(); tabPage5.SuspendLayout(); + groupBox4.SuspendLayout(); + groupBox3.SuspendLayout(); SettingsTab.SuspendLayout(); groupBox2.SuspendLayout(); - groupBox3.SuspendLayout(); - groupBox4.SuspendLayout(); SuspendLayout(); // // TabPageRemapper @@ -193,14 +194,15 @@ partial class ReCodeItForm // // groupBox1 // - groupBox1.Controls.Add(this.RemapperUnsealCheckbox); - groupBox1.Controls.Add(this.RemapperOutputPathTextBox); + groupBox1.Controls.Add(RemapperUseForceRename); + groupBox1.Controls.Add(RemapperUnseal); + groupBox1.Controls.Add(RemapperPublicicize); + groupBox1.Controls.Add(RemapperOutputDirectoryPath); + groupBox1.Controls.Add(TargetAssemblyPath); groupBox1.Controls.Add(RenamePropertiesCheckbox); groupBox1.Controls.Add(OutputDirectoryButton); groupBox1.Controls.Add(EditRemapButton); groupBox1.Controls.Add(PickAssemblyPathButton); - groupBox1.Controls.Add(this.RemapperPublicizeCheckbox); - groupBox1.Controls.Add(this.RemapperAssemblyPathTextBox); groupBox1.Controls.Add(ConstuctorCountUpDown); groupBox1.Controls.Add(RenameFieldsCheckbox); groupBox1.Controls.Add(ConstructorCountEnabled); @@ -239,6 +241,82 @@ partial class ReCodeItForm groupBox1.TabStop = false; groupBox1.Text = "Remap Editor"; // + // RemapperUseForceRename + // + RemapperUseForceRename.AutoSize = true; + RemapperUseForceRename.Checked = true; + RemapperUseForceRename.CheckState = CheckState.Checked; + RemapperUseForceRename.Location = new Point(580, 194); + RemapperUseForceRename.Name = "RemapperUseForceRename"; + RemapperUseForceRename.Size = new Size(149, 29); + RemapperUseForceRename.TabIndex = 37; + RemapperUseForceRename.Text = "Force Rename"; + RemapperUseForceRename.UseVisualStyleBackColor = true; + // + // RemapperUnseal + // + RemapperUnseal.AutoSize = true; + RemapperUnseal.Checked = true; + RemapperUnseal.CheckState = CheckState.Checked; + RemapperUnseal.Location = new Point(580, 334); + RemapperUnseal.Name = "RemapperUnseal"; + RemapperUnseal.Size = new Size(90, 29); + RemapperUnseal.TabIndex = 36; + RemapperUnseal.Text = "Unseal"; + RemapperUnseal.UseVisualStyleBackColor = true; + // + // RemapperPublicicize + // + RemapperPublicicize.AutoSize = true; + RemapperPublicicize.Checked = true; + RemapperPublicicize.CheckState = CheckState.Checked; + RemapperPublicicize.Location = new Point(580, 299); + RemapperPublicicize.Name = "RemapperPublicicize"; + RemapperPublicicize.Size = new Size(106, 29); + RemapperPublicicize.TabIndex = 35; + RemapperPublicicize.Text = "Publicize"; + RemapperPublicicize.UseVisualStyleBackColor = true; + // + // RemapperOutputDirectoryPath + // + RemapperOutputDirectoryPath.BackColor = SystemColors.ScrollBar; + RemapperOutputDirectoryPath.Location = new Point(10, 106); + RemapperOutputDirectoryPath.Name = "RemapperOutputDirectoryPath"; + RemapperOutputDirectoryPath.PlaceholderText = "Output Directory"; + RemapperOutputDirectoryPath.Size = new Size(297, 31); + RemapperOutputDirectoryPath.TabIndex = 34; + // + // TargetAssemblyPath + // + TargetAssemblyPath.BackColor = SystemColors.ScrollBar; + TargetAssemblyPath.Location = new Point(10, 69); + TargetAssemblyPath.Name = "TargetAssemblyPath"; + TargetAssemblyPath.PlaceholderText = "Target Assembly"; + TargetAssemblyPath.Size = new Size(297, 31); + TargetAssemblyPath.TabIndex = 33; + // + // RenamePropertiesCheckbox + // + RenamePropertiesCheckbox.AutoSize = true; + RenamePropertiesCheckbox.Checked = true; + RenamePropertiesCheckbox.CheckState = CheckState.Checked; + RenamePropertiesCheckbox.Location = new Point(580, 264); + RenamePropertiesCheckbox.Name = "RenamePropertiesCheckbox"; + RenamePropertiesCheckbox.Size = new Size(186, 29); + RenamePropertiesCheckbox.TabIndex = 28; + RenamePropertiesCheckbox.Text = "Rename Properties"; + RenamePropertiesCheckbox.UseVisualStyleBackColor = true; + // + // OutputDirectoryButton + // + OutputDirectoryButton.Location = new Point(312, 104); + OutputDirectoryButton.Name = "OutputDirectoryButton"; + OutputDirectoryButton.Size = new Size(112, 34); + OutputDirectoryButton.TabIndex = 32; + OutputDirectoryButton.Text = "Choose"; + OutputDirectoryButton.UseVisualStyleBackColor = true; + OutputDirectoryButton.Click += OutputDirectoryButton_Click_1; + // // EditRemapButton // EditRemapButton.BackColor = SystemColors.ButtonShadow; @@ -250,6 +328,16 @@ partial class ReCodeItForm EditRemapButton.UseVisualStyleBackColor = false; EditRemapButton.Click += EditRemapButton_Click; // + // PickAssemblyPathButton + // + PickAssemblyPathButton.Location = new Point(313, 66); + PickAssemblyPathButton.Name = "PickAssemblyPathButton"; + PickAssemblyPathButton.Size = new Size(112, 34); + PickAssemblyPathButton.TabIndex = 31; + PickAssemblyPathButton.Text = "Choose"; + PickAssemblyPathButton.UseVisualStyleBackColor = true; + PickAssemblyPathButton.Click += PickAssemblyPathButton_Click_1; + // // ConstuctorCountUpDown // ConstuctorCountUpDown.BackColor = SystemColors.ScrollBar; @@ -258,6 +346,18 @@ partial class ReCodeItForm ConstuctorCountUpDown.Size = new Size(55, 31); ConstuctorCountUpDown.TabIndex = 19; // + // RenameFieldsCheckbox + // + RenameFieldsCheckbox.AutoSize = true; + RenameFieldsCheckbox.Checked = true; + RenameFieldsCheckbox.CheckState = CheckState.Checked; + RenameFieldsCheckbox.Location = new Point(580, 229); + RenameFieldsCheckbox.Name = "RenameFieldsCheckbox"; + RenameFieldsCheckbox.Size = new Size(151, 29); + RenameFieldsCheckbox.TabIndex = 26; + RenameFieldsCheckbox.Text = "Rename Fields"; + RenameFieldsCheckbox.UseVisualStyleBackColor = true; + // // ConstructorCountEnabled // ConstructorCountEnabled.AutoSize = true; @@ -1206,6 +1306,140 @@ partial class ReCodeItForm tabPage5.TabIndex = 4; tabPage5.Text = "Cross Patching"; // + // groupBox4 + // + groupBox4.Controls.Add(CrossPatcherUnsealEnabled); + groupBox4.Controls.Add(CrossPatchingPublicizeEnabled); + groupBox4.Location = new Point(490, 6); + groupBox4.Name = "groupBox4"; + groupBox4.Size = new Size(445, 350); + groupBox4.TabIndex = 22; + groupBox4.TabStop = false; + groupBox4.Text = "Patch Settings"; + // + // CrossPatcherUnsealEnabled + // + CrossPatcherUnsealEnabled.AutoSize = true; + CrossPatcherUnsealEnabled.Checked = true; + CrossPatcherUnsealEnabled.CheckState = CheckState.Checked; + CrossPatcherUnsealEnabled.Location = new Point(6, 65); + CrossPatcherUnsealEnabled.Name = "CrossPatcherUnsealEnabled"; + CrossPatcherUnsealEnabled.Size = new Size(90, 29); + CrossPatcherUnsealEnabled.TabIndex = 12; + CrossPatcherUnsealEnabled.Text = "Unseal"; + CrossPatcherUnsealEnabled.UseVisualStyleBackColor = true; + // + // CrossPatchingPublicizeEnabled + // + CrossPatchingPublicizeEnabled.AutoSize = true; + CrossPatchingPublicizeEnabled.Checked = true; + CrossPatchingPublicizeEnabled.CheckState = CheckState.Checked; + CrossPatchingPublicizeEnabled.Location = new Point(6, 30); + CrossPatchingPublicizeEnabled.Name = "CrossPatchingPublicizeEnabled"; + CrossPatchingPublicizeEnabled.Size = new Size(106, 29); + CrossPatchingPublicizeEnabled.TabIndex = 11; + CrossPatchingPublicizeEnabled.Text = "Publicize"; + CrossPatchingPublicizeEnabled.UseVisualStyleBackColor = true; + // + // groupBox3 + // + groupBox3.Controls.Add(CrossPatchingRunButton); + groupBox3.Controls.Add(textBox4); + groupBox3.Controls.Add(CrossPatchingBuildDirButton); + groupBox3.Controls.Add(textBox3); + groupBox3.Controls.Add(textBox1); + groupBox3.Controls.Add(textBox2); + groupBox3.Controls.Add(CrossPatchingMappingChooseButton); + groupBox3.Controls.Add(CrossPatchingOrigAssemblyButton); + groupBox3.Controls.Add(CrossMappingOutputChooseButton); + groupBox3.Location = new Point(13, 6); + groupBox3.Name = "groupBox3"; + groupBox3.Size = new Size(445, 350); + groupBox3.TabIndex = 21; + groupBox3.TabStop = false; + groupBox3.Text = "General"; + // + // CrossPatchingRunButton + // + CrossPatchingRunButton.Location = new Point(308, 310); + CrossPatchingRunButton.Name = "CrossPatchingRunButton"; + CrossPatchingRunButton.Size = new Size(112, 34); + CrossPatchingRunButton.TabIndex = 21; + CrossPatchingRunButton.Text = "Run"; + CrossPatchingRunButton.UseVisualStyleBackColor = true; + // + // textBox4 + // + textBox4.Location = new Point(6, 39); + textBox4.Name = "textBox4"; + textBox4.PlaceholderText = "Original Assembly"; + textBox4.ReadOnly = true; + textBox4.Size = new Size(296, 31); + textBox4.TabIndex = 13; + // + // CrossPatchingBuildDirButton + // + CrossPatchingBuildDirButton.Location = new Point(308, 73); + CrossPatchingBuildDirButton.Name = "CrossPatchingBuildDirButton"; + CrossPatchingBuildDirButton.Size = new Size(112, 34); + CrossPatchingBuildDirButton.TabIndex = 20; + CrossPatchingBuildDirButton.Text = "Choose"; + CrossPatchingBuildDirButton.UseVisualStyleBackColor = true; + // + // textBox3 + // + textBox3.Location = new Point(6, 113); + textBox3.Name = "textBox3"; + textBox3.PlaceholderText = "Output Directory"; + textBox3.ReadOnly = true; + textBox3.Size = new Size(296, 31); + textBox3.TabIndex = 14; + // + // textBox1 + // + textBox1.Location = new Point(6, 76); + textBox1.Name = "textBox1"; + textBox1.PlaceholderText = "VS build path including file name"; + textBox1.ReadOnly = true; + textBox1.Size = new Size(296, 31); + textBox1.TabIndex = 19; + // + // textBox2 + // + textBox2.Location = new Point(6, 150); + textBox2.Name = "textBox2"; + textBox2.PlaceholderText = "Mapping.json path"; + textBox2.ReadOnly = true; + textBox2.Size = new Size(296, 31); + textBox2.TabIndex = 15; + // + // CrossPatchingMappingChooseButton + // + CrossPatchingMappingChooseButton.Location = new Point(308, 147); + CrossPatchingMappingChooseButton.Name = "CrossPatchingMappingChooseButton"; + CrossPatchingMappingChooseButton.Size = new Size(112, 34); + CrossPatchingMappingChooseButton.TabIndex = 18; + CrossPatchingMappingChooseButton.Text = "Choose"; + CrossPatchingMappingChooseButton.UseVisualStyleBackColor = true; + // + // CrossPatchingOrigAssemblyButton + // + CrossPatchingOrigAssemblyButton.Location = new Point(308, 39); + CrossPatchingOrigAssemblyButton.Name = "CrossPatchingOrigAssemblyButton"; + CrossPatchingOrigAssemblyButton.Size = new Size(112, 34); + CrossPatchingOrigAssemblyButton.TabIndex = 16; + CrossPatchingOrigAssemblyButton.Text = "Choose"; + CrossPatchingOrigAssemblyButton.UseVisualStyleBackColor = true; + // + // CrossMappingOutputChooseButton + // + CrossMappingOutputChooseButton.Location = new Point(308, 110); + CrossMappingOutputChooseButton.Name = "CrossMappingOutputChooseButton"; + CrossMappingOutputChooseButton.Size = new Size(112, 34); + CrossMappingOutputChooseButton.TabIndex = 17; + CrossMappingOutputChooseButton.Text = "Choose"; + CrossMappingOutputChooseButton.UseVisualStyleBackColor = true; + // // SettingsTab // SettingsTab.BackColor = SystemColors.ControlDarkDark; @@ -1250,224 +1484,6 @@ partial class ReCodeItForm DebugLoggingCheckbox.UseVisualStyleBackColor = true; DebugLoggingCheckbox.CheckedChanged += DebugLoggingCheckbox_CheckedChanged; // - // CrossPatchingBuildDirButton - // - CrossPatchingBuildDirButton.Location = new Point(308, 73); - CrossPatchingBuildDirButton.Name = "CrossPatchingBuildDirButton"; - CrossPatchingBuildDirButton.Size = new Size(112, 34); - CrossPatchingBuildDirButton.TabIndex = 20; - CrossPatchingBuildDirButton.Text = "Choose"; - CrossPatchingBuildDirButton.UseVisualStyleBackColor = true; - // - // textBox1 - // - textBox1.Location = new Point(6, 76); - textBox1.Name = "textBox1"; - textBox1.PlaceholderText = "VS build path including file name"; - textBox1.ReadOnly = true; - textBox1.Size = new Size(296, 31); - textBox1.TabIndex = 19; - // - // CrossPatchingMappingChooseButton - // - CrossPatchingMappingChooseButton.Location = new Point(308, 147); - CrossPatchingMappingChooseButton.Name = "CrossPatchingMappingChooseButton"; - CrossPatchingMappingChooseButton.Size = new Size(112, 34); - CrossPatchingMappingChooseButton.TabIndex = 18; - CrossPatchingMappingChooseButton.Text = "Choose"; - CrossPatchingMappingChooseButton.UseVisualStyleBackColor = true; - // - // CrossMappingOutputChooseButton - // - CrossMappingOutputChooseButton.Location = new Point(308, 110); - CrossMappingOutputChooseButton.Name = "CrossMappingOutputChooseButton"; - CrossMappingOutputChooseButton.Size = new Size(112, 34); - CrossMappingOutputChooseButton.TabIndex = 17; - CrossMappingOutputChooseButton.Text = "Choose"; - CrossMappingOutputChooseButton.UseVisualStyleBackColor = true; - // - // CrossPatchingOrigAssemblyButton - // - CrossPatchingOrigAssemblyButton.Location = new Point(308, 39); - CrossPatchingOrigAssemblyButton.Name = "CrossPatchingOrigAssemblyButton"; - CrossPatchingOrigAssemblyButton.Size = new Size(112, 34); - CrossPatchingOrigAssemblyButton.TabIndex = 16; - CrossPatchingOrigAssemblyButton.Text = "Choose"; - CrossPatchingOrigAssemblyButton.UseVisualStyleBackColor = true; - // - // textBox2 - // - textBox2.Location = new Point(6, 150); - textBox2.Name = "textBox2"; - textBox2.PlaceholderText = "Mapping.json path"; - textBox2.ReadOnly = true; - textBox2.Size = new Size(296, 31); - textBox2.TabIndex = 15; - // - // textBox3 - // - textBox3.Location = new Point(6, 113); - textBox3.Name = "textBox3"; - textBox3.PlaceholderText = "Output Directory"; - textBox3.ReadOnly = true; - textBox3.Size = new Size(296, 31); - textBox3.TabIndex = 14; - // - // textBox4 - // - textBox4.Location = new Point(6, 39); - textBox4.Name = "textBox4"; - textBox4.PlaceholderText = "Original Assembly"; - textBox4.ReadOnly = true; - textBox4.Size = new Size(296, 31); - textBox4.TabIndex = 13; - // - // groupBox3 - // - groupBox3.Controls.Add(CrossPatchingRunButton); - groupBox3.Controls.Add(textBox4); - groupBox3.Controls.Add(CrossPatchingBuildDirButton); - groupBox3.Controls.Add(textBox3); - groupBox3.Controls.Add(textBox1); - groupBox3.Controls.Add(textBox2); - groupBox3.Controls.Add(CrossPatchingMappingChooseButton); - groupBox3.Controls.Add(CrossPatchingOrigAssemblyButton); - groupBox3.Controls.Add(CrossMappingOutputChooseButton); - groupBox3.Location = new Point(13, 6); - groupBox3.Name = "groupBox3"; - groupBox3.Size = new Size(445, 350); - groupBox3.TabIndex = 21; - groupBox3.TabStop = false; - groupBox3.Text = "General"; - // - // groupBox4 - // - groupBox4.Controls.Add(CrossPatcherUnsealEnabled); - groupBox4.Controls.Add(CrossPatchingPublicizeEnabled); - groupBox4.Location = new Point(490, 6); - groupBox4.Name = "groupBox4"; - groupBox4.Size = new Size(445, 350); - groupBox4.TabIndex = 22; - groupBox4.TabStop = false; - groupBox4.Text = "Patch Settings"; - // - // CrossPatcherUnsealEnabled - // - CrossPatcherUnsealEnabled.AutoSize = true; - CrossPatcherUnsealEnabled.Checked = true; - CrossPatcherUnsealEnabled.CheckState = CheckState.Checked; - CrossPatcherUnsealEnabled.Location = new Point(6, 65); - CrossPatcherUnsealEnabled.Name = "CrossPatcherUnsealEnabled"; - CrossPatcherUnsealEnabled.Size = new Size(90, 29); - CrossPatcherUnsealEnabled.TabIndex = 12; - CrossPatcherUnsealEnabled.Text = "Unseal"; - CrossPatcherUnsealEnabled.UseVisualStyleBackColor = true; - // - // CrossPatchingPublicizeEnabled - // - CrossPatchingPublicizeEnabled.AutoSize = true; - CrossPatchingPublicizeEnabled.Checked = true; - CrossPatchingPublicizeEnabled.CheckState = CheckState.Checked; - CrossPatchingPublicizeEnabled.Location = new Point(6, 30); - CrossPatchingPublicizeEnabled.Name = "CrossPatchingPublicizeEnabled"; - CrossPatchingPublicizeEnabled.Size = new Size(106, 29); - CrossPatchingPublicizeEnabled.TabIndex = 11; - CrossPatchingPublicizeEnabled.Text = "Publicize"; - CrossPatchingPublicizeEnabled.UseVisualStyleBackColor = true; - // - // CrossPatchingRunButton - // - CrossPatchingRunButton.Location = new Point(308, 310); - CrossPatchingRunButton.Name = "CrossPatchingRunButton"; - CrossPatchingRunButton.Size = new Size(112, 34); - CrossPatchingRunButton.TabIndex = 21; - CrossPatchingRunButton.Text = "Run"; - CrossPatchingRunButton.UseVisualStyleBackColor = true; - // - // RemapperUnsealCheckbox - // - this.RemapperUnsealCheckbox.AutoSize = true; - this.RemapperUnsealCheckbox.Checked = true; - this.RemapperUnsealCheckbox.CheckState = CheckState.Checked; - this.RemapperUnsealCheckbox.Location = new Point(581, 305); - this.RemapperUnsealCheckbox.Name = "RemapperUnsealCheckbox"; - this.RemapperUnsealCheckbox.Size = new Size(90, 29); - this.RemapperUnsealCheckbox.TabIndex = 25; - this.RemapperUnsealCheckbox.Text = "Unseal"; - this.RemapperUnsealCheckbox.UseVisualStyleBackColor = true; - // - // RenamePropertiesCheckbox - // - RenamePropertiesCheckbox.AutoSize = true; - RenamePropertiesCheckbox.Checked = true; - RenamePropertiesCheckbox.CheckState = CheckState.Checked; - RenamePropertiesCheckbox.Location = new Point(581, 235); - RenamePropertiesCheckbox.Name = "RenamePropertiesCheckbox"; - RenamePropertiesCheckbox.Size = new Size(186, 29); - RenamePropertiesCheckbox.TabIndex = 28; - RenamePropertiesCheckbox.Text = "Rename Properties"; - RenamePropertiesCheckbox.UseVisualStyleBackColor = true; - // - // RemapperPublicizeCheckbox - // - this.RemapperPublicizeCheckbox.AutoSize = true; - this.RemapperPublicizeCheckbox.Checked = true; - this.RemapperPublicizeCheckbox.CheckState = CheckState.Checked; - this.RemapperPublicizeCheckbox.Location = new Point(581, 270); - this.RemapperPublicizeCheckbox.Name = "RemapperPublicizeCheckbox"; - this.RemapperPublicizeCheckbox.Size = new Size(106, 29); - this.RemapperPublicizeCheckbox.TabIndex = 24; - this.RemapperPublicizeCheckbox.Text = "Publicize"; - this.RemapperPublicizeCheckbox.UseVisualStyleBackColor = true; - // - // OutputDirectoryButton - // - OutputDirectoryButton.Location = new Point(312, 104); - OutputDirectoryButton.Name = "OutputDirectoryButton"; - OutputDirectoryButton.Size = new Size(112, 34); - OutputDirectoryButton.TabIndex = 32; - OutputDirectoryButton.Text = "Choose"; - OutputDirectoryButton.UseVisualStyleBackColor = true; - // - // RenameFieldsCheckbox - // - RenameFieldsCheckbox.AutoSize = true; - RenameFieldsCheckbox.Checked = true; - RenameFieldsCheckbox.CheckState = CheckState.Checked; - RenameFieldsCheckbox.Location = new Point(581, 200); - RenameFieldsCheckbox.Name = "RenameFieldsCheckbox"; - RenameFieldsCheckbox.Size = new Size(151, 29); - RenameFieldsCheckbox.TabIndex = 26; - RenameFieldsCheckbox.Text = "Rename Fields"; - RenameFieldsCheckbox.UseVisualStyleBackColor = true; - // - // PickAssemblyPathButton - // - PickAssemblyPathButton.Location = new Point(313, 66); - PickAssemblyPathButton.Name = "PickAssemblyPathButton"; - PickAssemblyPathButton.Size = new Size(112, 34); - PickAssemblyPathButton.TabIndex = 31; - PickAssemblyPathButton.Text = "Choose"; - PickAssemblyPathButton.UseVisualStyleBackColor = true; - // - // RemapperOutputPathTextBox - // - this.RemapperOutputPathTextBox.Location = new Point(10, 106); - this.RemapperOutputPathTextBox.Name = "RemapperOutputPathTextBox"; - this.RemapperOutputPathTextBox.PlaceholderText = "Output Directory"; - this.RemapperOutputPathTextBox.ReadOnly = true; - this.RemapperOutputPathTextBox.Size = new Size(296, 31); - this.RemapperOutputPathTextBox.TabIndex = 29; - // - // RemapperAssemblyPathTextBox - // - this.RemapperAssemblyPathTextBox.Location = new Point(9, 69); - this.RemapperAssemblyPathTextBox.Name = "RemapperAssemblyPathTextBox"; - this.RemapperAssemblyPathTextBox.PlaceholderText = "Assembly Path (Including file name)"; - this.RemapperAssemblyPathTextBox.ReadOnly = true; - this.RemapperAssemblyPathTextBox.Size = new Size(296, 31); - this.RemapperAssemblyPathTextBox.TabIndex = 27; - // // ReCodeItForm // AutoScaleDimensions = new SizeF(10F, 25F); @@ -1501,13 +1517,13 @@ partial class ReCodeItForm ((System.ComponentModel.ISupportInitialize)AutoMapperMinLengthUpDown).EndInit(); ((System.ComponentModel.ISupportInitialize)AutoMapperRequiredMatchesUpDown).EndInit(); tabPage5.ResumeLayout(false); + groupBox4.ResumeLayout(false); + groupBox4.PerformLayout(); + groupBox3.ResumeLayout(false); + groupBox3.PerformLayout(); SettingsTab.ResumeLayout(false); groupBox2.ResumeLayout(false); groupBox2.PerformLayout(); - groupBox3.ResumeLayout(false); - groupBox3.PerformLayout(); - groupBox4.ResumeLayout(false); - groupBox4.PerformLayout(); ResumeLayout(false); } @@ -1637,4 +1653,9 @@ partial class ReCodeItForm private Button OutputDirectoryButton; private TextBox MappingPathTextBox; private Button PickAssemblyPathButton; + private CheckBox RemapperUseForceRename; + private CheckBox RemapperUnseal; + private CheckBox RemapperPublicicize; + private TextBox RemapperOutputDirectoryPath; + private TextBox TargetAssemblyPath; } diff --git a/RecodeItGUI/GUI/Main.cs b/RecodeItGUI/GUI/Main.cs index 0b2e802..f9666e3 100644 --- a/RecodeItGUI/GUI/Main.cs +++ b/RecodeItGUI/GUI/Main.cs @@ -18,6 +18,7 @@ public partial class ReCodeItForm : Form public ReCodeItForm() { InitializeComponent(); + DataProvider.LoadMappingFile(DataProvider.Settings.Remapper.MappingPath); PopulateDomainUpDowns(); RefreshSettingsPage(); RefreshAutoMapperPage(); @@ -27,6 +28,8 @@ public partial class ReCodeItForm : Form ReloadTreeView(this, EventArgs.Empty); } + #region MANUAL_REMAPPER + #region BUTTONS #region MAIN_BUTTONS @@ -50,7 +53,7 @@ public partial class ReCodeItForm : Form FailureReason = EFailureReason.None, NewTypeName = NewTypeName.Text, OriginalTypeName = OriginalTypeName.Text == string.Empty ? null : OriginalTypeName.Text, - UseForceRename = ForceRenameCheckbox.Checked, + UseForceRename = RemapperUseForceRename.Checked, SearchParams = new SearchParams { IsPublic = IsPublicUpDown.GetEnabled(), @@ -135,9 +138,9 @@ public partial class ReCodeItForm : Form { if (ReCodeItRemapper.IsRunning) { return; } - if (string.IsNullOrEmpty(DataProvider.Settings.AppSettings.AssemblyPath)) + if (string.IsNullOrEmpty(DataProvider.Settings.Remapper.AssemblyPath)) { - MessageBox.Show("Please go to the settings tab and load an assembly and select and output location", "Assembly not loaded"); + MessageBox.Show("Please select an assembly path", "Assembly not loaded"); return; } @@ -155,7 +158,7 @@ public partial class ReCodeItForm : Form MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { - DataProvider.SaveMapping(); + DataProvider.SaveMapping(DataProvider.Settings.Remapper.MappingPath); } } @@ -181,6 +184,37 @@ public partial class ReCodeItForm : Form } } + private void PickAssemblyPathButton_Click_1(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.Remapper.AssemblyPath = fDialog.FileName; + DataProvider.LoadAssemblyDefinition(fDialog.FileName); + TargetAssemblyPath.Text = fDialog.FileName; + } + } + + private void OutputDirectoryButton_Click_1(object sender, EventArgs e) + { + using FolderBrowserDialog fDialog = new(); + + fDialog.Description = "Select a directory"; + fDialog.ShowNewFolderButton = true; + + if (fDialog.ShowDialog() == DialogResult.OK) + { + DataProvider.Settings.Remapper.OutputPath = fDialog.SelectedPath; + RemapperOutputDirectoryPath.Text = fDialog.SelectedPath; + } + } + private void RunAutoMapButton_Click(object sender, EventArgs e) { AutoMapper.InitializeAutoMapping(); @@ -341,7 +375,7 @@ public partial class ReCodeItForm : Form private void RunAutoRemapButton_Click(object sender, EventArgs e) { - if (string.IsNullOrEmpty(DataProvider.Settings.AppSettings.AssemblyPath)) + if (string.IsNullOrEmpty(DataProvider.Settings.AutoMapper.AssemblyPath)) { MessageBox.Show("Please go to the settings tab and load an assembly and select and output location", "Assembly not loaded"); return; @@ -354,21 +388,23 @@ public partial class ReCodeItForm : Form #endregion BUTTONS + #endregion MANUAL_REMAPPER + #region SETTINGS_TAB public void RefreshSettingsPage() { - AssemblyPathTextBox.Text = DataProvider.Settings.AppSettings.AssemblyPath; - OutputPathTextBox.Text = DataProvider.Settings.AppSettings.OutputPath; - MappingPathTextBox.Text = DataProvider.Settings.AppSettings.MappingPath; - AssemblyPathTextBox.Text = DataProvider.Settings.AppSettings.NameMangledPath; - + // Settings page DebugLoggingCheckbox.Checked = DataProvider.Settings.AppSettings.Debug; SilentModeCheckbox.Checked = DataProvider.Settings.AppSettings.SilentMode; - RenameFieldsCheckbox.Checked = DataProvider.Settings.AppSettings.RenameFields; - RenamePropertiesCheckbox.Checked = DataProvider.Settings.AppSettings.RenameProperties; - PublicizeCheckbox.Checked = DataProvider.Settings.AppSettings.Publicize; - UnsealCheckbox.Checked = DataProvider.Settings.AppSettings.Unseal; + + // Remapper page + TargetAssemblyPath.Text = DataProvider.Settings.Remapper.AssemblyPath; + RemapperOutputDirectoryPath.Text = DataProvider.Settings.Remapper.OutputPath; + RenameFieldsCheckbox.Checked = DataProvider.Settings.Remapper.RenameFields; + RenamePropertiesCheckbox.Checked = DataProvider.Settings.Remapper.RenameProperties; + RemapperPublicicize.Checked = DataProvider.Settings.Remapper.Publicize; + RemapperUnseal.Checked = DataProvider.Settings.Remapper.Unseal; AutoMapperTypesExcludeBox.Items.Clear(); foreach (var method in DataProvider.Settings.AutoMapper.TypesToIgnore) @@ -376,44 +412,12 @@ public partial class ReCodeItForm : Form AutoMapperTypesExcludeBox.Items.Add(method); } - MaxMatchCountUpDown.Value = DataProvider.Settings.Remapper.MaxMatchCount; AutoMapperRequiredMatchesUpDown.Value = DataProvider.Settings.AutoMapper.RequiredMatches; AutoMapperMinLengthUpDown.Value = DataProvider.Settings.AutoMapper.MinLengthToMatch; } #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 @@ -430,23 +434,6 @@ public partial class ReCodeItForm : Form } } - private void PickNameMangledPathButton_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.NameMangledPath = fDialog.FileName; - DataProvider.LoadAssemblyDefinition(true); - AssemblyPathTextBox.Text = fDialog.FileName; - } - } - #endregion SETTINGS_BUTTONS #region CHECKBOXES @@ -477,13 +464,13 @@ public partial class ReCodeItForm : Form private void PublicizeCheckbox_CheckedChanged(object sender, EventArgs e) { - DataProvider.Settings.AppSettings.Publicize = PublicizeCheckbox.Checked; + DataProvider.Settings.Remapper.Publicize = PublicizeCheckbox.Checked; DataProvider.SaveAppSettings(); } private void UnsealCheckbox_CheckedChanged(object sender, EventArgs e) { - DataProvider.Settings.AppSettings.Unseal = UnsealCheckbox.Checked; + DataProvider.Settings.Remapper.Unseal = UnsealCheckbox.Checked; DataProvider.SaveAppSettings(); } @@ -491,12 +478,6 @@ public partial class ReCodeItForm : Form #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; @@ -515,7 +496,6 @@ public partial class ReCodeItForm : Form AutoMapperTokensBox.Items.Clear(); AutoMapperFPBox.Items.Clear(); - MaxMatchCountUpDown.Value = DataProvider.Settings.Remapper.MaxMatchCount; AutoMapperRequiredMatchesUpDown.Value = DataProvider.Settings.AutoMapper.RequiredMatches; AutoMapperSearchMethodsCheckBox.Checked = DataProvider.Settings.AutoMapper.SearchMethods; @@ -657,7 +637,7 @@ public partial class ReCodeItForm : Form // Check boxes - ForceRenameCheckbox.Checked = false; + RemapperUseForceRename.Checked = false; ConstructorCountEnabled.Checked = false; MethodCountEnabled.Checked = false; FieldCountEnabled.Checked = false; @@ -691,7 +671,7 @@ public partial class ReCodeItForm : Form NewTypeName.Text = remap.NewTypeName; OriginalTypeName.Text = remap.OriginalTypeName; - ForceRenameCheckbox.Checked = remap.UseForceRename; + RemapperUseForceRename.Checked = remap.UseForceRename; BaseClassIncludeTextFIeld.Text = remap.SearchParams.MatchBaseClass; BaseClassExcludeTextField.Text = remap.SearchParams.IgnoreBaseClass; @@ -788,9 +768,4 @@ public partial class ReCodeItForm : Form RemapTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(remap, this)); } } - - private void ForceRenameCheckbox_CheckedChanged(object sender, EventArgs e) - { - - } } \ No newline at end of file diff --git a/RecodeItGUI/Program.cs b/RecodeItGUI/Program.cs index f16c311..855c17a 100644 --- a/RecodeItGUI/Program.cs +++ b/RecodeItGUI/Program.cs @@ -12,7 +12,6 @@ internal static class Program private static void Main() { DataProvider.LoadAppSettings(); - DataProvider.LoadMappingFile(); // To customize application configuration such as set high DPI settings or default font, see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); diff --git a/RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs b/RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs index bd6cc4e..ebb758a 100644 --- a/RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs +++ b/RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs @@ -39,7 +39,7 @@ public class ReCodeItAutoMapper AllTypes = []; AlreadyChangedNames = []; - DataProvider.LoadAssemblyDefinition(); + DataProvider.LoadAssemblyDefinition(Settings.AssemblyPath); Error = false; FailureCount = 0; @@ -524,7 +524,7 @@ public class ReCodeItAutoMapper private void WriteChanges() { - var path = DataProvider.WriteAssemblyDefinition(); + var path = DataProvider.WriteAssemblyDefinition(Settings.OutputPath); var fieldCountMatchResult = MappingPairs.Where(x => x.AutoMappingResult == AutoMappingResult.Match_From_Property).Count(); var propertyCountMatchResult = MappingPairs.Where(x => x.AutoMappingResult == AutoMappingResult.Match_From_Property).Count(); diff --git a/RecodeItLib/Models/AppSettingsModel.cs b/RecodeItLib/Models/AppSettingsModel.cs index 4e2f912..ce8341d 100644 --- a/RecodeItLib/Models/AppSettingsModel.cs +++ b/RecodeItLib/Models/AppSettingsModel.cs @@ -7,7 +7,6 @@ public class Settings { public AppSettings AppSettings { get; set; } public RemapperSettings Remapper { get; set; } - public AutoMapperSettings AutoMapper { get; set; } } @@ -15,28 +14,32 @@ public class AppSettings { public bool Debug { get; set; } public bool SilentMode { get; set; } + + public bool RenameFields { get; set; } + public bool RenameProperties { get; set; } +} + +public class RemapperSettings +{ public string AssemblyPath { get; set; } - public string NameMangledPath { get; set; } public string OutputPath { get; set; } public string MappingPath { get; set; } + public bool RenameFields { get; set; } public bool RenameProperties { get; set; } public bool Publicize { get; set; } public bool Unseal { get; set; } } -public class RemapperSettings -{ - public int MaxMatchCount { get; set; } -} - public class AutoMapperSettings { + public string AssemblyPath { get; set; } + public string OutputPath { get; set; } public int RequiredMatches { get; set; } - public int MinLengthToMatch { get; set; } - public bool SearchMethods { get; set; } + public bool Publicize { get; set; } + public bool Unseal { get; set; } public List TypesToIgnore { get; set; } diff --git a/RecodeItLib/Remapper/ReCodeItRemapper.cs b/RecodeItLib/Remapper/ReCodeItRemapper.cs index d948d70..2985f2b 100644 --- a/RecodeItLib/Remapper/ReCodeItRemapper.cs +++ b/RecodeItLib/Remapper/ReCodeItRemapper.cs @@ -17,12 +17,14 @@ public class ReCodeItRemapper private static readonly Stopwatch Stopwatch = new(); + private RemapperSettings Settings => DataProvider.Settings.Remapper; + /// /// Start the remapping process /// public void InitializeRemap() { - DataProvider.LoadAssemblyDefinition(); + DataProvider.LoadAssemblyDefinition(Settings.AssemblyPath); IsRunning = true; DisplayBasicModuleInformation(); @@ -39,12 +41,12 @@ public class ReCodeItRemapper ChooseBestMatches(); // Dont publicize and unseal until after the remapping so we can use those as search parameters - if (!DataProvider.Settings.AppSettings.Publicize) + if (!Settings.Publicize) { Publicizer.Publicize(); } - if (!DataProvider.Settings.AppSettings.Unseal) + if (!Settings.Unseal) { Publicizer.Unseal(); } @@ -61,8 +63,8 @@ public class ReCodeItRemapper Logger.Log("-----------------------------------------------", ConsoleColor.Yellow); Logger.Log($"Starting remap...", ConsoleColor.Yellow); Logger.Log($"Module contains {DataProvider.ModuleDefinition.Types.Count} Types", ConsoleColor.Yellow); - Logger.Log($"Publicize: {DataProvider.Settings.AppSettings.Publicize}", ConsoleColor.Yellow); - Logger.Log($"Unseal: {DataProvider.Settings.AppSettings.Unseal}", ConsoleColor.Yellow); + Logger.Log($"Publicize: {Settings.Publicize}", ConsoleColor.Yellow); + Logger.Log($"Unseal: {Settings.Unseal}", ConsoleColor.Yellow); Logger.Log("-----------------------------------------------", ConsoleColor.Yellow); } @@ -203,8 +205,7 @@ public class ReCodeItRemapper if (scores.Count == 0) { return; } var filteredScores = scores - .OrderByDescending(score => score.Score) - .Take(DataProvider.Settings.Remapper.MaxMatchCount); + .OrderByDescending(score => score.Score); var highestScore = filteredScores.FirstOrDefault(); @@ -238,7 +239,7 @@ public class ReCodeItRemapper /// private void WriteAssembly() { - var path = DataProvider.WriteAssemblyDefinition(true); + var path = DataProvider.WriteAssemblyDefinition(Settings.OutputPath); Logger.Log("-----------------------------------------------", ConsoleColor.Green); Logger.Log($"Complete: Assembly written to `{path}`", ConsoleColor.Green); @@ -257,7 +258,7 @@ public class ReCodeItRemapper Logger.Log("Reloading assembly definitions", ConsoleColor.Yellow); Logger.Log("-----------------------------------------------", ConsoleColor.Yellow); - DataProvider.LoadAssemblyDefinition(); + DataProvider.LoadAssemblyDefinition(Settings.AssemblyPath); DataProvider.ScoringModels = []; Stopwatch.Reset(); diff --git a/RecodeItLib/Utils/DataProvider.cs b/RecodeItLib/Utils/DataProvider.cs index c9324d0..345816a 100644 --- a/RecodeItLib/Utils/DataProvider.cs +++ b/RecodeItLib/Utils/DataProvider.cs @@ -64,18 +64,14 @@ public static class DataProvider File.WriteAllText(settingsPath, jsonText); } - public static void LoadMappingFile(string path = "") + public static void LoadMappingFile(string path) { - if (!File.Exists(Settings.AppSettings.MappingPath)) + if (!File.Exists(path)) { - throw new InvalidOperationException($"path `{Settings.AppSettings.MappingPath}` does not exist..."); + Logger.Log($"Error loading mapping.json from `{path}`, First time running? Please select a mapping path"); } - var fpath = path == string.Empty - ? Settings.AppSettings.MappingPath - : path; - - var jsonText = File.ReadAllText(fpath); + var jsonText = File.ReadAllText(path); Remaps = []; ScoringModels = []; @@ -95,10 +91,10 @@ public static class DataProvider } } - Logger.Log($"Mapping file loaded from '{Settings.AppSettings.MappingPath}'"); + Logger.Log($"Mapping file loaded from '{path}' containing {Remaps.Count} remaps"); } - public static void SaveMapping() + public static void SaveMapping(string path) { JsonSerializerSettings settings = new() { @@ -108,14 +104,14 @@ public static class DataProvider var jsonText = JsonConvert.SerializeObject(Remaps, settings); - File.WriteAllText(Settings.AppSettings.MappingPath, jsonText); + File.WriteAllText(path, jsonText); } - public static void UpdateMapping() + public static void UpdateMapping(string path) { - if (!File.Exists(Settings.AppSettings.MappingPath)) + if (!File.Exists(path)) { - throw new FileNotFoundException($"path `{Settings.AppSettings.MappingPath}` does not exist..."); + throw new FileNotFoundException($"path `{path}` does not exist..."); } JsonSerializerSettings settings = new() @@ -143,20 +139,18 @@ public static class DataProvider var jsonText = JsonConvert.SerializeObject(Remaps, settings); - File.WriteAllText(Settings.AppSettings.MappingPath, jsonText); + File.WriteAllText(path, jsonText); - Logger.Log($"Mapping file saved to {Settings.AppSettings.MappingPath}"); + Logger.Log($"Mapping file saved to {path}"); } - public static void LoadAssemblyDefinition(bool nameMangled = false) + public static void LoadAssemblyDefinition(string path) { AssemblyDefinition = null; ModuleDefinition = null; DefaultAssemblyResolver resolver = new(); - var path = nameMangled == false ? Settings.AppSettings.AssemblyPath : Settings.AppSettings.NameMangledPath; - resolver.AddSearchDirectory(Path.GetDirectoryName(path)); // Replace with the correct path : (6/14) I have no idea what I met by that ReaderParameters parameters = new() { AssemblyResolver = resolver }; @@ -169,36 +163,26 @@ public static class DataProvider throw new NullReferenceException("AssemblyDefinition was null..."); } - var fileName = Path.GetFileName(Settings.AppSettings.AssemblyPath); + var fileName = Path.GetFileName(path); foreach (var module in assemblyDefinition.Modules.ToArray()) { if (module.Name == fileName) { - Logger.Log($"Module definition {module.Name} found'"); - - if (nameMangled) - { - NameMangledAssemblyDefinition = assemblyDefinition; - NameMangledModuleDefinition = module; - return; - } + Logger.Log($"Module definition {module.Name} found"); AssemblyDefinition = assemblyDefinition; ModuleDefinition = module; + return; } } - if (nameMangled) - { - } - - Logger.Log($"Module `{fileName}` not found in assembly {fileName}"); + Logger.Log($"Module {fileName} not found in assembly {fileName}"); } - public static string WriteAssemblyDefinition(bool updateMapping = false) + public static string WriteAssemblyDefinition(string path) { - var filename = Path.GetFileNameWithoutExtension(Settings.AppSettings.AssemblyPath); + var filename = Path.GetFileNameWithoutExtension(path); var strippedPath = Path.GetDirectoryName(filename); filename = $"{filename}-Remapped.dll"; @@ -207,11 +191,6 @@ public static class DataProvider AssemblyDefinition.Write(remappedPath); - if (updateMapping) - { - UpdateMapping(); - } - return remappedPath; } } \ No newline at end of file diff --git a/Templates/Settings.jsonc b/Templates/Settings.jsonc index bb70179..aa09b79 100644 --- a/Templates/Settings.jsonc +++ b/Templates/Settings.jsonc @@ -1,26 +1,25 @@ { "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 disable - "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 - + "SilentMode": true // The tool will stop and prompt you to continue on every remapping if disable }, "Remapper": { "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 - "MaxMatchCount": 5, // Max matches the remapper will return + "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 }, "AutoMapper": { "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 "RequiredMatches": 5, // Minimum number of times a member must have this name in the assembly before considering it for remapping "MinLengthToMatch": 7, // Minimum length of the field/property name in code before it will be considered for a rename "SearchMethods": true, // Will attempt to map types from method meta data and parameters + "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 "TypesToIgnore": [ // Any member name you want to ignore while iterating through the assembly