Initial CC work

This commit is contained in:
Cj 2024-06-18 17:35:31 -04:00
parent 0109e55281
commit 2ea1cda886
16 changed files with 566 additions and 262 deletions

View File

@ -31,6 +31,7 @@ partial class ReCodeItForm
TabPageRemapper = new TabPage();
RemapTreeView = new TreeView();
groupBox1 = new GroupBox();
LoadedMappingFilePath = new TextBox();
RemapperUseForceRename = new CheckBox();
RemapperUnseal = new CheckBox();
RemapperPublicicize = new CheckBox();
@ -38,13 +39,11 @@ partial class ReCodeItForm
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();
RunRemapButton = new Button();
Inclusions = new TabControl();
tabPage1 = new TabPage();
@ -142,20 +141,23 @@ partial class ReCodeItForm
tabPage5 = new TabPage();
groupBox4 = new GroupBox();
CrossPatchRunButton = new Button();
CrossMapperProjectBuildPath = new TextBox();
CrossPatchingProjectBuildDirButton = new Button();
CrossMapperProjTargetAssembly = new TextBox();
CrossMappingOutputChooseButton = new Button();
groupBox3 = new GroupBox();
CrossCompilerNewProjectButton = new Button();
CrossPatchRemapOutputButton = new Button();
CrossMapperReferencePath = new TextBox();
CrossPatchRemapButton = new Button();
CrossMapperOriginalAssembly = new TextBox();
CrossMapperProjectBuildPath = new TextBox();
CrossPatchingProjectBuildDirButton = new Button();
CrossPatchingOrigAssemblyButton = new Button();
CrossMapperProjTargetAssembly = new TextBox();
CrossMappingOutputChooseButton = new Button();
CrossPatchRemapButton = new Button();
SettingsTab = new TabPage();
groupBox2 = new GroupBox();
SilentModeCheckbox = new CheckBox();
DebugLoggingCheckbox = new CheckBox();
CrossCompilerProjectComboBox = new ComboBox();
label1 = new Label();
TabPageRemapper.SuspendLayout();
groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)ConstuctorCountUpDown).BeginInit();
@ -201,6 +203,7 @@ partial class ReCodeItForm
//
// groupBox1
//
groupBox1.Controls.Add(LoadedMappingFilePath);
groupBox1.Controls.Add(RemapperUseForceRename);
groupBox1.Controls.Add(RemapperUnseal);
groupBox1.Controls.Add(RemapperPublicicize);
@ -208,13 +211,11 @@ partial class ReCodeItForm
groupBox1.Controls.Add(TargetAssemblyPath);
groupBox1.Controls.Add(RenamePropertiesCheckbox);
groupBox1.Controls.Add(OutputDirectoryButton);
groupBox1.Controls.Add(EditRemapButton);
groupBox1.Controls.Add(PickAssemblyPathButton);
groupBox1.Controls.Add(ConstuctorCountUpDown);
groupBox1.Controls.Add(RenameFieldsCheckbox);
groupBox1.Controls.Add(ConstructorCountEnabled);
groupBox1.Controls.Add(LoadMappingFileButton);
groupBox1.Controls.Add(SaveMappingFileButton);
groupBox1.Controls.Add(RunRemapButton);
groupBox1.Controls.Add(Inclusions);
groupBox1.Controls.Add(NewTypeName);
@ -248,12 +249,22 @@ partial class ReCodeItForm
groupBox1.TabStop = false;
groupBox1.Text = "Remap Editor";
//
// LoadedMappingFilePath
//
LoadedMappingFilePath.BackColor = SystemColors.ScrollBar;
LoadedMappingFilePath.Location = new Point(448, 514);
LoadedMappingFilePath.Name = "LoadedMappingFilePath";
LoadedMappingFilePath.PlaceholderText = "Loaded Mapping File";
LoadedMappingFilePath.ReadOnly = true;
LoadedMappingFilePath.Size = new Size(297, 31);
LoadedMappingFilePath.TabIndex = 38;
//
// RemapperUseForceRename
//
RemapperUseForceRename.AutoSize = true;
RemapperUseForceRename.Checked = true;
RemapperUseForceRename.CheckState = CheckState.Checked;
RemapperUseForceRename.Location = new Point(580, 194);
RemapperUseForceRename.Location = new Point(577, 190);
RemapperUseForceRename.Name = "RemapperUseForceRename";
RemapperUseForceRename.Size = new Size(149, 29);
RemapperUseForceRename.TabIndex = 37;
@ -265,7 +276,7 @@ partial class ReCodeItForm
RemapperUnseal.AutoSize = true;
RemapperUnseal.Checked = true;
RemapperUnseal.CheckState = CheckState.Checked;
RemapperUnseal.Location = new Point(580, 334);
RemapperUnseal.Location = new Point(577, 330);
RemapperUnseal.Name = "RemapperUnseal";
RemapperUnseal.Size = new Size(90, 29);
RemapperUnseal.TabIndex = 36;
@ -277,7 +288,7 @@ partial class ReCodeItForm
RemapperPublicicize.AutoSize = true;
RemapperPublicicize.Checked = true;
RemapperPublicicize.CheckState = CheckState.Checked;
RemapperPublicicize.Location = new Point(580, 299);
RemapperPublicicize.Location = new Point(577, 295);
RemapperPublicicize.Name = "RemapperPublicicize";
RemapperPublicicize.Size = new Size(106, 29);
RemapperPublicicize.TabIndex = 35;
@ -287,7 +298,7 @@ partial class ReCodeItForm
// RemapperOutputDirectoryPath
//
RemapperOutputDirectoryPath.BackColor = SystemColors.ScrollBar;
RemapperOutputDirectoryPath.Location = new Point(10, 106);
RemapperOutputDirectoryPath.Location = new Point(10, 70);
RemapperOutputDirectoryPath.Name = "RemapperOutputDirectoryPath";
RemapperOutputDirectoryPath.PlaceholderText = "Output Directory";
RemapperOutputDirectoryPath.ReadOnly = true;
@ -297,7 +308,7 @@ partial class ReCodeItForm
// TargetAssemblyPath
//
TargetAssemblyPath.BackColor = SystemColors.ScrollBar;
TargetAssemblyPath.Location = new Point(10, 69);
TargetAssemblyPath.Location = new Point(10, 33);
TargetAssemblyPath.Name = "TargetAssemblyPath";
TargetAssemblyPath.PlaceholderText = "Target Assembly";
TargetAssemblyPath.ReadOnly = true;
@ -309,7 +320,7 @@ partial class ReCodeItForm
RenamePropertiesCheckbox.AutoSize = true;
RenamePropertiesCheckbox.Checked = true;
RenamePropertiesCheckbox.CheckState = CheckState.Checked;
RenamePropertiesCheckbox.Location = new Point(580, 264);
RenamePropertiesCheckbox.Location = new Point(577, 260);
RenamePropertiesCheckbox.Name = "RenamePropertiesCheckbox";
RenamePropertiesCheckbox.Size = new Size(186, 29);
RenamePropertiesCheckbox.TabIndex = 28;
@ -318,7 +329,7 @@ partial class ReCodeItForm
//
// OutputDirectoryButton
//
OutputDirectoryButton.Location = new Point(312, 104);
OutputDirectoryButton.Location = new Point(312, 68);
OutputDirectoryButton.Name = "OutputDirectoryButton";
OutputDirectoryButton.Size = new Size(112, 34);
OutputDirectoryButton.TabIndex = 32;
@ -326,20 +337,9 @@ partial class ReCodeItForm
OutputDirectoryButton.UseVisualStyleBackColor = true;
OutputDirectoryButton.Click += OutputDirectoryButton_Click_1;
//
// EditRemapButton
//
EditRemapButton.BackColor = SystemColors.ButtonShadow;
EditRemapButton.Location = new Point(580, 114);
EditRemapButton.Name = "EditRemapButton";
EditRemapButton.Size = new Size(168, 34);
EditRemapButton.TabIndex = 21;
EditRemapButton.Text = "Edit Remap";
EditRemapButton.UseVisualStyleBackColor = false;
EditRemapButton.Click += EditRemapButton_Click;
//
// PickAssemblyPathButton
//
PickAssemblyPathButton.Location = new Point(313, 66);
PickAssemblyPathButton.Location = new Point(313, 30);
PickAssemblyPathButton.Name = "PickAssemblyPathButton";
PickAssemblyPathButton.Size = new Size(112, 34);
PickAssemblyPathButton.TabIndex = 31;
@ -350,7 +350,7 @@ partial class ReCodeItForm
// ConstuctorCountUpDown
//
ConstuctorCountUpDown.BackColor = SystemColors.ScrollBar;
ConstuctorCountUpDown.Location = new Point(224, 295);
ConstuctorCountUpDown.Location = new Point(224, 259);
ConstuctorCountUpDown.Name = "ConstuctorCountUpDown";
ConstuctorCountUpDown.Size = new Size(55, 31);
ConstuctorCountUpDown.TabIndex = 19;
@ -360,7 +360,7 @@ partial class ReCodeItForm
RenameFieldsCheckbox.AutoSize = true;
RenameFieldsCheckbox.Checked = true;
RenameFieldsCheckbox.CheckState = CheckState.Checked;
RenameFieldsCheckbox.Location = new Point(580, 229);
RenameFieldsCheckbox.Location = new Point(577, 225);
RenameFieldsCheckbox.Name = "RenameFieldsCheckbox";
RenameFieldsCheckbox.Size = new Size(151, 29);
RenameFieldsCheckbox.TabIndex = 26;
@ -370,7 +370,7 @@ partial class ReCodeItForm
// ConstructorCountEnabled
//
ConstructorCountEnabled.AutoSize = true;
ConstructorCountEnabled.Location = new Point(287, 301);
ConstructorCountEnabled.Location = new Point(287, 265);
ConstructorCountEnabled.Name = "ConstructorCountEnabled";
ConstructorCountEnabled.Size = new Size(238, 29);
ConstructorCountEnabled.TabIndex = 20;
@ -380,7 +380,7 @@ partial class ReCodeItForm
// LoadMappingFileButton
//
LoadMappingFileButton.BackColor = SystemColors.ButtonShadow;
LoadMappingFileButton.Location = new Point(180, 28);
LoadMappingFileButton.Location = new Point(577, 30);
LoadMappingFileButton.Name = "LoadMappingFileButton";
LoadMappingFileButton.Size = new Size(168, 34);
LoadMappingFileButton.TabIndex = 18;
@ -388,21 +388,10 @@ partial class ReCodeItForm
LoadMappingFileButton.UseVisualStyleBackColor = false;
LoadMappingFileButton.Click += LoadMappingFileButton_Click;
//
// SaveMappingFileButton
//
SaveMappingFileButton.BackColor = SystemColors.ButtonShadow;
SaveMappingFileButton.Location = new Point(6, 28);
SaveMappingFileButton.Name = "SaveMappingFileButton";
SaveMappingFileButton.Size = new Size(168, 34);
SaveMappingFileButton.TabIndex = 17;
SaveMappingFileButton.Text = "Save Mapping File";
SaveMappingFileButton.UseVisualStyleBackColor = false;
SaveMappingFileButton.Click += SaveMappingFileButton_Click;
//
// RunRemapButton
//
RunRemapButton.BackColor = SystemColors.ButtonShadow;
RunRemapButton.Location = new Point(580, 154);
RunRemapButton.Location = new Point(577, 150);
RunRemapButton.Name = "RunRemapButton";
RunRemapButton.Size = new Size(168, 34);
RunRemapButton.TabIndex = 16;
@ -822,7 +811,7 @@ partial class ReCodeItForm
// NewTypeName
//
NewTypeName.BackColor = SystemColors.ScrollBar;
NewTypeName.Location = new Point(10, 147);
NewTypeName.Location = new Point(10, 111);
NewTypeName.Name = "NewTypeName";
NewTypeName.PlaceholderText = "New Name";
NewTypeName.Size = new Size(208, 31);
@ -831,7 +820,7 @@ partial class ReCodeItForm
// PropertyCountEnabled
//
PropertyCountEnabled.AutoSize = true;
PropertyCountEnabled.Location = new Point(287, 408);
PropertyCountEnabled.Location = new Point(287, 372);
PropertyCountEnabled.Name = "PropertyCountEnabled";
PropertyCountEnabled.Size = new Size(159, 29);
PropertyCountEnabled.TabIndex = 11;
@ -841,7 +830,7 @@ partial class ReCodeItForm
// IsInterfaceUpDown
//
IsInterfaceUpDown.BackColor = SystemColors.ScrollBar;
IsInterfaceUpDown.Location = new Point(10, 300);
IsInterfaceUpDown.Location = new Point(10, 264);
IsInterfaceUpDown.Name = "IsInterfaceUpDown";
IsInterfaceUpDown.Size = new Size(208, 31);
IsInterfaceUpDown.Sorted = true;
@ -851,7 +840,7 @@ partial class ReCodeItForm
// NestedTypeCountEnabled
//
NestedTypeCountEnabled.AutoSize = true;
NestedTypeCountEnabled.Location = new Point(287, 443);
NestedTypeCountEnabled.Location = new Point(287, 407);
NestedTypeCountEnabled.Name = "NestedTypeCountEnabled";
NestedTypeCountEnabled.Size = new Size(276, 29);
NestedTypeCountEnabled.TabIndex = 12;
@ -861,7 +850,7 @@ partial class ReCodeItForm
// PropertyCountUpDown
//
PropertyCountUpDown.BackColor = SystemColors.ScrollBar;
PropertyCountUpDown.Location = new Point(224, 408);
PropertyCountUpDown.Location = new Point(224, 372);
PropertyCountUpDown.Name = "PropertyCountUpDown";
PropertyCountUpDown.Size = new Size(55, 31);
PropertyCountUpDown.TabIndex = 5;
@ -869,7 +858,7 @@ partial class ReCodeItForm
// RemoveRemapButton
//
RemoveRemapButton.BackColor = SystemColors.ButtonShadow;
RemoveRemapButton.Location = new Point(580, 74);
RemoveRemapButton.Location = new Point(577, 111);
RemoveRemapButton.Name = "RemoveRemapButton";
RemoveRemapButton.Size = new Size(168, 34);
RemoveRemapButton.TabIndex = 2;
@ -880,7 +869,7 @@ partial class ReCodeItForm
// FieldCountUpDown
//
FieldCountUpDown.BackColor = SystemColors.ScrollBar;
FieldCountUpDown.Location = new Point(224, 370);
FieldCountUpDown.Location = new Point(224, 334);
FieldCountUpDown.Name = "FieldCountUpDown";
FieldCountUpDown.Size = new Size(55, 31);
FieldCountUpDown.TabIndex = 3;
@ -888,7 +877,7 @@ partial class ReCodeItForm
// IsPublicUpDown
//
IsPublicUpDown.BackColor = SystemColors.ScrollBar;
IsPublicUpDown.Location = new Point(10, 224);
IsPublicUpDown.Location = new Point(10, 188);
IsPublicUpDown.Name = "IsPublicUpDown";
IsPublicUpDown.Size = new Size(208, 31);
IsPublicUpDown.Sorted = true;
@ -898,7 +887,7 @@ partial class ReCodeItForm
// FieldCountEnabled
//
FieldCountEnabled.AutoSize = true;
FieldCountEnabled.Location = new Point(287, 373);
FieldCountEnabled.Location = new Point(287, 337);
FieldCountEnabled.Name = "FieldCountEnabled";
FieldCountEnabled.Size = new Size(128, 29);
FieldCountEnabled.TabIndex = 13;
@ -908,7 +897,7 @@ partial class ReCodeItForm
// NestedTypeParentName
//
NestedTypeParentName.BackColor = SystemColors.ScrollBar;
NestedTypeParentName.Location = new Point(224, 262);
NestedTypeParentName.Location = new Point(224, 226);
NestedTypeParentName.Name = "NestedTypeParentName";
NestedTypeParentName.PlaceholderText = "Nested Type Parent Name";
NestedTypeParentName.Size = new Size(208, 31);
@ -917,7 +906,7 @@ partial class ReCodeItForm
// MethodCountUpDown
//
MethodCountUpDown.BackColor = SystemColors.ScrollBar;
MethodCountUpDown.Location = new Point(224, 332);
MethodCountUpDown.Location = new Point(224, 296);
MethodCountUpDown.Name = "MethodCountUpDown";
MethodCountUpDown.Size = new Size(55, 31);
MethodCountUpDown.TabIndex = 6;
@ -925,7 +914,7 @@ partial class ReCodeItForm
// IsAbstractUpDown
//
IsAbstractUpDown.BackColor = SystemColors.ScrollBar;
IsAbstractUpDown.Location = new Point(10, 261);
IsAbstractUpDown.Location = new Point(10, 225);
IsAbstractUpDown.Name = "IsAbstractUpDown";
IsAbstractUpDown.Size = new Size(208, 31);
IsAbstractUpDown.Sorted = true;
@ -935,7 +924,7 @@ partial class ReCodeItForm
// BaseClassIncludeTextFIeld
//
BaseClassIncludeTextFIeld.BackColor = SystemColors.ScrollBar;
BaseClassIncludeTextFIeld.Location = new Point(224, 184);
BaseClassIncludeTextFIeld.Location = new Point(224, 148);
BaseClassIncludeTextFIeld.Name = "BaseClassIncludeTextFIeld";
BaseClassIncludeTextFIeld.PlaceholderText = "Include Base Class";
BaseClassIncludeTextFIeld.Size = new Size(208, 31);
@ -944,7 +933,7 @@ partial class ReCodeItForm
// OriginalTypeName
//
OriginalTypeName.BackColor = SystemColors.ScrollBar;
OriginalTypeName.Location = new Point(224, 147);
OriginalTypeName.Location = new Point(224, 111);
OriginalTypeName.Name = "OriginalTypeName";
OriginalTypeName.PlaceholderText = "Original Name";
OriginalTypeName.Size = new Size(208, 31);
@ -953,7 +942,7 @@ partial class ReCodeItForm
// HasGenericParametersUpDown
//
HasGenericParametersUpDown.BackColor = SystemColors.ScrollBar;
HasGenericParametersUpDown.Location = new Point(10, 483);
HasGenericParametersUpDown.Location = new Point(10, 447);
HasGenericParametersUpDown.Name = "HasGenericParametersUpDown";
HasGenericParametersUpDown.Size = new Size(208, 31);
HasGenericParametersUpDown.Sorted = true;
@ -963,7 +952,7 @@ partial class ReCodeItForm
// IsEnumUpDown
//
IsEnumUpDown.BackColor = SystemColors.ScrollBar;
IsEnumUpDown.Location = new Point(10, 372);
IsEnumUpDown.Location = new Point(10, 336);
IsEnumUpDown.Name = "IsEnumUpDown";
IsEnumUpDown.Size = new Size(208, 31);
IsEnumUpDown.Sorted = true;
@ -973,7 +962,7 @@ partial class ReCodeItForm
// NestedTypeCountUpDown
//
NestedTypeCountUpDown.BackColor = SystemColors.ScrollBar;
NestedTypeCountUpDown.Location = new Point(224, 446);
NestedTypeCountUpDown.Location = new Point(224, 410);
NestedTypeCountUpDown.Name = "NestedTypeCountUpDown";
NestedTypeCountUpDown.Size = new Size(55, 31);
NestedTypeCountUpDown.TabIndex = 4;
@ -981,18 +970,18 @@ partial class ReCodeItForm
// SaveRemapButton
//
SaveRemapButton.BackColor = SystemColors.ButtonShadow;
SaveRemapButton.Location = new Point(580, 33);
SaveRemapButton.Location = new Point(577, 70);
SaveRemapButton.Name = "SaveRemapButton";
SaveRemapButton.Size = new Size(168, 34);
SaveRemapButton.TabIndex = 4;
SaveRemapButton.Text = "Save Remap";
SaveRemapButton.Text = "Add Remap";
SaveRemapButton.UseVisualStyleBackColor = false;
SaveRemapButton.Click += AddRemapButton_Click;
//
// IsDerivedUpDown
//
IsDerivedUpDown.BackColor = SystemColors.ScrollBar;
IsDerivedUpDown.Location = new Point(10, 446);
IsDerivedUpDown.Location = new Point(10, 410);
IsDerivedUpDown.Name = "IsDerivedUpDown";
IsDerivedUpDown.Size = new Size(208, 31);
IsDerivedUpDown.Sorted = true;
@ -1002,7 +991,7 @@ partial class ReCodeItForm
// IsNestedUpDown
//
IsNestedUpDown.BackColor = SystemColors.ScrollBar;
IsNestedUpDown.Location = new Point(10, 185);
IsNestedUpDown.Location = new Point(10, 149);
IsNestedUpDown.Name = "IsNestedUpDown";
IsNestedUpDown.Size = new Size(208, 31);
IsNestedUpDown.Sorted = true;
@ -1012,7 +1001,7 @@ partial class ReCodeItForm
// HasAttributeUpDown
//
HasAttributeUpDown.BackColor = SystemColors.ScrollBar;
HasAttributeUpDown.Location = new Point(10, 409);
HasAttributeUpDown.Location = new Point(10, 373);
HasAttributeUpDown.Name = "HasAttributeUpDown";
HasAttributeUpDown.Size = new Size(208, 31);
HasAttributeUpDown.Sorted = true;
@ -1022,7 +1011,7 @@ partial class ReCodeItForm
// BaseClassExcludeTextField
//
BaseClassExcludeTextField.BackColor = SystemColors.ScrollBar;
BaseClassExcludeTextField.Location = new Point(224, 224);
BaseClassExcludeTextField.Location = new Point(224, 188);
BaseClassExcludeTextField.Name = "BaseClassExcludeTextField";
BaseClassExcludeTextField.PlaceholderText = "Exclude Base Class";
BaseClassExcludeTextField.Size = new Size(208, 31);
@ -1031,7 +1020,7 @@ partial class ReCodeItForm
// MethodCountEnabled
//
MethodCountEnabled.AutoSize = true;
MethodCountEnabled.Location = new Point(287, 338);
MethodCountEnabled.Location = new Point(287, 302);
MethodCountEnabled.Name = "MethodCountEnabled";
MethodCountEnabled.Size = new Size(154, 29);
MethodCountEnabled.TabIndex = 14;
@ -1041,7 +1030,7 @@ partial class ReCodeItForm
// IsSealedUpDown
//
IsSealedUpDown.BackColor = SystemColors.ScrollBar;
IsSealedUpDown.Location = new Point(10, 335);
IsSealedUpDown.Location = new Point(10, 299);
IsSealedUpDown.Name = "IsSealedUpDown";
IsSealedUpDown.Size = new Size(208, 31);
IsSealedUpDown.Sorted = true;
@ -1408,90 +1397,65 @@ partial class ReCodeItForm
//
tabPage5.BackColor = SystemColors.ControlDarkDark;
tabPage5.Controls.Add(groupBox4);
tabPage5.Controls.Add(groupBox3);
tabPage5.Location = new Point(4, 34);
tabPage5.Name = "tabPage5";
tabPage5.Padding = new Padding(3);
tabPage5.Size = new Size(1336, 953);
tabPage5.TabIndex = 4;
tabPage5.Text = "Cross Patching";
tabPage5.Text = "Cross Compiler";
tabPage5.Click += tabPage5_Click;
//
// groupBox4
//
groupBox4.Controls.Add(CrossPatchRunButton);
groupBox4.Controls.Add(CrossMapperProjectBuildPath);
groupBox4.Controls.Add(CrossPatchingProjectBuildDirButton);
groupBox4.Controls.Add(CrossMapperProjTargetAssembly);
groupBox4.Controls.Add(CrossMappingOutputChooseButton);
groupBox4.Location = new Point(13, 174);
groupBox4.Controls.Add(groupBox3);
groupBox4.Controls.Add(CrossPatchRemapButton);
groupBox4.Location = new Point(13, 18);
groupBox4.Name = "groupBox4";
groupBox4.Size = new Size(631, 151);
groupBox4.Size = new Size(1273, 901);
groupBox4.TabIndex = 22;
groupBox4.TabStop = false;
groupBox4.Text = "Reverse Patch";
groupBox4.Text = "Cross Compiler";
//
// CrossPatchRunButton
//
CrossPatchRunButton.Location = new Point(475, 104);
CrossPatchRunButton.Location = new Point(349, 323);
CrossPatchRunButton.Name = "CrossPatchRunButton";
CrossPatchRunButton.Size = new Size(150, 34);
CrossPatchRunButton.TabIndex = 24;
CrossPatchRunButton.Text = "Reverse Patch";
CrossPatchRunButton.Text = "Compile Project";
CrossPatchRunButton.UseVisualStyleBackColor = true;
CrossPatchRunButton.Click += CrossPatchRunButton_Click;
//
// CrossMapperProjectBuildPath
//
CrossMapperProjectBuildPath.Location = new Point(6, 30);
CrossMapperProjectBuildPath.Name = "CrossMapperProjectBuildPath";
CrossMapperProjectBuildPath.PlaceholderText = "Input Assembly that was built against the remap assembly";
CrossMapperProjectBuildPath.ReadOnly = true;
CrossMapperProjectBuildPath.Size = new Size(501, 31);
CrossMapperProjectBuildPath.TabIndex = 15;
//
// CrossPatchingProjectBuildDirButton
//
CrossPatchingProjectBuildDirButton.Location = new Point(513, 27);
CrossPatchingProjectBuildDirButton.Name = "CrossPatchingProjectBuildDirButton";
CrossPatchingProjectBuildDirButton.Size = new Size(112, 34);
CrossPatchingProjectBuildDirButton.TabIndex = 20;
CrossPatchingProjectBuildDirButton.Text = "Choose";
CrossPatchingProjectBuildDirButton.UseVisualStyleBackColor = true;
CrossPatchingProjectBuildDirButton.Click += CrossPatchingProjectBuildDirButton_Click;
//
// CrossMapperProjTargetAssembly
//
CrossMapperProjTargetAssembly.Location = new Point(6, 67);
CrossMapperProjTargetAssembly.Name = "CrossMapperProjTargetAssembly";
CrossMapperProjTargetAssembly.PlaceholderText = "Output directory";
CrossMapperProjTargetAssembly.ReadOnly = true;
CrossMapperProjTargetAssembly.Size = new Size(501, 31);
CrossMapperProjTargetAssembly.TabIndex = 19;
//
// CrossMappingOutputChooseButton
//
CrossMappingOutputChooseButton.Location = new Point(513, 66);
CrossMappingOutputChooseButton.Name = "CrossMappingOutputChooseButton";
CrossMappingOutputChooseButton.Size = new Size(112, 34);
CrossMappingOutputChooseButton.TabIndex = 17;
CrossMappingOutputChooseButton.Text = "Choose";
CrossMappingOutputChooseButton.UseVisualStyleBackColor = true;
CrossMappingOutputChooseButton.Click += CrossMappingOutputChooseButton_Click;
//
// groupBox3
//
groupBox3.Controls.Add(label1);
groupBox3.Controls.Add(CrossCompilerProjectComboBox);
groupBox3.Controls.Add(CrossCompilerNewProjectButton);
groupBox3.Controls.Add(CrossPatchRemapOutputButton);
groupBox3.Controls.Add(CrossMapperReferencePath);
groupBox3.Controls.Add(CrossPatchRemapButton);
groupBox3.Controls.Add(CrossMapperOriginalAssembly);
groupBox3.Controls.Add(CrossMapperProjectBuildPath);
groupBox3.Controls.Add(CrossPatchingProjectBuildDirButton);
groupBox3.Controls.Add(CrossPatchingOrigAssemblyButton);
groupBox3.Location = new Point(13, 6);
groupBox3.Controls.Add(CrossMapperProjTargetAssembly);
groupBox3.Controls.Add(CrossMappingOutputChooseButton);
groupBox3.Location = new Point(6, 30);
groupBox3.Name = "groupBox3";
groupBox3.Size = new Size(631, 162);
groupBox3.Size = new Size(631, 287);
groupBox3.TabIndex = 21;
groupBox3.TabStop = false;
groupBox3.Text = "Remap";
groupBox3.Text = "ReCodeIt Proj Settings";
//
// CrossCompilerNewProjectButton
//
CrossCompilerNewProjectButton.Location = new Point(475, 238);
CrossCompilerNewProjectButton.Name = "CrossCompilerNewProjectButton";
CrossCompilerNewProjectButton.Size = new Size(150, 34);
CrossCompilerNewProjectButton.TabIndex = 25;
CrossCompilerNewProjectButton.Text = "Create New";
CrossCompilerNewProjectButton.UseVisualStyleBackColor = true;
CrossCompilerNewProjectButton.Click += CrossCompilerNewProjectButton_Click;
//
// CrossPatchRemapOutputButton
//
@ -1512,16 +1476,6 @@ partial class ReCodeItForm
CrossMapperReferencePath.Size = new Size(501, 31);
CrossMapperReferencePath.TabIndex = 14;
//
// CrossPatchRemapButton
//
CrossPatchRemapButton.Location = new Point(513, 115);
CrossPatchRemapButton.Name = "CrossPatchRemapButton";
CrossPatchRemapButton.Size = new Size(112, 34);
CrossPatchRemapButton.TabIndex = 21;
CrossPatchRemapButton.Text = "Remap";
CrossPatchRemapButton.UseVisualStyleBackColor = true;
CrossPatchRemapButton.Click += CrossPatchRemapButton_Click;
//
// CrossMapperOriginalAssembly
//
CrossMapperOriginalAssembly.Location = new Point(6, 39);
@ -1531,6 +1485,25 @@ partial class ReCodeItForm
CrossMapperOriginalAssembly.Size = new Size(501, 31);
CrossMapperOriginalAssembly.TabIndex = 13;
//
// CrossMapperProjectBuildPath
//
CrossMapperProjectBuildPath.Location = new Point(6, 114);
CrossMapperProjectBuildPath.Name = "CrossMapperProjectBuildPath";
CrossMapperProjectBuildPath.PlaceholderText = "Visual studio solution directory";
CrossMapperProjectBuildPath.ReadOnly = true;
CrossMapperProjectBuildPath.Size = new Size(501, 31);
CrossMapperProjectBuildPath.TabIndex = 15;
//
// CrossPatchingProjectBuildDirButton
//
CrossPatchingProjectBuildDirButton.Location = new Point(513, 111);
CrossPatchingProjectBuildDirButton.Name = "CrossPatchingProjectBuildDirButton";
CrossPatchingProjectBuildDirButton.Size = new Size(112, 34);
CrossPatchingProjectBuildDirButton.TabIndex = 20;
CrossPatchingProjectBuildDirButton.Text = "Choose";
CrossPatchingProjectBuildDirButton.UseVisualStyleBackColor = true;
CrossPatchingProjectBuildDirButton.Click += CrossPatchingProjectBuildDirButton_Click;
//
// CrossPatchingOrigAssemblyButton
//
CrossPatchingOrigAssemblyButton.Location = new Point(513, 37);
@ -1541,6 +1514,35 @@ partial class ReCodeItForm
CrossPatchingOrigAssemblyButton.UseVisualStyleBackColor = true;
CrossPatchingOrigAssemblyButton.Click += CrossPatchingOrigAssemblyButton_Click;
//
// CrossMapperProjTargetAssembly
//
CrossMapperProjTargetAssembly.Location = new Point(6, 151);
CrossMapperProjTargetAssembly.Name = "CrossMapperProjTargetAssembly";
CrossMapperProjTargetAssembly.PlaceholderText = "Build Directory";
CrossMapperProjTargetAssembly.ReadOnly = true;
CrossMapperProjTargetAssembly.Size = new Size(501, 31);
CrossMapperProjTargetAssembly.TabIndex = 19;
//
// CrossMappingOutputChooseButton
//
CrossMappingOutputChooseButton.Location = new Point(513, 150);
CrossMappingOutputChooseButton.Name = "CrossMappingOutputChooseButton";
CrossMappingOutputChooseButton.Size = new Size(112, 34);
CrossMappingOutputChooseButton.TabIndex = 17;
CrossMappingOutputChooseButton.Text = "Choose";
CrossMappingOutputChooseButton.UseVisualStyleBackColor = true;
CrossMappingOutputChooseButton.Click += CrossMappingOutputChooseButton_Click;
//
// CrossPatchRemapButton
//
CrossPatchRemapButton.Location = new Point(12, 323);
CrossPatchRemapButton.Name = "CrossPatchRemapButton";
CrossPatchRemapButton.Size = new Size(316, 34);
CrossPatchRemapButton.TabIndex = 21;
CrossPatchRemapButton.Text = "Generate Remapped Reference";
CrossPatchRemapButton.UseVisualStyleBackColor = true;
CrossPatchRemapButton.Click += CrossPatchRemapButton_Click;
//
// SettingsTab
//
SettingsTab.BackColor = SystemColors.ControlDarkDark;
@ -1586,6 +1588,24 @@ partial class ReCodeItForm
DebugLoggingCheckbox.UseVisualStyleBackColor = true;
DebugLoggingCheckbox.CheckedChanged += DebugLoggingCheckbox_CheckedChanged;
//
// CrossCompilerProjectComboBox
//
CrossCompilerProjectComboBox.FormattingEnabled = true;
CrossCompilerProjectComboBox.Location = new Point(6, 238);
CrossCompilerProjectComboBox.Name = "CrossCompilerProjectComboBox";
CrossCompilerProjectComboBox.Size = new Size(194, 33);
CrossCompilerProjectComboBox.TabIndex = 26;
CrossCompilerProjectComboBox.SelectedIndexChanged += CrossCompilerProjectComboBox_SelectedIndexChanged;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(206, 243);
label1.Name = "label1";
label1.Size = new Size(150, 25);
label1.TabIndex = 27;
label1.Text = "Available Projects";
//
// ReCodeItForm
//
AutoScaleDimensions = new SizeF(10F, 25F);
@ -1620,7 +1640,6 @@ partial class ReCodeItForm
((System.ComponentModel.ISupportInitialize)AutoMapperRequiredMatchesUpDown).EndInit();
tabPage5.ResumeLayout(false);
groupBox4.ResumeLayout(false);
groupBox4.PerformLayout();
groupBox3.ResumeLayout(false);
groupBox3.PerformLayout();
SettingsTab.ResumeLayout(false);
@ -1695,7 +1714,6 @@ partial class ReCodeItForm
private CheckBox NestedTypeCountEnabled;
private DomainUpDown IsInterfaceUpDown;
private TreeView RemapTreeView;
private Button SaveMappingFileButton;
private Button RunRemapButton;
private Button LoadMappingFileButton;
private NumericUpDown ConstuctorCountUpDown;
@ -1706,7 +1724,6 @@ partial class ReCodeItForm
private GroupBox groupBox2;
private CheckBox SilentModeCheckbox;
private CheckBox DebugLoggingCheckbox;
private Button EditRemapButton;
private TabPage AutoMapperTab;
private TextBox AutoMapperTypesToIgnoreTextField;
private Button AutoMapperExcludeTypesRemoveButton;
@ -1767,4 +1784,8 @@ partial class ReCodeItForm
private Button CrossPatchRemapOutputButton;
private Button CrossPatchRunButton;
private GroupBox groupBox4;
private TextBox LoadedMappingFilePath;
private Button CrossCompilerNewProjectButton;
private ComboBox CrossCompilerProjectComboBox;
private Label label1;
}

