Some initial automapper work

This commit is contained in:
Cj 2024-06-15 16:21:12 -04:00
parent 2d49d5c9a8
commit 5a3df6593b
17 changed files with 575 additions and 191 deletions

93
.gitignore vendored
View File

@ -29,7 +29,6 @@ x86/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
@ -63,6 +62,9 @@ project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
@ -361,3 +363,92 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# JetBrains Rider
.idea/
*.sln.iml
##
## Visual Studio Code
##
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

6
Directory.Build.props Normal file
View File

@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<Nullable>enable</Nullable>
<AvaloniaVersion>11.0.2</AvaloniaVersion>
</PropertyGroup>
</Project>

View File

@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34728.123
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReCodeItConsole", "RecodeItConsole\ReCodeItConsole.csproj", "{2DFEF08F-6136-44F6-BF0D-93A2E9F9270C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReCodeItGUI", "RecodeItGUI\ReCodeItGUI.csproj", "{7C4A62CE-8072-454F-9D95-6CB4D837F485}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReCodeItLib", "RecodeItLib\ReCodeItLib.csproj", "{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}"
@ -15,10 +13,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2DFEF08F-6136-44F6-BF0D-93A2E9F9270C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2DFEF08F-6136-44F6-BF0D-93A2E9F9270C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2DFEF08F-6136-44F6-BF0D-93A2E9F9270C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2DFEF08F-6136-44F6-BF0D-93A2E9F9270C}.Release|Any CPU.Build.0 = Release|Any CPU
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@ -1,53 +0,0 @@
using ReCodeIt.Utils;
namespace ReCodeIt.Commands
{
internal class CommandProcessor
{
public CommandProcessor()
{ }
public void CommandLoop()
{
ShowStartText();
while (true)
{
var input = Console.ReadLine();
ProcessCommand(input);
}
}
private void ProcessCommand(string command)
{
if (command == "remap" || command == "Remap")
{
var remapper = new ReMapper.ReCodeItRemapper();
Logger.ClearLog();
Console.Clear();
ShowStartText();
DataProvider.LoadMappingFile();
DataProvider.LoadAssemblyDefinition();
remapper.InitializeRemap();
}
if (command == "clear")
{
Console.Clear();
ShowStartText();
}
}
private void ShowStartText()
{
Logger.Log($"-----------------------------------------------------------------", ConsoleColor.Green);
Logger.Log($"Cj's Assembly Tool", ConsoleColor.Green);
Logger.Log($"Version 0.1.0", ConsoleColor.Green);
Logger.Log($"Available Commands: `remap` `clear`", ConsoleColor.Green);
Logger.Log($"-----------------------------------------------------------------", ConsoleColor.Green);
}
}
}

View File

@ -1,2 +0,0 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

View File

@ -1,14 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\RecodeItLib\ReCodeItLib.csproj" />
</ItemGroup>
</Project>

View File

@ -28,8 +28,6 @@ partial class ReCodeItForm
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
bindingSource1 = new BindingSource(components);
TabPageRemapper = new TabPage();
RemapTreeView = new TreeView();
groupBox1 = new GroupBox();
@ -102,13 +100,19 @@ partial class ReCodeItForm
MethodCountEnabled = new CheckBox();
IsSealedUpDown = new DomainUpDown();
TabControlMain = new TabControl();
tabPage5 = new TabPage();
AutoMapperTab = new TabPage();
label2 = new Label();
AutoMapperRequiredMatchesUpDown = new NumericUpDown();
treeView1 = new TreeView();
AutoMapperExcludeTextField = new TextBox();
AutoMapperExcludeRemoveButton = new Button();
AutoMapperExcludeAddButton = new Button();
AutoMapperExcludeBox = new ListBox();
SettingsTab = new TabPage();
groupBox3 = new GroupBox();
label1 = new Label();
MaxMatchCountUpDown = new NumericUpDown();
groupBox4 = new GroupBox();
label2 = new Label();
AutoMapperRequiredMatchesUpDown = new NumericUpDown();
groupBox2 = new GroupBox();
MappingChooseButton = new Button();
UnsealCheckbox = new CheckBox();
@ -122,10 +126,7 @@ partial class ReCodeItForm
AssemblyPathTextBox = new TextBox();
SilentModeCheckbox = new CheckBox();
DebugLoggingCheckbox = new CheckBox();
colorDialog1 = new ColorDialog();
openFileDialog1 = new OpenFileDialog();
fileSystemWatcher1 = new FileSystemWatcher();
((System.ComponentModel.ISupportInitialize)bindingSource1).BeginInit();
RunAutoRemapButton = new Button();
TabPageRemapper.SuspendLayout();
groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)ConstuctorCountUpDown).BeginInit();
@ -139,13 +140,12 @@ partial class ReCodeItForm
((System.ComponentModel.ISupportInitialize)MethodCountUpDown).BeginInit();
((System.ComponentModel.ISupportInitialize)NestedTypeCountUpDown).BeginInit();
TabControlMain.SuspendLayout();
tabPage5.SuspendLayout();
AutoMapperTab.SuspendLayout();
((System.ComponentModel.ISupportInitialize)AutoMapperRequiredMatchesUpDown).BeginInit();
SettingsTab.SuspendLayout();
groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)MaxMatchCountUpDown).BeginInit();
groupBox4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)AutoMapperRequiredMatchesUpDown).BeginInit();
groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)fileSystemWatcher1).BeginInit();
SuspendLayout();
//
// TabPageRemapper
@ -162,6 +162,7 @@ partial class ReCodeItForm
//
// RemapTreeView
//
RemapTreeView.BackColor = Color.Gray;
RemapTreeView.Location = new Point(781, 20);
RemapTreeView.Name = "RemapTreeView";
RemapTreeView.Size = new Size(487, 890);
@ -210,16 +211,18 @@ partial class ReCodeItForm
//
// EditRemapButton
//
EditRemapButton.BackColor = SystemColors.ButtonShadow;
EditRemapButton.Location = new Point(580, 145);
EditRemapButton.Name = "EditRemapButton";
EditRemapButton.Size = new Size(168, 34);
EditRemapButton.TabIndex = 21;
EditRemapButton.Text = "Edit Remap";
EditRemapButton.UseVisualStyleBackColor = true;
EditRemapButton.UseVisualStyleBackColor = false;
EditRemapButton.Click += EditRemapButton_Click;
//
// ConstuctorCountUpDown
//
ConstuctorCountUpDown.BackColor = SystemColors.ScrollBar;
ConstuctorCountUpDown.Location = new Point(224, 178);
ConstuctorCountUpDown.Name = "ConstuctorCountUpDown";
ConstuctorCountUpDown.Size = new Size(55, 31);
@ -237,32 +240,35 @@ partial class ReCodeItForm
//
// LoadMappingFileButton
//
LoadMappingFileButton.BackColor = SystemColors.ButtonShadow;
LoadMappingFileButton.Location = new Point(601, 489);
LoadMappingFileButton.Name = "LoadMappingFileButton";
LoadMappingFileButton.Size = new Size(168, 34);
LoadMappingFileButton.TabIndex = 18;
LoadMappingFileButton.Text = "Load Mapping File";
LoadMappingFileButton.UseVisualStyleBackColor = true;
LoadMappingFileButton.UseVisualStyleBackColor = false;
LoadMappingFileButton.Click += LoadMappingFileButton_Click;
//
// SaveMappingFileButton
//
SaveMappingFileButton.BackColor = SystemColors.ButtonShadow;
SaveMappingFileButton.Location = new Point(427, 489);
SaveMappingFileButton.Name = "SaveMappingFileButton";
SaveMappingFileButton.Size = new Size(168, 34);
SaveMappingFileButton.TabIndex = 17;
SaveMappingFileButton.Text = "Save Mapping File";
SaveMappingFileButton.UseVisualStyleBackColor = true;
SaveMappingFileButton.UseVisualStyleBackColor = false;
SaveMappingFileButton.Click += SaveMappingFileButton_Click;
//
// RunRemapButton
//
RunRemapButton.BackColor = SystemColors.ButtonShadow;
RunRemapButton.Location = new Point(580, 185);
RunRemapButton.Name = "RunRemapButton";
RunRemapButton.Size = new Size(168, 34);
RunRemapButton.TabIndex = 16;
RunRemapButton.Text = "Run Remap";
RunRemapButton.UseVisualStyleBackColor = true;
RunRemapButton.UseVisualStyleBackColor = false;
RunRemapButton.Click += RunRemapButton_Click;
//
// Inclusions
@ -298,6 +304,7 @@ partial class ReCodeItForm
//
// ExcludeMethodTextBox
//
ExcludeMethodTextBox.BackColor = SystemColors.ScrollBar;
ExcludeMethodTextBox.Location = new Point(381, 6);
ExcludeMethodTextBox.Name = "ExcludeMethodTextBox";
ExcludeMethodTextBox.PlaceholderText = "Exclude Methods";
@ -306,6 +313,7 @@ partial class ReCodeItForm
//
// IncludeMethodTextBox
//
IncludeMethodTextBox.BackColor = SystemColors.ScrollBar;
IncludeMethodTextBox.Location = new Point(6, 6);
IncludeMethodTextBox.Name = "IncludeMethodTextBox";
IncludeMethodTextBox.PlaceholderText = "Include Methods";
@ -354,6 +362,7 @@ partial class ReCodeItForm
//
// MethodExcludeBox
//
MethodExcludeBox.BackColor = Color.Gray;
MethodExcludeBox.FormattingEnabled = true;
MethodExcludeBox.ItemHeight = 25;
MethodExcludeBox.Location = new Point(381, 43);
@ -363,6 +372,7 @@ partial class ReCodeItForm
//
// MethodIncludeBox
//
MethodIncludeBox.BackColor = Color.Gray;
MethodIncludeBox.FormattingEnabled = true;
MethodIncludeBox.ItemHeight = 25;
MethodIncludeBox.Location = new Point(6, 43);
@ -390,6 +400,7 @@ partial class ReCodeItForm
//
// FieldsExcludeTextInput
//
FieldsExcludeTextInput.BackColor = SystemColors.ScrollBar;
FieldsExcludeTextInput.Location = new Point(381, 6);
FieldsExcludeTextInput.Name = "FieldsExcludeTextInput";
FieldsExcludeTextInput.PlaceholderText = "Exclude Fields";
@ -398,6 +409,7 @@ partial class ReCodeItForm
//
// FieldsIncludeTextInput
//
FieldsIncludeTextInput.BackColor = SystemColors.ScrollBar;
FieldsIncludeTextInput.Location = new Point(6, 6);
FieldsIncludeTextInput.Name = "FieldsIncludeTextInput";
FieldsIncludeTextInput.PlaceholderText = "Include Fields";
@ -406,46 +418,51 @@ partial class ReCodeItForm
//
// FieldExcludeRemoveButton
//
FieldExcludeRemoveButton.BackColor = SystemColors.ButtonShadow;
FieldExcludeRemoveButton.Location = new Point(622, 278);
FieldExcludeRemoveButton.Name = "FieldExcludeRemoveButton";
FieldExcludeRemoveButton.Size = new Size(112, 34);
FieldExcludeRemoveButton.TabIndex = 25;
FieldExcludeRemoveButton.Text = "Remove";
FieldExcludeRemoveButton.UseVisualStyleBackColor = true;
FieldExcludeRemoveButton.UseVisualStyleBackColor = false;
FieldExcludeRemoveButton.Click += FieldExcludeRemoveButton_Click;
//
// FieldExcludeAddButton
//
FieldExcludeAddButton.BackColor = SystemColors.ButtonShadow;
FieldExcludeAddButton.Location = new Point(381, 278);
FieldExcludeAddButton.Name = "FieldExcludeAddButton";
FieldExcludeAddButton.Size = new Size(112, 34);
FieldExcludeAddButton.TabIndex = 24;
FieldExcludeAddButton.Text = "Add";
FieldExcludeAddButton.UseVisualStyleBackColor = true;
FieldExcludeAddButton.UseVisualStyleBackColor = false;
FieldExcludeAddButton.Click += FieldExcludeAddButton_Click;
//
// FieldIncludeRemoveButton
//
FieldIncludeRemoveButton.BackColor = SystemColors.ButtonShadow;
FieldIncludeRemoveButton.Location = new Point(247, 278);
FieldIncludeRemoveButton.Name = "FieldIncludeRemoveButton";
FieldIncludeRemoveButton.Size = new Size(112, 34);
FieldIncludeRemoveButton.TabIndex = 23;
FieldIncludeRemoveButton.Text = "Remove";
FieldIncludeRemoveButton.UseVisualStyleBackColor = true;
FieldIncludeRemoveButton.UseVisualStyleBackColor = false;
FieldIncludeRemoveButton.Click += FieldIncludeRemoveButton_Click;
//
// FIeldIncludeAddButton
//
FIeldIncludeAddButton.BackColor = SystemColors.ButtonShadow;
FIeldIncludeAddButton.Location = new Point(6, 278);
FIeldIncludeAddButton.Name = "FIeldIncludeAddButton";
FIeldIncludeAddButton.Size = new Size(112, 34);
FIeldIncludeAddButton.TabIndex = 22;
FIeldIncludeAddButton.Text = "Add";
FIeldIncludeAddButton.UseVisualStyleBackColor = true;
FIeldIncludeAddButton.UseVisualStyleBackColor = false;
FIeldIncludeAddButton.Click += FIeldIncludeAddButton_Click;
//
// FieldExcludeBox
//
FieldExcludeBox.BackColor = Color.Gray;
FieldExcludeBox.FormattingEnabled = true;
FieldExcludeBox.ItemHeight = 25;
FieldExcludeBox.Location = new Point(382, 43);
@ -455,6 +472,7 @@ partial class ReCodeItForm
//
// FieldIncludeBox
//
FieldIncludeBox.BackColor = Color.Gray;
FieldIncludeBox.FormattingEnabled = true;
FieldIncludeBox.ItemHeight = 25;
FieldIncludeBox.Location = new Point(6, 43);
@ -482,6 +500,7 @@ partial class ReCodeItForm
//
// PropertiesExcludeTextField
//
PropertiesExcludeTextField.BackColor = SystemColors.ScrollBar;
PropertiesExcludeTextField.Location = new Point(381, 6);
PropertiesExcludeTextField.Name = "PropertiesExcludeTextField";
PropertiesExcludeTextField.PlaceholderText = "Exclude Properties";
@ -490,6 +509,7 @@ partial class ReCodeItForm
//
// PropertiesIncludeTextField
//
PropertiesIncludeTextField.BackColor = SystemColors.ScrollBar;
PropertiesIncludeTextField.Location = new Point(6, 6);
PropertiesIncludeTextField.Name = "PropertiesIncludeTextField";
PropertiesIncludeTextField.PlaceholderText = "Include Properties";
@ -498,46 +518,51 @@ partial class ReCodeItForm
//
// PropertiesExcludeRemoveButton
//
PropertiesExcludeRemoveButton.BackColor = SystemColors.ButtonShadow;
PropertiesExcludeRemoveButton.Location = new Point(622, 278);
PropertiesExcludeRemoveButton.Name = "PropertiesExcludeRemoveButton";
PropertiesExcludeRemoveButton.Size = new Size(112, 34);
PropertiesExcludeRemoveButton.TabIndex = 25;
PropertiesExcludeRemoveButton.Text = "Remove";
PropertiesExcludeRemoveButton.UseVisualStyleBackColor = true;
PropertiesExcludeRemoveButton.UseVisualStyleBackColor = false;
PropertiesExcludeRemoveButton.Click += PropertiesExcludeRemoveButton_Click;
//
// PropertiesExcludeAddButton
//
PropertiesExcludeAddButton.BackColor = SystemColors.ButtonShadow;
PropertiesExcludeAddButton.Location = new Point(381, 278);
PropertiesExcludeAddButton.Name = "PropertiesExcludeAddButton";
PropertiesExcludeAddButton.Size = new Size(112, 34);
PropertiesExcludeAddButton.TabIndex = 24;
PropertiesExcludeAddButton.Text = "Add";
PropertiesExcludeAddButton.UseVisualStyleBackColor = true;
PropertiesExcludeAddButton.UseVisualStyleBackColor = false;
PropertiesExcludeAddButton.Click += PropertiesExcludeAddButton_Click;
//
// PropertiesIncludeRemoveButton
//
PropertiesIncludeRemoveButton.BackColor = SystemColors.ButtonShadow;
PropertiesIncludeRemoveButton.Location = new Point(247, 278);
PropertiesIncludeRemoveButton.Name = "PropertiesIncludeRemoveButton";
PropertiesIncludeRemoveButton.Size = new Size(112, 34);
PropertiesIncludeRemoveButton.TabIndex = 23;
PropertiesIncludeRemoveButton.Text = "Remove";
PropertiesIncludeRemoveButton.UseVisualStyleBackColor = true;
PropertiesIncludeRemoveButton.UseVisualStyleBackColor = false;
PropertiesIncludeRemoveButton.Click += PropertiesIncludeRemoveButton_Click;
//
// PropertiesIncludeAddButton
//
PropertiesIncludeAddButton.BackColor = SystemColors.ButtonShadow;
PropertiesIncludeAddButton.Location = new Point(6, 278);
PropertiesIncludeAddButton.Name = "PropertiesIncludeAddButton";
PropertiesIncludeAddButton.Size = new Size(112, 34);
PropertiesIncludeAddButton.TabIndex = 22;
PropertiesIncludeAddButton.Text = "Add";
PropertiesIncludeAddButton.UseVisualStyleBackColor = true;
PropertiesIncludeAddButton.UseVisualStyleBackColor = false;
PropertiesIncludeAddButton.Click += PropertiesIncludeAddButton_Click;
//
// PropertiesExcludeBox
//
PropertiesExcludeBox.BackColor = Color.Gray;
PropertiesExcludeBox.FormattingEnabled = true;
PropertiesExcludeBox.ItemHeight = 25;
PropertiesExcludeBox.Location = new Point(381, 43);
@ -547,6 +572,7 @@ partial class ReCodeItForm
//
// PropertiesIncludeBox
//
PropertiesIncludeBox.BackColor = Color.Gray;
PropertiesIncludeBox.FormattingEnabled = true;
PropertiesIncludeBox.ItemHeight = 25;
PropertiesIncludeBox.Location = new Point(6, 43);
@ -574,6 +600,7 @@ partial class ReCodeItForm
//
// NestedTypesExcludeTextField
//
NestedTypesExcludeTextField.BackColor = SystemColors.ScrollBar;
NestedTypesExcludeTextField.Location = new Point(381, 6);
NestedTypesExcludeTextField.Name = "NestedTypesExcludeTextField";
NestedTypesExcludeTextField.PlaceholderText = "Exclude Nested Types";
@ -582,6 +609,7 @@ partial class ReCodeItForm
//
// NestedTypesIncludeTextField
//
NestedTypesIncludeTextField.BackColor = SystemColors.ScrollBar;
NestedTypesIncludeTextField.Location = new Point(6, 6);
NestedTypesIncludeTextField.Name = "NestedTypesIncludeTextField";
NestedTypesIncludeTextField.PlaceholderText = "Include Nested Types";
@ -590,46 +618,51 @@ partial class ReCodeItForm
//
// NestedTypesExcludeRemoveButton
//
NestedTypesExcludeRemoveButton.BackColor = SystemColors.ButtonShadow;
NestedTypesExcludeRemoveButton.Location = new Point(622, 278);
NestedTypesExcludeRemoveButton.Name = "NestedTypesExcludeRemoveButton";
NestedTypesExcludeRemoveButton.Size = new Size(112, 34);
NestedTypesExcludeRemoveButton.TabIndex = 25;
NestedTypesExcludeRemoveButton.Text = "Remove";
NestedTypesExcludeRemoveButton.UseVisualStyleBackColor = true;
NestedTypesExcludeRemoveButton.UseVisualStyleBackColor = false;
NestedTypesExcludeRemoveButton.Click += NestedTypesExcludeRemoveButton_Click;
//
// NestedTypesExlcudeAddButton
//
NestedTypesExlcudeAddButton.BackColor = SystemColors.ButtonShadow;
NestedTypesExlcudeAddButton.Location = new Point(381, 278);
NestedTypesExlcudeAddButton.Name = "NestedTypesExlcudeAddButton";
NestedTypesExlcudeAddButton.Size = new Size(112, 34);
NestedTypesExlcudeAddButton.TabIndex = 24;
NestedTypesExlcudeAddButton.Text = "Add";
NestedTypesExlcudeAddButton.UseVisualStyleBackColor = true;
NestedTypesExlcudeAddButton.UseVisualStyleBackColor = false;
NestedTypesExlcudeAddButton.Click += NestedTypesExlcudeAddButton_Click;
//
// NestedTypesRemoveButton
//
NestedTypesRemoveButton.BackColor = SystemColors.ButtonShadow;
NestedTypesRemoveButton.Location = new Point(247, 278);
NestedTypesRemoveButton.Name = "NestedTypesRemoveButton";
NestedTypesRemoveButton.Size = new Size(112, 34);
NestedTypesRemoveButton.TabIndex = 23;
NestedTypesRemoveButton.Text = "Remove";
NestedTypesRemoveButton.UseVisualStyleBackColor = true;
NestedTypesRemoveButton.UseVisualStyleBackColor = false;
NestedTypesRemoveButton.Click += NestedTypesRemoveButton_Click;
//
// NestedTypesAddButton
//
NestedTypesAddButton.BackColor = SystemColors.ButtonShadow;
NestedTypesAddButton.Location = new Point(6, 278);
NestedTypesAddButton.Name = "NestedTypesAddButton";
NestedTypesAddButton.Size = new Size(112, 34);
NestedTypesAddButton.TabIndex = 22;
NestedTypesAddButton.Text = "Add";
NestedTypesAddButton.UseVisualStyleBackColor = true;
NestedTypesAddButton.UseVisualStyleBackColor = false;
NestedTypesAddButton.Click += NestedTypesAddButton_Click;
//
// NestedTypesExcludeBox
//
NestedTypesExcludeBox.BackColor = Color.Gray;
NestedTypesExcludeBox.FormattingEnabled = true;
NestedTypesExcludeBox.ItemHeight = 25;
NestedTypesExcludeBox.Location = new Point(381, 43);
@ -639,6 +672,7 @@ partial class ReCodeItForm
//
// NestedTypesIncludeBox
//
NestedTypesIncludeBox.BackColor = Color.Gray;
NestedTypesIncludeBox.FormattingEnabled = true;
NestedTypesIncludeBox.ItemHeight = 25;
NestedTypesIncludeBox.Location = new Point(6, 43);
@ -648,6 +682,7 @@ partial class ReCodeItForm
//
// NewTypeName
//
NewTypeName.BackColor = SystemColors.ScrollBar;
NewTypeName.Location = new Point(10, 30);
NewTypeName.Name = "NewTypeName";
NewTypeName.PlaceholderText = "New Type Name";
@ -676,6 +711,7 @@ partial class ReCodeItForm
//
// IsInterfaceUpDown
//
IsInterfaceUpDown.BackColor = SystemColors.ScrollBar;
IsInterfaceUpDown.Location = new Point(10, 183);
IsInterfaceUpDown.Name = "IsInterfaceUpDown";
IsInterfaceUpDown.Size = new Size(208, 31);
@ -695,6 +731,7 @@ partial class ReCodeItForm
//
// PropertyCountUpDown
//
PropertyCountUpDown.BackColor = SystemColors.ScrollBar;
PropertyCountUpDown.Location = new Point(224, 291);
PropertyCountUpDown.Name = "PropertyCountUpDown";
PropertyCountUpDown.Size = new Size(55, 31);
@ -702,16 +739,18 @@ partial class ReCodeItForm
//
// RemoveRemapButton
//
RemoveRemapButton.BackColor = SystemColors.ButtonShadow;
RemoveRemapButton.Location = new Point(580, 105);
RemoveRemapButton.Name = "RemoveRemapButton";
RemoveRemapButton.Size = new Size(168, 34);
RemoveRemapButton.TabIndex = 2;
RemoveRemapButton.Text = "Remove Remap";
RemoveRemapButton.UseVisualStyleBackColor = true;
RemoveRemapButton.UseVisualStyleBackColor = false;
RemoveRemapButton.Click += RemoveRemapButton_Click;
//
// FieldCountUpDown
//
FieldCountUpDown.BackColor = SystemColors.ScrollBar;
FieldCountUpDown.Location = new Point(224, 253);
FieldCountUpDown.Name = "FieldCountUpDown";
FieldCountUpDown.Size = new Size(55, 31);
@ -719,6 +758,7 @@ partial class ReCodeItForm
//
// IsPublicUpDown
//
IsPublicUpDown.BackColor = SystemColors.ScrollBar;
IsPublicUpDown.Location = new Point(10, 107);
IsPublicUpDown.Name = "IsPublicUpDown";
IsPublicUpDown.Size = new Size(208, 31);
@ -738,6 +778,7 @@ partial class ReCodeItForm
//
// NestedTypeParentName
//
NestedTypeParentName.BackColor = SystemColors.ScrollBar;
NestedTypeParentName.Location = new Point(224, 106);
NestedTypeParentName.Name = "NestedTypeParentName";
NestedTypeParentName.PlaceholderText = "Nested Type Parent Name";
@ -746,6 +787,7 @@ partial class ReCodeItForm
//
// MethodCountUpDown
//
MethodCountUpDown.BackColor = SystemColors.ScrollBar;
MethodCountUpDown.Location = new Point(224, 215);
MethodCountUpDown.Name = "MethodCountUpDown";
MethodCountUpDown.Size = new Size(55, 31);
@ -753,6 +795,7 @@ partial class ReCodeItForm
//
// IsAbstractUpDown
//
IsAbstractUpDown.BackColor = SystemColors.ScrollBar;
IsAbstractUpDown.Location = new Point(10, 144);
IsAbstractUpDown.Name = "IsAbstractUpDown";
IsAbstractUpDown.Size = new Size(208, 31);
@ -762,6 +805,7 @@ partial class ReCodeItForm
//
// BaseClassIncludeTextFIeld
//
BaseClassIncludeTextFIeld.BackColor = SystemColors.ScrollBar;
BaseClassIncludeTextFIeld.Location = new Point(224, 67);
BaseClassIncludeTextFIeld.Name = "BaseClassIncludeTextFIeld";
BaseClassIncludeTextFIeld.PlaceholderText = "Include Base Class";
@ -770,6 +814,7 @@ partial class ReCodeItForm
//
// OriginalTypeName
//
OriginalTypeName.BackColor = SystemColors.ScrollBar;
OriginalTypeName.Location = new Point(224, 30);
OriginalTypeName.Name = "OriginalTypeName";
OriginalTypeName.PlaceholderText = "Original Type Name";
@ -778,6 +823,7 @@ partial class ReCodeItForm
//
// HasGenericParametersUpDown
//
HasGenericParametersUpDown.BackColor = SystemColors.ScrollBar;
HasGenericParametersUpDown.Location = new Point(10, 366);
HasGenericParametersUpDown.Name = "HasGenericParametersUpDown";
HasGenericParametersUpDown.Size = new Size(208, 31);
@ -787,6 +833,7 @@ partial class ReCodeItForm
//
// IsEnumUpDown
//
IsEnumUpDown.BackColor = SystemColors.ScrollBar;
IsEnumUpDown.Location = new Point(10, 255);
IsEnumUpDown.Name = "IsEnumUpDown";
IsEnumUpDown.Size = new Size(208, 31);
@ -796,6 +843,7 @@ partial class ReCodeItForm
//
// NestedTypeCountUpDown
//
NestedTypeCountUpDown.BackColor = SystemColors.ScrollBar;
NestedTypeCountUpDown.Location = new Point(224, 329);
NestedTypeCountUpDown.Name = "NestedTypeCountUpDown";
NestedTypeCountUpDown.Size = new Size(55, 31);
@ -803,16 +851,18 @@ partial class ReCodeItForm
//
// SaveRemapButton
//
SaveRemapButton.BackColor = SystemColors.ButtonShadow;
SaveRemapButton.Location = new Point(580, 64);
SaveRemapButton.Name = "SaveRemapButton";
SaveRemapButton.Size = new Size(168, 34);
SaveRemapButton.TabIndex = 4;
SaveRemapButton.Text = "Save Remap";
SaveRemapButton.UseVisualStyleBackColor = true;
SaveRemapButton.UseVisualStyleBackColor = false;
SaveRemapButton.Click += AddRemapButton_Click;
//
// IsDerivedUpDown
//
IsDerivedUpDown.BackColor = SystemColors.ScrollBar;
IsDerivedUpDown.Location = new Point(10, 329);
IsDerivedUpDown.Name = "IsDerivedUpDown";
IsDerivedUpDown.Size = new Size(208, 31);
@ -822,6 +872,7 @@ partial class ReCodeItForm
//
// IsNestedUpDown
//
IsNestedUpDown.BackColor = SystemColors.ScrollBar;
IsNestedUpDown.Location = new Point(10, 68);
IsNestedUpDown.Name = "IsNestedUpDown";
IsNestedUpDown.Size = new Size(208, 31);
@ -831,6 +882,7 @@ partial class ReCodeItForm
//
// HasAttributeUpDown
//
HasAttributeUpDown.BackColor = SystemColors.ScrollBar;
HasAttributeUpDown.Location = new Point(10, 292);
HasAttributeUpDown.Name = "HasAttributeUpDown";
HasAttributeUpDown.Size = new Size(208, 31);
@ -840,6 +892,7 @@ partial class ReCodeItForm
//
// BaseClassExcludeTextField
//
BaseClassExcludeTextField.BackColor = SystemColors.ScrollBar;
BaseClassExcludeTextField.Location = new Point(224, 145);
BaseClassExcludeTextField.Name = "BaseClassExcludeTextField";
BaseClassExcludeTextField.PlaceholderText = "Exclude Base Class";
@ -858,6 +911,7 @@ partial class ReCodeItForm
//
// IsSealedUpDown
//
IsSealedUpDown.BackColor = SystemColors.ScrollBar;
IsSealedUpDown.Location = new Point(10, 218);
IsSealedUpDown.Name = "IsSealedUpDown";
IsSealedUpDown.Size = new Size(208, 31);
@ -868,25 +922,106 @@ partial class ReCodeItForm
// TabControlMain
//
TabControlMain.Controls.Add(TabPageRemapper);
TabControlMain.Controls.Add(tabPage5);
TabControlMain.Controls.Add(AutoMapperTab);
TabControlMain.Controls.Add(SettingsTab);
TabControlMain.Location = new Point(-5, 1);
TabControlMain.Name = "TabControlMain";
TabControlMain.SelectedIndex = 0;
TabControlMain.Size = new Size(1344, 991);
TabControlMain.TabIndex = 6;
//
// tabPage5
// AutoMapperTab
//
tabPage5.BackColor = SystemColors.ControlDarkDark;
tabPage5.Controls.Add(groupBox3);
tabPage5.Controls.Add(groupBox4);
tabPage5.Controls.Add(groupBox2);
tabPage5.Location = new Point(4, 34);
tabPage5.Name = "tabPage5";
tabPage5.Padding = new Padding(3);
tabPage5.Size = new Size(1336, 953);
tabPage5.TabIndex = 2;
tabPage5.Text = "Settings";
AutoMapperTab.BackColor = SystemColors.ControlDarkDark;
AutoMapperTab.Controls.Add(RunAutoRemapButton);
AutoMapperTab.Controls.Add(label2);
AutoMapperTab.Controls.Add(AutoMapperRequiredMatchesUpDown);
AutoMapperTab.Controls.Add(treeView1);
AutoMapperTab.Controls.Add(AutoMapperExcludeTextField);
AutoMapperTab.Controls.Add(AutoMapperExcludeRemoveButton);
AutoMapperTab.Controls.Add(AutoMapperExcludeAddButton);
AutoMapperTab.Controls.Add(AutoMapperExcludeBox);
AutoMapperTab.Location = new Point(4, 34);
AutoMapperTab.Name = "AutoMapperTab";
AutoMapperTab.Padding = new Padding(3);
AutoMapperTab.Size = new Size(1336, 953);
AutoMapperTab.TabIndex = 3;
AutoMapperTab.Text = "Auto Mapper";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(76, 60);
label2.Name = "label2";
label2.Size = new Size(153, 25);
label2.TabIndex = 27;
label2.Text = "Required Matches";
//
// AutoMapperRequiredMatchesUpDown
//
AutoMapperRequiredMatchesUpDown.Location = new Point(13, 58);
AutoMapperRequiredMatchesUpDown.Name = "AutoMapperRequiredMatchesUpDown";
AutoMapperRequiredMatchesUpDown.Size = new Size(57, 31);
AutoMapperRequiredMatchesUpDown.TabIndex = 26;
//
// treeView1
//
treeView1.Location = new Point(918, 18);
treeView1.Name = "treeView1";
treeView1.Size = new Size(368, 901);
treeView1.TabIndex = 25;
//
// AutoMapperExcludeTextField
//
AutoMapperExcludeTextField.BackColor = SystemColors.ScrollBar;
AutoMapperExcludeTextField.Location = new Point(6, 173);
AutoMapperExcludeTextField.Name = "AutoMapperExcludeTextField";
AutoMapperExcludeTextField.PlaceholderText = "Exclude Names";
AutoMapperExcludeTextField.Size = new Size(353, 31);
AutoMapperExcludeTextField.TabIndex = 24;
//
// AutoMapperExcludeRemoveButton
//
AutoMapperExcludeRemoveButton.Location = new Point(247, 445);
AutoMapperExcludeRemoveButton.Name = "AutoMapperExcludeRemoveButton";
AutoMapperExcludeRemoveButton.Size = new Size(112, 34);
AutoMapperExcludeRemoveButton.TabIndex = 23;
AutoMapperExcludeRemoveButton.Text = "Remove";
AutoMapperExcludeRemoveButton.UseVisualStyleBackColor = true;
AutoMapperExcludeRemoveButton.Click += AutoMapperExcludeRemoveButton_Click;
//
// AutoMapperExcludeAddButton
//
AutoMapperExcludeAddButton.Location = new Point(6, 445);
AutoMapperExcludeAddButton.Name = "AutoMapperExcludeAddButton";
AutoMapperExcludeAddButton.Size = new Size(112, 34);
AutoMapperExcludeAddButton.TabIndex = 22;
AutoMapperExcludeAddButton.Text = "Add";
AutoMapperExcludeAddButton.UseVisualStyleBackColor = true;
AutoMapperExcludeAddButton.Click += AutoMapperExcludeAddButton_Click;
//
// AutoMapperExcludeBox
//
AutoMapperExcludeBox.BackColor = Color.Gray;
AutoMapperExcludeBox.FormattingEnabled = true;
AutoMapperExcludeBox.ItemHeight = 25;
AutoMapperExcludeBox.Location = new Point(6, 210);
AutoMapperExcludeBox.Name = "AutoMapperExcludeBox";
AutoMapperExcludeBox.Size = new Size(353, 229);
AutoMapperExcludeBox.TabIndex = 21;
//
// SettingsTab
//
SettingsTab.BackColor = SystemColors.ControlDarkDark;
SettingsTab.Controls.Add(groupBox3);
SettingsTab.Controls.Add(groupBox4);
SettingsTab.Controls.Add(groupBox2);
SettingsTab.Location = new Point(4, 34);
SettingsTab.Name = "SettingsTab";
SettingsTab.Padding = new Padding(3);
SettingsTab.Size = new Size(1336, 953);
SettingsTab.TabIndex = 2;
SettingsTab.Text = "Settings";
//
// groupBox3
//
@ -920,8 +1055,6 @@ partial class ReCodeItForm
//
// groupBox4
//
groupBox4.Controls.Add(label2);
groupBox4.Controls.Add(AutoMapperRequiredMatchesUpDown);
groupBox4.Location = new Point(729, 6);
groupBox4.Name = "groupBox4";
groupBox4.Size = new Size(557, 285);
@ -929,23 +1062,6 @@ partial class ReCodeItForm
groupBox4.TabStop = false;
groupBox4.Text = "Auto Mapper Settings";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(69, 37);
label2.Name = "label2";
label2.Size = new Size(153, 25);
label2.TabIndex = 6;
label2.Text = "Required Matches";
//
// AutoMapperRequiredMatchesUpDown
//
AutoMapperRequiredMatchesUpDown.Location = new Point(6, 35);
AutoMapperRequiredMatchesUpDown.Name = "AutoMapperRequiredMatchesUpDown";
AutoMapperRequiredMatchesUpDown.Size = new Size(57, 31);
AutoMapperRequiredMatchesUpDown.TabIndex = 5;
AutoMapperRequiredMatchesUpDown.ValueChanged += AutoMapperRequiredMatchesUpDown_ValueChanged;
//
// groupBox2
//
groupBox2.Controls.Add(MappingChooseButton);
@ -1098,14 +1214,15 @@ partial class ReCodeItForm
DebugLoggingCheckbox.UseVisualStyleBackColor = true;
DebugLoggingCheckbox.CheckedChanged += DebugLoggingCheckbox_CheckedChanged;
//
// openFileDialog1
// RunAutoRemapButton
//
openFileDialog1.FileName = "openFileDialog1";
//
// fileSystemWatcher1
//
fileSystemWatcher1.EnableRaisingEvents = true;
fileSystemWatcher1.SynchronizingObject = this;
RunAutoRemapButton.Location = new Point(6, 3);
RunAutoRemapButton.Name = "RunAutoRemapButton";
RunAutoRemapButton.Size = new Size(168, 34);
RunAutoRemapButton.TabIndex = 28;
RunAutoRemapButton.Text = "Run Auto Remap";
RunAutoRemapButton.UseVisualStyleBackColor = true;
RunAutoRemapButton.Click += RunAutoRemapButton_Click;
//
// ReCodeItForm
//
@ -1117,7 +1234,6 @@ partial class ReCodeItForm
FormBorderStyle = FormBorderStyle.FixedSingle;
Name = "ReCodeItForm";
Text = "ReCodeIt V0.1.0";
((System.ComponentModel.ISupportInitialize)bindingSource1).EndInit();
TabPageRemapper.ResumeLayout(false);
groupBox1.ResumeLayout(false);
groupBox1.PerformLayout();
@ -1136,21 +1252,19 @@ partial class ReCodeItForm
((System.ComponentModel.ISupportInitialize)MethodCountUpDown).EndInit();
((System.ComponentModel.ISupportInitialize)NestedTypeCountUpDown).EndInit();
TabControlMain.ResumeLayout(false);
tabPage5.ResumeLayout(false);
AutoMapperTab.ResumeLayout(false);
AutoMapperTab.PerformLayout();
((System.ComponentModel.ISupportInitialize)AutoMapperRequiredMatchesUpDown).EndInit();
SettingsTab.ResumeLayout(false);
groupBox3.ResumeLayout(false);
groupBox3.PerformLayout();
((System.ComponentModel.ISupportInitialize)MaxMatchCountUpDown).EndInit();
groupBox4.ResumeLayout(false);
groupBox4.PerformLayout();
((System.ComponentModel.ISupportInitialize)AutoMapperRequiredMatchesUpDown).EndInit();
groupBox2.ResumeLayout(false);
groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)fileSystemWatcher1).EndInit();
ResumeLayout(false);
}
#endregion
private BindingSource bindingSource1;
private TabPage TabPageRemapper;
private GroupBox groupBox1;
private TabControl Inclusions;
@ -1204,7 +1318,6 @@ partial class ReCodeItForm
private ListView RemapListView;
private TabControl TabControlMain;
private DomainUpDown IsPublicUpDown;
private ColorDialog colorDialog1;
private DomainUpDown HasGenericParametersUpDown;
private DomainUpDown IsDerivedUpDown;
private DomainUpDown HasAttributeUpDown;
@ -1224,7 +1337,7 @@ partial class ReCodeItForm
private CheckBox ConstructorCountEnabled;
private NumericUpDown MethodCountUpDown;
private CheckBox MethodCountEnabled;
private TabPage tabPage5;
private TabPage SettingsTab;
private GroupBox groupBox3;
private GroupBox groupBox4;
private GroupBox groupBox2;
@ -1236,15 +1349,20 @@ partial class ReCodeItForm
private TextBox MappingPathTextBox;
private TextBox OutputPathTextBox;
private TextBox AssemblyPathTextBox;
private OpenFileDialog openFileDialog1;
private FileSystemWatcher fileSystemWatcher1;
private CheckBox RenamePropertiesCheckbox;
private CheckBox RenameFieldsCheckbox;
private CheckBox UnsealCheckbox;
private CheckBox PublicizeCheckbox;
private NumericUpDown MaxMatchCountUpDown;
private NumericUpDown AutoMapperRequiredMatchesUpDown;
private Label label1;
private Label label2;
private Button EditRemapButton;
private TabPage AutoMapperTab;
private TreeView treeView1;
private TextBox AutoMapperExcludeTextField;
private Button AutoMapperExcludeRemoveButton;
private Button AutoMapperExcludeAddButton;
private ListBox AutoMapperExcludeBox;
private Label label2;
private NumericUpDown AutoMapperRequiredMatchesUpDown;
private Button RunAutoRemapButton;
}