View File

@ -1,8 +1,9 @@
using ReCodeIt.AutoMapper;
using ReCodeIt.CrossPatcher;
using ReCodeIt.Enums;
using ReCodeIt.Models;
using ReCodeIt.ReMapper;
using ReCodeIt.Utils;
using ReCodeItLib.AutoMapper;
namespace ReCodeIt.GUI;
@ -11,6 +12,8 @@ public partial class ReCodeItForm : Form
public static ReCodeItRemapper Remapper { get; private set; } = new();
public static ReCodeItAutoMapper AutoMapper { get; private set; } = new();
public static ReCodeItCrossCompiler CrossPatcher { get; private set; } = new();
private RemapModel CurrentRemap { get; set; }
private int _selectedRemapTreeIndex = 0;
@ -19,6 +22,7 @@ public partial class ReCodeItForm : Form
{
InitializeComponent();
DataProvider.LoadMappingFile(DataProvider.Settings.Remapper.MappingPath);
LoadedMappingFilePath.Text = DataProvider.Settings.Remapper.MappingPath;
PopulateDomainUpDowns();
RefreshSettingsPage();
RefreshAutoMapperPage();
@ -97,7 +101,7 @@ public partial class ReCodeItForm : Form
};
var existingRemap = DataProvider.Remaps
.Where(remap => remap.NewTypeName == NewTypeName.Text)
.Where(remap => remap.NewTypeName == newRemap.NewTypeName)
.FirstOrDefault();
// Handle overwriting an existing remap
@ -111,6 +115,8 @@ public partial class ReCodeItForm : Form
DataProvider.Remaps.Insert(index, newRemap);
RemapTreeView.Nodes.Insert(index, GUIHelpers.GenerateTreeNode(newRemap, this));
DataProvider.SaveMapping();
CurrentRemap = existingRemap;
ResetAll();
@ -120,6 +126,7 @@ public partial class ReCodeItForm : Form
CurrentRemap = newRemap;
RemapTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(newRemap, this));
DataProvider.Remaps.Add(newRemap);
DataProvider.SaveMapping();
ResetAll();
}
@ -128,11 +135,13 @@ public partial class ReCodeItForm : Form
{
DataProvider.Remaps?.RemoveAt(RemapTreeView.SelectedNode.Index);
RemapTreeView.SelectedNode?.Remove();
DataProvider.SaveMapping();
}
private void EditRemapButton_Click(object sender, EventArgs e)
{
EditSelectedRemap(this, null);
DataProvider.SaveMapping();
}
private void RunRemapButton_Click(object sender, EventArgs e)
@ -147,7 +156,9 @@ public partial class ReCodeItForm : Form
Console.Clear();
Remapper.InitializeRemap();
var settings = DataProvider.Settings;
Remapper.InitializeRemap(settings.Remapper.AssemblyPath, settings.Remapper.OutputPath);
}
private void SaveMappingFileButton_Click(object sender, EventArgs e)
@ -159,7 +170,7 @@ public partial class ReCodeItForm : Form
MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button2) == DialogResult.Yes)
{
DataProvider.SaveMapping(DataProvider.Settings.Remapper.MappingPath);
DataProvider.SaveMapping();
}
}
@ -171,6 +182,10 @@ public partial class ReCodeItForm : Form
if (result == string.Empty) { return; }
DataProvider.LoadMappingFile(result);
DataProvider.Settings.Remapper.MappingPath = result;
DataProvider.SaveAppSettings();
LoadedMappingFilePath.Text = result;
RemapTreeView.Nodes.Clear();
@ -395,26 +410,6 @@ public partial class ReCodeItForm : Form
RemapperUnseal.Checked = DataProvider.Settings.Remapper.MappingSettings.Unseal;
}
#region SETTINGS_BUTTONS
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)
@ -639,7 +634,7 @@ public partial class ReCodeItForm : Form
#endregion AUTOMAPPER
#region CROSSPATCHER
#region CROSS_COMPILER
/// <summary>
/// Remapper Input
@ -653,7 +648,7 @@ public partial class ReCodeItForm : Form
if (result != string.Empty)
{
DataProvider.Settings.CrossPatching.OriginalAssemblyPath = result;
DataProvider.Settings.CrossCompiler.OriginalAssemblyPath = result;
CrossMapperOriginalAssembly.Text = result;
DataProvider.SaveAppSettings();
}
@ -671,7 +666,7 @@ public partial class ReCodeItForm : Form
if (result != string.Empty)
{
DataProvider.Settings.CrossPatching.RemappedOutput = result;
DataProvider.Settings.CrossCompiler.RemappedOutput = result;
CrossMapperReferencePath.Text = result;
DataProvider.SaveAppSettings();
}
@ -684,12 +679,11 @@ public partial class ReCodeItForm : Form
/// <param name="e"></param>
private void CrossPatchingProjectBuildDirButton_Click(object sender, EventArgs e)
{
var result = GUIHelpers.OpenFileDialog("Select the assembly that referenced the remapped dll",
"DLL Files (*.dll)|*.dll|All Files (*.*)|*.*");
var result = GUIHelpers.OpenFolderDialog("Select your visual studio solution directory");
if (result != string.Empty)
{
DataProvider.Settings.CrossPatching.ReversePatchInputPath = result;
DataProvider.Settings.CrossCompiler.VisualStudioSolutionDirectory = result;
CrossMapperProjectBuildPath.Text = result;
DataProvider.SaveAppSettings();
}
@ -702,12 +696,11 @@ public partial class ReCodeItForm : Form
/// <param name="e"></param>
private void CrossMappingOutputChooseButton_Click(object sender, EventArgs e)
{
var result = GUIHelpers.OpenFileDialog("Output location of the final unmapped dll",
"DLL Files (*.dll)|*.dll|All Files (*.*)|*.*");
var result = GUIHelpers.OpenFolderDialog("Select your final build directory");
if (result != string.Empty)
{
DataProvider.Settings.CrossPatching.ReversePatchOutputPath = result;
DataProvider.Settings.CrossCompiler.BuildDirectory = result;
CrossMapperProjTargetAssembly.Text = result;
DataProvider.SaveAppSettings();
}
@ -715,21 +708,32 @@ public partial class ReCodeItForm : Form
private void CrossPatchRemapButton_Click(object sender, EventArgs e)
{
CrossPatcher.StartRemap();
}
private void CrossPatchRunButton_Click(object sender, EventArgs e)
{
CrossPatcher.StartCrossCompile();
}
private void RefreshCrossPatchPage()
{
CrossMapperOriginalAssembly.Text = DataProvider.Settings.CrossPatching.OriginalAssemblyPath;
CrossMapperReferencePath.Text = DataProvider.Settings.CrossPatching.RemappedOutput;
CrossMapperProjectBuildPath.Text = DataProvider.Settings.CrossPatching.ReversePatchInputPath;
CrossMapperProjTargetAssembly.Text = DataProvider.Settings.CrossPatching.ReversePatchOutputPath;
CrossMapperOriginalAssembly.Text = DataProvider.Settings.CrossCompiler.OriginalAssemblyPath;
CrossMapperReferencePath.Text = DataProvider.Settings.CrossCompiler.RemappedOutput;
CrossMapperProjectBuildPath.Text = DataProvider.Settings.CrossCompiler.VisualStudioSolutionDirectory;
CrossMapperProjTargetAssembly.Text = DataProvider.Settings.CrossCompiler.BuildDirectory;
}
#endregion CROSSPATCHER
private void CrossCompilerNewProjectButton_Click(object sender, EventArgs e)
{
CrossPatcher.CreateProject();
}
private void CrossCompilerProjectComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
}
#endregion CROSS_COMPILER
// Reset All UI elements to default
private void ResetAll()

View File

@ -1,6 +1,6 @@
using Mono.Cecil;
namespace ReCodeItLib.AutoMapper;
namespace ReCodeIt.AutoMapper;
/// <summary>
/// Represents a match of a field name to obfuscated class

View File

@ -3,9 +3,9 @@ using Mono.Collections.Generic;
using ReCodeIt.Models;
using ReCodeIt.ReMapper;
using ReCodeIt.Utils;
using ReCodeItLib.Utils;
using ReCodeIt.Utils;
namespace ReCodeItLib.AutoMapper;
namespace ReCodeIt.AutoMapper;
public class ReCodeItAutoMapper
{

View File

@ -0,0 +1,177 @@
using ReCodeIt.Models;
using ReCodeIt.ReMapper;
using ReCodeIt.Utils;
namespace ReCodeIt.CrossPatcher;
public class ReCodeItCrossCompiler
{
public ReCodeItCrossCompiler()
{
Remapper = new(this);
FindProjects();
}
private ReCodeItRemapper Remapper { get; }
private CrossCompilerSettings Settings => DataProvider.Settings.CrossCompiler;
public List<string> ProjectPaths { get; private set; } = [];
/// <summary>
/// Key: Remapped name, value: old name
/// </summary>
public Dictionary<string, string> ChangedTypes { get; set; } = [];
private CrossCompilerProjectModel Cache;
private static HashSet<string> CopyIgnoreDirectories { get; } =
[
".vs",
".git"
];
public void CreateProject()
{
Logger.Log("-----------------------------------------------", ConsoleColor.Yellow);
Logger.Log($"Generating Cross Compiler project", ConsoleColor.Yellow);
Logger.Log($"Original Assembly Path {Settings.OriginalAssemblyPath}", ConsoleColor.Yellow);
Logger.Log($"Remapped Assembly Path: {Settings.RemappedOutput}", ConsoleColor.Yellow);
Logger.Log($"Visual Studio Solution Directory: {Settings.VisualStudioSolutionDirectory}", ConsoleColor.Yellow);
// Build the cache model
Cache = new CrossCompilerProjectModel
{
OriginalAssemblyPath = Settings.OriginalAssemblyPath,
RemappedAssemblyPath = Settings.RemappedOutput,
VisualStudioSolutionDirectory = Settings.VisualStudioSolutionDirectory,
OriginalAssemblyHash = HashUtil.GetFileHash(Settings.OriginalAssemblyPath),
RemappedAssemblyHash = "",
ChangedTypes = [],
RemapModels = []
};
// Now copy over the visual studio project
CopyVisualStudioProject(Cache);
// Now save the cache object inside the copied directory
DataProvider.SaveCrossCompilerProjectModel(Cache);
Logger.Log($"Found Solution: {Cache.SolutionPath}", ConsoleColor.Yellow);
Logger.Log($"Original Assembly Checksum: {Cache.OriginalAssemblyHash}", ConsoleColor.Yellow);
Logger.Log($"Project Generated to: {Cache.ReCodeItProjectDir}", ConsoleColor.Green);
Logger.Log("-----------------------------------------------", ConsoleColor.Yellow);
}
public void StartRemap()
{
ChangedTypes.Clear();
Remapper.InitializeRemap(Settings.OriginalAssemblyPath, Settings.RemappedOutput, true);
if (Cache == null)
{
Logger.Log("ERROR: No Cross Compiler Project is loaded, create or load one first.", ConsoleColor.Red);
return;
}
if (Cache.ReCodeItProjectDir == string.Empty)
{
Logger.Log("ERROR: No ReCodeIt Project directory is set. (Project Creation Failed)", ConsoleColor.Red);
return;
}
Logger.Log("-----------------------------------------------", ConsoleColor.Yellow);
Logger.Log($"Cross patch remap result", ConsoleColor.Yellow);
Logger.Log($"Changed {ChangedTypes.Count} types", ConsoleColor.Yellow);
Logger.Log($"Original assembly path: {Cache.OriginalAssemblyPath}", ConsoleColor.Yellow);
Logger.Log($"Original assembly hash: {Cache.OriginalAssemblyHash}", ConsoleColor.Yellow);
Logger.Log($"Original patched assembly path: {Cache.RemappedAssemblyPath}", ConsoleColor.Yellow);
Logger.Log($"Original patched assembly hash: {Cache.RemappedAssemblyHash}", ConsoleColor.Yellow);
Logger.Log("-----------------------------------------------", ConsoleColor.Yellow);
}
public void StartCrossCompile()
{
//CopyVisualStudioProject();
}
private void CopyVisualStudioProject(CrossCompilerProjectModel cache)
{
var solutionDirPath = Settings.VisualStudioSolutionDirectory;
var solutionFiles = Directory.GetFiles(solutionDirPath, "*.sln", SearchOption.AllDirectories);
var solutionFile = string.Empty;
if (solutionFiles.Length > 1)
{
Logger.Log("ERROR More than one solution in a directory is not supported, Why tho?", ConsoleColor.Red);
return;
}
foreach (var file in solutionFiles)
{
solutionFile = file;
}
var solutionName = Path.GetFileNameWithoutExtension(solutionFile);
var destination = Path.Combine(DataProvider.ProjectPath, solutionName);
cache.ReCodeItProjectDir = destination;
cache.SolutionPath = solutionFile;
Logger.Log($"Copying solution: {solutionName} to {destination}", ConsoleColor.Yellow);
CopyProjectRecursive(solutionDirPath, destination);
}
private void CopyProjectRecursive(string sourceDirPath, string destinationDirPath)
{
DirectoryInfo sourceDir = new DirectoryInfo(sourceDirPath);
if (!sourceDir.Exists)
{
throw new DirectoryNotFoundException(
"Solution directory does not exist or could not be found: "
+ sourceDirPath);
}
DirectoryInfo[] dirs = sourceDir.GetDirectories();
// If the destination directory doesn't exist, create it.
Directory.CreateDirectory(destinationDirPath);
// Get the files in the directory and copy them to the new location.
FileInfo[] files = sourceDir.GetFiles();
foreach (FileInfo file in files)
{
string tempPath = Path.Combine(destinationDirPath, file.Name);
file.CopyTo(tempPath, true);
}
foreach (DirectoryInfo subdir in dirs)
{
if (CopyIgnoreDirectories.Contains(subdir.Name)) { continue; }
string tempPath = Path.Combine(destinationDirPath, subdir.Name);
CopyProjectRecursive(subdir.FullName, tempPath);
}
}
private void FindProjects()
{
DirectoryInfo sourceDir = new DirectoryInfo(DataProvider.ProjectPath);
// Only search top level directories here
foreach (var directory in sourceDir.GetDirectories())
{
var files = directory.GetFiles();
foreach (var file in files)
{
if (file.Name == "ReCodeItProj.json")
{
ProjectPaths.Add(file.FullName);
Logger.Log($"Found ReCodeIt Project at {file.FullName}");
}
}
}
}
}

View File

@ -1,4 +1,4 @@
namespace ReCodeItLib.DeMangler;
namespace ReCodeIt.DeMangler;
internal class ReCodeItDeMangler
{

View File

@ -8,7 +8,7 @@ public class Settings
public AppSettings AppSettings { get; set; }
public RemapperSettings Remapper { get; set; }
public AutoMapperSettings AutoMapper { get; set; }
public CrossPatchingSettings CrossPatching { get; set; }
public CrossCompilerSettings CrossCompiler { get; set; }
}
/// <summary>
@ -100,9 +100,9 @@ public class AutoMapperSettings
}
/// <summary>
/// These are settings for the cross patching module
/// These are settings for the cross compiler module
/// </summary>
public class CrossPatchingSettings
public class CrossCompilerSettings
{
/// <summary>
/// The path to the original assembly to use as a reference, for unity games its
@ -116,14 +116,14 @@ public class CrossPatchingSettings
public string RemappedOutput { get; set; }
/// <summary>
/// The input path of the assembly referenced by the remapped dll
/// The path to the solution directory of the project
/// </summary>
public string ReversePatchInputPath { get; set; }
public string VisualStudioSolutionDirectory { get; set; }
/// <summary>
/// Where should the de-patched dll be placed? (This is the one you test/distribute with)
/// </summary>
public string ReversePatchOutputPath { get; set; }
public string BuildDirectory { get; set; }
}
/// <summary>

View File

@ -0,0 +1,28 @@
namespace ReCodeIt.Models;
public class CrossCompilerProjectModel
{
public string OriginalAssemblyPath { get; set; }
public string OriginalAssemblyHash { get; set; }
public string VisualStudioSolutionDirectory { get; set; }
public string SolutionPath { get; set; }
public string ReCodeItProjectDir { get; set; }
public string RemappedAssemblyPath { get; set; }
public string RemappedAssemblyHash { get; set; }
/// <summary>
/// Key: Remapped name, value: old name
/// </summary>
public Dictionary<string, string> ChangedTypes { get; set; } = [];
/// <summary>
/// Remap models used on this project
/// </summary>
public List<RemapModel> RemapModels { get; set; } = [];
}

View File

@ -1,50 +0,0 @@
using Mono.Cecil;
using Mono.Collections.Generic;
namespace ReCodeItLib.Models;
/// <summary>
/// This is a database of type, field, property etc info collected into one place for an assembly.
/// </summary>
/// <param name="assembly"></param>
internal class TypeDatabaseModel
{
public TypeDatabaseModel(ModuleDefinition moduleDefinition)
{
ModuleDefinition = moduleDefinition;
GetAllTypes(ModuleDefinition.Types);
}
public ModuleDefinition ModuleDefinition { get; private set; }
public List<TypeDefinition> Types { get; private set; } = [];
/// <summary>
/// Key, the type definition the property belongs too
/// </summary>
public Dictionary<TypeDefinition, PropertyDefinition> Properties { get; private set; }
/// <summary>
/// Key, the type definition the method belongs too
/// </summary>
public Dictionary<TypeDefinition, MethodDefinition> Methods { get; private set; }
/// <summary>
/// Key, the type definition the field belongs too
/// </summary>
public Dictionary<TypeDefinition, FieldDefinition> Fields { get; private set; }
private void GetAllTypes(Collection<TypeDefinition> types)
{
foreach (var type in types)
{
if (type.HasNestedTypes)
{
GetAllTypes(type.NestedTypes);
}
Types.Add(type);
}
}
}

View File

@ -12,8 +12,4 @@
<PackageReference Include="morelinq" Version="4.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<Folder Include="CrossMapper\" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,5 @@
using Mono.Cecil;
using ReCodeIt.CrossPatcher;
using ReCodeIt.Enums;
using ReCodeIt.Models;
using ReCodeIt.ReMapper.Search;
@ -9,6 +10,16 @@ namespace ReCodeIt.ReMapper;
public class ReCodeItRemapper
{
public ReCodeItRemapper(ReCodeItCrossCompiler compiler)
{
_compiler = compiler;
}
public ReCodeItRemapper()
{ }
private readonly ReCodeItCrossCompiler _compiler;
public static bool IsRunning { get; private set; } = false;
public delegate void OnCompleteHandler(object sender, EventArgs e);
@ -19,12 +30,20 @@ public class ReCodeItRemapper
private RemapperSettings Settings => DataProvider.Settings.Remapper;
private string OutPath { get; set; } = string.Empty;
private bool CrossMapMode { get; set; } = false;
/// <summary>
/// Start the remapping process
/// </summary>
public void InitializeRemap()
public void InitializeRemap(string assemblyPath, string outPath, bool crossMapMode = false)
{
DataProvider.LoadAssemblyDefinition(Settings.AssemblyPath);
DataProvider.LoadAssemblyDefinition(assemblyPath);
CrossMapMode = crossMapMode;
OutPath = outPath;
IsRunning = true;
DisplayBasicModuleInformation();
@ -155,6 +174,13 @@ public class ReCodeItRemapper
remap.OriginalTypeName = type.Name;
remap.FailureReason = EFailureReason.None;
remap.Succeeded = true;
if (CrossMapMode)
{
// Store the original types for caching
_compiler.ChangedTypes.Add(remap.NewTypeName, type.Name);
}
type.Name = remap.NewTypeName;
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
@ -186,6 +212,7 @@ public class ReCodeItRemapper
Logger.Log($"Renaming {remap.NewTypeName} failed with reason {remap.FailureReason}", ConsoleColor.Red);
Logger.Log("-----------------------------------------------", ConsoleColor.Red);
failures++;
continue;
}
changes++;
@ -226,7 +253,12 @@ public class ReCodeItRemapper
}
}
highestScore.ReMap.OriginalTypeName = highestScore.Definition.Name;
// highestScore.ReMap.OriginalTypeName = highestScore.Definition.Name;
if (CrossMapMode)
{// Store the original types for caching
_compiler.ChangedTypes.Add(highestScore.ProposedNewName, highestScore.Definition.Name);
}
// Rename type and all associated type members
RenameHelper.RenameAll(highestScore);
@ -239,7 +271,7 @@ public class ReCodeItRemapper
/// </summary>
private void WriteAssembly()
{
var path = DataProvider.WriteAssemblyDefinition(Settings.OutputPath);
var path = DataProvider.WriteAssemblyDefinition(OutPath);
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
Logger.Log($"Complete: Assembly written to `{path}`", ConsoleColor.Green);

View File

@ -2,7 +2,7 @@
using Mono.Collections.Generic;
using ReCodeIt.Models;
using ReCodeIt.Utils;
using ReCodeItLib.Utils;
using ReCodeIt.Utils;
namespace ReCodeIt.ReMapper;
@ -14,7 +14,7 @@ internal static class RenameHelper
/// Only used by the manual remapper, should probably be removed
/// </summary>
/// <param name="score"></param>
public static void RenameAll(ScoringModel score)
public static void RenameAll(ScoringModel score, bool direct = false)
{
var types = DataProvider.ModuleDefinition.Types;
@ -22,7 +22,10 @@ internal static class RenameHelper
RenameAllFields(score.Definition.Name, score.ReMap.NewTypeName, types);
RenameAllProperties(score.Definition.Name, score.ReMap.NewTypeName, types);
score.Definition.Name = score.ProposedNewName;
if (!direct)
{
RenameType(types, score);
}
Logger.Log($"{score.Definition.Name} Renamed.", ConsoleColor.Green);
}
@ -33,11 +36,12 @@ internal static class RenameHelper
/// <param name="score"></param>
public static void RenameAllDirect(RemapModel remap, TypeDefinition type)
{
var directRename = new ScoringModel();
directRename.Definition = type;
directRename.ReMap = remap;
RenameAll(directRename);
var directRename = new ScoringModel
{
Definition = type,
ReMap = remap
};
RenameAll(directRename, true);
}
/// <summary>
@ -146,4 +150,25 @@ internal static class RenameHelper
{
return propertyCount > 0 ? $"{newName}_{propertyCount}" : newName;
}
private static void RenameType(Collection<TypeDefinition> typesToCheck, ScoringModel score)
{
foreach (var type in typesToCheck)
{
if (type.HasNestedTypes)
{
RenameType(type.NestedTypes, score);
}
if (score.Definition.Name == null) { continue; }
if (type.FullName == score.Definition.Name)
{
var oldName = type.FullName.ToString();
type.Name = score.ProposedNewName;
Logger.Log($"Renamed Type {oldName} to {type.FullName}");
}
}
}
}

View File

@ -8,8 +8,16 @@ public static class DataProvider
{
static DataProvider()
{
if (!Directory.Exists(ProjectPath))
{
Directory.CreateDirectory(ProjectPath);
}
}
public static readonly string DataPath = Path.Combine(AppContext.BaseDirectory, "Data");
public static readonly string ProjectPath = Path.Combine(AppContext.BaseDirectory, "Projects");
public static List<RemapModel> Remaps { get; private set; } = [];
public static Dictionary<string, HashSet<ScoringModel>> ScoringModels { get; set; } = [];
@ -26,7 +34,7 @@ public static class DataProvider
public static void LoadAppSettings()
{
var settingsPath = Path.Combine(AppContext.BaseDirectory, "Data", "Settings.jsonc");
var settingsPath = Path.Combine(DataPath, "Settings.jsonc");
if (!File.Exists(settingsPath))
{
@ -51,7 +59,7 @@ public static class DataProvider
if (!File.Exists(settingsPath))
{
throw new FileNotFoundException($"path `{settingsPath}` does not exist...");
Logger.Log($"path `{settingsPath}` does not exist...", ConsoleColor.Red);
}
JsonSerializerSettings settings = new()
@ -62,6 +70,8 @@ public static class DataProvider
var jsonText = JsonConvert.SerializeObject(Settings, settings);
File.WriteAllText(settingsPath, jsonText);
Logger.Log($"App settings saved to {settingsPath}");
}
public static void LoadMappingFile(string path)
@ -73,11 +83,12 @@ public static class DataProvider
var jsonText = File.ReadAllText(path);
Remaps = [];
ScoringModels = [];
Remaps = JsonConvert.DeserializeObject<List<RemapModel>>(jsonText);
if (Remaps == null) { Remaps = []; }
var properties = typeof(SearchParams).GetProperties();
foreach (var remap in Remaps)
@ -94,7 +105,7 @@ public static class DataProvider
Logger.Log($"Mapping file loaded from '{path}' containing {Remaps.Count} remaps");
}
public static void SaveMapping(string path)
public static void SaveMapping()
{
JsonSerializerSettings settings = new()
{
@ -102,9 +113,12 @@ public static class DataProvider
Formatting = Formatting.Indented
};
var path = Settings.Remapper.MappingPath;
var jsonText = JsonConvert.SerializeObject(Remaps, settings);
File.WriteAllText(path, jsonText);
Logger.Log($"Mapping File Saved To {path}");
}
public static void UpdateMapping(string path)
@ -144,6 +158,38 @@ public static class DataProvider
Logger.Log($"Mapping file saved to {path}");
}
public static void SaveCrossCompilerProjectModel(CrossCompilerProjectModel model)
{
var path = Path.Combine(model.ReCodeItProjectDir, "ReCodeItProj.json");
JsonSerializerSettings settings = new()
{
Formatting = Formatting.Indented
};
var jsonText = JsonConvert.SerializeObject(model, settings);
File.WriteAllText(path, jsonText);
Logger.Log($"Cross Compiler project json generated to {path}", ConsoleColor.Green);
}
public static CrossCompilerProjectModel LoadCrossCompilerCacheModel(string path)
{
if (!File.Exists(path))
{
Logger.Log($"Error loading cache model from `{path}`", ConsoleColor.Red);
}
var jsonText = File.ReadAllText(path);
var model = JsonConvert.DeserializeObject<CrossCompilerProjectModel>(jsonText);
Logger.Log($"Loaded Cross Compiler Project: {model?.RemappedAssemblyPath}");
return model!;
}
public static void LoadAssemblyDefinition(string path)
{
AssemblyDefinition = null;
@ -180,17 +226,20 @@ public static class DataProvider
Logger.Log($"Module {fileName} not found in assembly {fileName}");
}
public static string WriteAssemblyDefinition(string path)
public static string WriteAssemblyDefinition(string path, string filename = "")
{
var filename = Path.GetFileNameWithoutExtension(path);
var strippedPath = Path.GetDirectoryName(filename);
filename = filename != string.Empty
? filename
: Path.GetFileNameWithoutExtension(path) + "-Remapped.dll";
filename = $"{filename}-Remapped.dll";
var strippedPath = Path.GetDirectoryName(path);
var remappedPath = Path.Combine(strippedPath, filename);
var remappedPath = Path.Combine(strippedPath!, filename);
AssemblyDefinition.Write(remappedPath);
Logger.Log($"Writing Assembly {filename} to path {remappedPath}");
return remappedPath;
}
}