View File

@ -2,12 +2,14 @@ using ReCodeIt.Enums;
using ReCodeIt.Models;
using ReCodeIt.ReMapper;
using ReCodeIt.Utils;
using ReCodeItLib.AutoMapper;
namespace ReCodeIt.GUI;
public partial class ReCodeItForm : Form
{
public static ReCodeItRemapper Remapper { get; private set; } = new();
public static ReCodeItAutoMapper AutoMapper { get; private set; } = new();
private RemapModel CurrentRemap { get; set; }
@ -17,7 +19,7 @@ public partial class ReCodeItForm : Form
{
InitializeComponent();
PopulateDomainUpDowns();
RefreshSettingsPage();
RemapTreeView.NodeMouseDoubleClick += EditSelectedRemap;
Remapper.OnComplete += ReloadTreeView;
@ -172,6 +174,11 @@ public partial class ReCodeItForm : Form
}
}
private void RunAutoMapButton_Click(object sender, EventArgs e)
{
AutoMapper.InitializeAutoMapping();
}
#endregion MAIN_BUTTONS
#region LISTBOX_BUTTONS
@ -304,6 +311,32 @@ public partial class ReCodeItForm : Form
}
}
private void AutoMapperExcludeAddButton_Click(object sender, EventArgs e)
{
if (!AutoMapperExcludeBox.Items.Contains(AutoMapperExcludeTextField.Text))
{
DataProvider.Settings.AutoMapper.TypesToIgnore.Add(AutoMapperExcludeTextField.Text);
AutoMapperExcludeBox.Items.Add(AutoMapperExcludeTextField.Text);
AutoMapperExcludeTextField.Clear();
DataProvider.SaveAppSettings();
}
}
private void AutoMapperExcludeRemoveButton_Click(object sender, EventArgs e)
{
if (AutoMapperExcludeBox.SelectedItem != null)
{
DataProvider.Settings.AutoMapper.TypesToIgnore.RemoveAt(AutoMapperExcludeBox.SelectedIndex);
AutoMapperExcludeBox.Items.Remove(AutoMapperExcludeBox.SelectedItem);
DataProvider.SaveAppSettings();
}
}
private void RunAutoRemapButton_Click(object sender, EventArgs e)
{
AutoMapper.InitializeAutoMapping();
}
#endregion LISTBOX_BUTTONS
#endregion BUTTONS
@ -323,6 +356,12 @@ public partial class ReCodeItForm : Form
PublicizeCheckbox.Checked = DataProvider.Settings.AppSettings.Publicize;
UnsealCheckbox.Checked = DataProvider.Settings.AppSettings.Unseal;
AutoMapperExcludeBox.Items.Clear();
foreach (var method in DataProvider.Settings.AutoMapper.TypesToIgnore)
{
AutoMapperExcludeBox.Items.Add(method);
}
MaxMatchCountUpDown.Value = DataProvider.Settings.Remapper.MaxMatchCount;
AutoMapperRequiredMatchesUpDown.Value = DataProvider.Settings.AutoMapper.RequiredMatches;
}
@ -488,7 +527,7 @@ public partial class ReCodeItForm : Form
private void EditSelectedRemap(object? sender, TreeNodeMouseClickEventArgs e)
{
if (e?.Node.Level != 0)
if (e?.Node.Level != 0 || RemapTreeView?.SelectedNode?.Index < 0 || RemapTreeView?.SelectedNode?.Index == null)
{
return;
}

View File

@ -117,16 +117,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="bindingSource1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="colorDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>367, 17</value>
</metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>536, 17</value>
</metadata>
<metadata name="fileSystemWatcher1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>767, 17</value>
</metadata>
</root>

View File

@ -9,7 +9,7 @@
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy &quot;$(SolutionDir)Templates&quot; &quot;$(TargetDir)Data&quot; /E /I /Y" />
<Exec Command="xcopy &quot;$(SolutionDir)Templates&quot; &quot;$(TargetDir)Data&quot; /E /I /Y /D" />
</Target>
<ItemGroup>

View File

@ -0,0 +1,142 @@
using Mono.Cecil;
using ReCodeIt.Utils;
using ReCodeItLib.Utils;
namespace ReCodeItLib.AutoMapper;
public class ReCodeItAutoMapper
{
private List<MappingPair> MappingPairs { get; set; } = [];
private List<string> IgnoreNames => DataProvider.Settings.AutoMapper.TypesToIgnore;
private static readonly List<string> SystemTypeIgnoreList = new()
{
"Boolean",
"List",
"Dictionary",
"Byte",
"Int16",
"Int36",
"Func",
"Action"
};
private List<string> TokensToMatch = new()
{
"Class",
"GClass"
};
public void InitializeAutoMapping()
{
Logger.ClearLog();
Logger.Log($"Starting Auto Mapping...");
// Clear any previous pairs
MappingPairs = [];
foreach (var type in DataProvider.ModuleDefinition.Types)
{
MappingPairs.AddRange(FilterFieldNames(type));
MappingPairs.AddRange(FilterPropertyNames(type));
}
FilterTypeNames();
}
/// <summary>
/// Pair field declaring types with their names
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
private List<MappingPair> FilterFieldNames(TypeDefinition type)
{
var fieldsWithTypes = new List<MappingPair>();
// Handle nested types recursively
foreach (var nestedType in type.NestedTypes)
{
fieldsWithTypes.AddRange(FilterFieldNames(nestedType));
}
var fields = type.Fields
// we dont want names shorter than 4
.Where(f => f.FieldType.Name.Length > 3)
// Skip value types
.Where(f => !f.FieldType.IsValueType)
// We dont want fields in the system type ignore list
.Where(f => !IgnoreNames.Contains(f.FieldType.Name.TrimAfterSpecialChar()));
// Include fields from the current type
foreach (var field in fields)
{
//Logger.Log($"Collecting Field: Type: {field.FieldType.Name.TrimAfterSpecialChar()} Field Name: {field.Name}");
fieldsWithTypes.Add(new MappingPair(field.FieldType, field.Name));
}
return fieldsWithTypes;
}
/// <summary>
/// Pair field declaring types with their names
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
private List<MappingPair> FilterPropertyNames(TypeDefinition type)
{
var propertiesWithTypes = new List<MappingPair>();
// Handle nested types recursively
foreach (var nestedType in type.NestedTypes)
{
propertiesWithTypes.AddRange(FilterPropertyNames(nestedType));
}
var properties = type.Properties
// we dont want names shorter than 4
.Where(p => p.PropertyType.Name.Length > 3)
// Skip value types
.Where(p => !p.PropertyType.IsValueType)
// We dont want fields in the global ignore list
.Where(p => !IgnoreNames.Contains(p.PropertyType.Name.TrimAfterSpecialChar()));
// Include fields from the current type
foreach (var property in properties)
{
//Logger.Log($"Collecting Property: Type: {property.PropertyType.Name.TrimAfterSpecialChar()} Field Name: {property.Name}");
propertiesWithTypes.Add(new MappingPair(property.PropertyType, property.Name));
}
return propertiesWithTypes;
}
private void FilterTypeNames()
{
// Filter types to the ones we're looking for
var mappingPairs = MappingPairs
.Where(pair => TokensToMatch.Any(token => pair.Type.Name.StartsWith(token)))
// Filter out anything that has the same name as the type
.Where(pair => !TokensToMatch.Any(token => pair.Name.ToLower().StartsWith(token.ToLower())));
foreach (var pair in mappingPairs)
{
Logger.Log($"Type: {pair.Type.Name} identifier: {pair.Name}");
}
Logger.Log($"Match Count {mappingPairs.Count()}");
}
private sealed class MappingPair(TypeReference type, string name)
{
public TypeReference Type { get; set; } = type;
public string Name { get; set; } = name;
}
}

View File

@ -0,0 +1,5 @@
namespace ReCodeItLib.DeMangler;
internal class ReCodeItDeMangler
{
}

View File

@ -13,25 +13,29 @@ public class Settings
public class AppSettings
{
public bool Debug { get; set; } = false;
public bool SilentMode { get; set; } = true;
public string AssemblyPath { get; set; } = string.Empty;
public string OutputPath { get; set; } = string.Empty;
public string MappingPath { get; set; } = string.Empty;
public bool RenameFields { get; set; } = true;
public bool RenameProperties { get; set; } = true;
public bool Publicize { get; set; } = false;
public bool Unseal { get; set; } = false;
public bool Debug { get; set; }
public bool SilentMode { get; set; }
public string AssemblyPath { 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; } = 5;
public int MaxMatchCount { get; set; }
}
public class AutoMapperSettings
{
public int RequiredMatches { get; set; } = 5;
public int RequiredMatches { get; set; }
public List<string> NamesToIgnore { get; set; } = [];
public int MinLengthToMatch { get; set; }
public List<string> TypesToIgnore { get; set; }
public List<string> TokensToMatch { get; set; }
}

View File

@ -14,6 +14,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="AutoMapper\" />
<Folder Include="CrossMapper\" />
</ItemGroup>
</Project>

View File

@ -1,6 +1,6 @@
using ReCodeIt.Models;
using Mono.Cecil;
using Mono.Cecil;
using Newtonsoft.Json;
using ReCodeIt.Models;
namespace ReCodeIt.Utils;
@ -50,7 +50,12 @@ public static class DataProvider
throw new FileNotFoundException($"path `{settingsPath}` does not exist...");
}
var jsonText = JsonConvert.SerializeObject(Settings);
JsonSerializerSettings settings = new()
{
Formatting = Formatting.Indented
};
var jsonText = JsonConvert.SerializeObject(Settings, settings);
File.WriteAllText(settingsPath, jsonText);
}