View File

@ -0,0 +1,22 @@
using System.Security.Cryptography;
namespace ReCodeIt.Utils;
internal static class HashUtil
{
/// <summary>
/// Create a file hash from an inputed file
/// </summary>
/// <param name="filePath"></param>
/// <returns>A file hash</returns>
public static string GetFileHash(string filePath)
{
using var sha256 = SHA256.Create();
using var stream = File.OpenRead(filePath);
byte[] hashBytes = sha256.ComputeHash(stream);
var hash = BitConverter.ToString(hashBytes).Replace("-", "").ToLowerInvariant();
return hash;
}
}

View File

@ -1,6 +1,6 @@
using System.Text;
namespace ReCodeItLib.Utils;
namespace ReCodeIt.Utils;
internal static class StringExtentions
{

View File

@ -65,10 +65,10 @@
"MethodParamaterBlackList": [ // method parameter names to ignore in the automap, these are case sanitized so case does not matter
]
},
"CrossPatching": {
"CrossCompiler": {
"OriginalAssemblyPath": "G:\\3.8.0 - Dev\\EscapeFromTarkov_Data\\Managed\\Assembly-CSharp.dll", // INPUT: The path to the original assembly to use as a reference, for unity games its 'Assembly-CSharp.dll' from the games Data/Managed Folder
"RemappedOutput": "G:\\development\\SPT-MODS\\StashSearch\\dependencies\\Assembly-CSharp.dll", // OUTPUT: The output path of the remapped assembly
"ReversePatchInputPath": "G:\\development\\SPT-MODS\\StashSearch\\StashSearch\\bin\\Debug\\net472\\StashSearch.dll", // INPUT: The input path of the assembly referenced by the remapped dll
"ReversePatchOutputPath": "G:\\3.8.0 - Dev\\BepInEx\\Plugins\\StashSearch\\StashSearch.dll" // OUTPUT/TEST/PROD: Where should the de-patched dll be placed? (This is the one you test/distribute with)
"VisualStudioSolutionDirectory": "G:\\development\\SPT-MODS\\StashSearch", // INPUT: This is your solution directory of the project
"BuildDirectory": "G:\\development\\SPT-MODS\\StashSearch\\Build" // OUTPUT/TEST/PROD: This is the final build location of your dll
}
}