View File

@ -0,0 +1,41 @@
using System.Text;
namespace ReCodeItLib.Utils;
internal static class StringExtentions
{
/// <summary>
/// Returns a string trimmed after any non letter character
/// </summary>
/// <param name="str"></param>
/// <returns>Trimmed string if special character found, or the original string</returns>
public static string TrimAfterSpecialChar(this string str)
{
var sb = new StringBuilder();
var trimChars = new char[] { '`', '[', ']' };
foreach (char c in str)
{
if (trimChars.Contains(c))
{
}
if (char.IsLetter(c) || char.IsDigit(c))
{
sb.Append(c);
}
else
{
return sb.ToString();
}
}
if (sb.Length > 0)
{
return sb.ToString();
}
return str;
}
}

View File

@ -15,7 +15,27 @@
},
"AutoMapper": {
"RequiredMatches": 5, // Minimum number of times a member must have this name in the assembly before considering it for remapping
"NamesToIgnore": [ // Any member name you want to ignore while iterating through the assembly
"MinLengthToMatch": 6, // Minimum length of the field/property name in code before it will be considered for a rename
"TypesToIgnore": [ // Any member name you want to ignore while iterating through the assembly
"Boolean",
"List",
"Dictionary",
"Byte",
"Int16",
"Int32",
"Func",
"Action",
"Object",
"String",
"Vector2",
"Vector3",
"Vector4",
"Stream",
"HashSet",
"Double",
"IEnumerator"
],
"TokensToMatch": [ // The auto mapper will look for these tokens in class names and prioritize those
]
}