Wire up more automapper ui

This commit is contained in:
Cj 2024-06-16 13:56:55 -04:00
parent 1c5e8d5db8
commit 23692ee034
3 changed files with 218 additions and 68 deletions

View File

@ -106,11 +106,10 @@ partial class ReCodeItForm
RunAutoRemapButton = new Button(); RunAutoRemapButton = new Button();
label2 = new Label(); label2 = new Label();
AutoMapperRequiredMatchesUpDown = new NumericUpDown(); AutoMapperRequiredMatchesUpDown = new NumericUpDown();
treeView1 = new TreeView(); AutoMapperTypesToIgnoreTextField = new TextBox();
AutoMapperExcludeTextField = new TextBox(); AutoMapperExcludeTypesRemoveButton = new Button();
AutoMapperExcludeRemoveButton = new Button(); AutoMapperExcludeTypesAddButton = new Button();
AutoMapperExcludeAddButton = new Button(); AutoMapperTypesExcludeBox = new ListBox();
AutoMapperExcludeBox = new ListBox();
SettingsTab = new TabPage(); SettingsTab = new TabPage();
groupBox3 = new GroupBox(); groupBox3 = new GroupBox();
label1 = new Label(); label1 = new Label();
@ -129,6 +128,14 @@ partial class ReCodeItForm
AssemblyPathTextBox = new TextBox(); AssemblyPathTextBox = new TextBox();
SilentModeCheckbox = new CheckBox(); SilentModeCheckbox = new CheckBox();
DebugLoggingCheckbox = new CheckBox(); DebugLoggingCheckbox = new CheckBox();
AutoMapperTokensTextField = new TextBox();
AutoMapperTokensRemoveButton = new Button();
AutoMapperTokensAddButton = new Button();
AutoMapperTokensBox = new ListBox();
AutoMapperFPTextField = new TextBox();
AutoMapperFPRemoveButton = new Button();
AutoMapperFPAddButton = new Button();
AutoMapperFPBox = new ListBox();
TabPageRemapper.SuspendLayout(); TabPageRemapper.SuspendLayout();
groupBox1.SuspendLayout(); groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)ConstuctorCountUpDown).BeginInit(); ((System.ComponentModel.ISupportInitialize)ConstuctorCountUpDown).BeginInit();
@ -936,16 +943,23 @@ partial class ReCodeItForm
// AutoMapperTab // AutoMapperTab
// //
AutoMapperTab.BackColor = SystemColors.ControlDarkDark; AutoMapperTab.BackColor = SystemColors.ControlDarkDark;
AutoMapperTab.Controls.Add(AutoMapperFPTextField);
AutoMapperTab.Controls.Add(AutoMapperFPRemoveButton);
AutoMapperTab.Controls.Add(AutoMapperFPAddButton);
AutoMapperTab.Controls.Add(AutoMapperFPBox);
AutoMapperTab.Controls.Add(AutoMapperTokensTextField);
AutoMapperTab.Controls.Add(AutoMapperTokensRemoveButton);
AutoMapperTab.Controls.Add(AutoMapperTokensAddButton);
AutoMapperTab.Controls.Add(AutoMapperTokensBox);
AutoMapperTab.Controls.Add(label3); AutoMapperTab.Controls.Add(label3);
AutoMapperTab.Controls.Add(AutoMapperMinLengthUpDown); AutoMapperTab.Controls.Add(AutoMapperMinLengthUpDown);
AutoMapperTab.Controls.Add(RunAutoRemapButton); AutoMapperTab.Controls.Add(RunAutoRemapButton);
AutoMapperTab.Controls.Add(label2); AutoMapperTab.Controls.Add(label2);
AutoMapperTab.Controls.Add(AutoMapperRequiredMatchesUpDown); AutoMapperTab.Controls.Add(AutoMapperRequiredMatchesUpDown);
AutoMapperTab.Controls.Add(treeView1); AutoMapperTab.Controls.Add(AutoMapperTypesToIgnoreTextField);
AutoMapperTab.Controls.Add(AutoMapperExcludeTextField); AutoMapperTab.Controls.Add(AutoMapperExcludeTypesRemoveButton);
AutoMapperTab.Controls.Add(AutoMapperExcludeRemoveButton); AutoMapperTab.Controls.Add(AutoMapperExcludeTypesAddButton);
AutoMapperTab.Controls.Add(AutoMapperExcludeAddButton); AutoMapperTab.Controls.Add(AutoMapperTypesExcludeBox);
AutoMapperTab.Controls.Add(AutoMapperExcludeBox);
AutoMapperTab.Location = new Point(4, 34); AutoMapperTab.Location = new Point(4, 34);
AutoMapperTab.Name = "AutoMapperTab"; AutoMapperTab.Name = "AutoMapperTab";
AutoMapperTab.Padding = new Padding(3); AutoMapperTab.Padding = new Padding(3);
@ -997,51 +1011,44 @@ partial class ReCodeItForm
AutoMapperRequiredMatchesUpDown.TabIndex = 26; AutoMapperRequiredMatchesUpDown.TabIndex = 26;
AutoMapperRequiredMatchesUpDown.ValueChanged += AutoMapperRequiredMatchesUpDown_ValueChanged_1; AutoMapperRequiredMatchesUpDown.ValueChanged += AutoMapperRequiredMatchesUpDown_ValueChanged_1;
// //
// treeView1 // AutoMapperTypesToIgnoreTextField
// //
treeView1.Location = new Point(918, 18); AutoMapperTypesToIgnoreTextField.BackColor = SystemColors.ScrollBar;
treeView1.Name = "treeView1"; AutoMapperTypesToIgnoreTextField.Location = new Point(6, 173);
treeView1.Size = new Size(368, 901); AutoMapperTypesToIgnoreTextField.Name = "AutoMapperTypesToIgnoreTextField";
treeView1.TabIndex = 25; AutoMapperTypesToIgnoreTextField.PlaceholderText = "Type Exclude";
AutoMapperTypesToIgnoreTextField.Size = new Size(353, 31);
AutoMapperTypesToIgnoreTextField.TabIndex = 24;
// //
// AutoMapperExcludeTextField // AutoMapperExcludeTypesRemoveButton
// //
AutoMapperExcludeTextField.BackColor = SystemColors.ScrollBar; AutoMapperExcludeTypesRemoveButton.Location = new Point(247, 445);
AutoMapperExcludeTextField.Location = new Point(6, 173); AutoMapperExcludeTypesRemoveButton.Name = "AutoMapperExcludeTypesRemoveButton";
AutoMapperExcludeTextField.Name = "AutoMapperExcludeTextField"; AutoMapperExcludeTypesRemoveButton.Size = new Size(112, 34);
AutoMapperExcludeTextField.PlaceholderText = "Exclude Names"; AutoMapperExcludeTypesRemoveButton.TabIndex = 23;
AutoMapperExcludeTextField.Size = new Size(353, 31); AutoMapperExcludeTypesRemoveButton.Text = "Remove";
AutoMapperExcludeTextField.TabIndex = 24; AutoMapperExcludeTypesRemoveButton.UseVisualStyleBackColor = true;
AutoMapperExcludeTypesRemoveButton.Click += AutoMapperExcludeRemoveButton_Click;
// //
// AutoMapperExcludeRemoveButton // AutoMapperExcludeTypesAddButton
// //
AutoMapperExcludeRemoveButton.Location = new Point(247, 445); AutoMapperExcludeTypesAddButton.Location = new Point(6, 445);
AutoMapperExcludeRemoveButton.Name = "AutoMapperExcludeRemoveButton"; AutoMapperExcludeTypesAddButton.Name = "AutoMapperExcludeTypesAddButton";
AutoMapperExcludeRemoveButton.Size = new Size(112, 34); AutoMapperExcludeTypesAddButton.Size = new Size(112, 34);
AutoMapperExcludeRemoveButton.TabIndex = 23; AutoMapperExcludeTypesAddButton.TabIndex = 22;
AutoMapperExcludeRemoveButton.Text = "Remove"; AutoMapperExcludeTypesAddButton.Text = "Add";
AutoMapperExcludeRemoveButton.UseVisualStyleBackColor = true; AutoMapperExcludeTypesAddButton.UseVisualStyleBackColor = true;
AutoMapperExcludeRemoveButton.Click += AutoMapperExcludeRemoveButton_Click; AutoMapperExcludeTypesAddButton.Click += AutoMapperExcludeAddButton_Click;
// //
// AutoMapperExcludeAddButton // AutoMapperTypesExcludeBox
// //
AutoMapperExcludeAddButton.Location = new Point(6, 445); AutoMapperTypesExcludeBox.BackColor = Color.Gray;
AutoMapperExcludeAddButton.Name = "AutoMapperExcludeAddButton"; AutoMapperTypesExcludeBox.FormattingEnabled = true;
AutoMapperExcludeAddButton.Size = new Size(112, 34); AutoMapperTypesExcludeBox.ItemHeight = 25;
AutoMapperExcludeAddButton.TabIndex = 22; AutoMapperTypesExcludeBox.Location = new Point(6, 210);
AutoMapperExcludeAddButton.Text = "Add"; AutoMapperTypesExcludeBox.Name = "AutoMapperTypesExcludeBox";
AutoMapperExcludeAddButton.UseVisualStyleBackColor = true; AutoMapperTypesExcludeBox.Size = new Size(353, 229);
AutoMapperExcludeAddButton.Click += AutoMapperExcludeAddButton_Click; AutoMapperTypesExcludeBox.TabIndex = 21;
//
// 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
// //
@ -1247,6 +1254,84 @@ partial class ReCodeItForm
DebugLoggingCheckbox.UseVisualStyleBackColor = true; DebugLoggingCheckbox.UseVisualStyleBackColor = true;
DebugLoggingCheckbox.CheckedChanged += DebugLoggingCheckbox_CheckedChanged; DebugLoggingCheckbox.CheckedChanged += DebugLoggingCheckbox_CheckedChanged;
// //
// AutoMapperTokensTextField
//
AutoMapperTokensTextField.BackColor = SystemColors.ScrollBar;
AutoMapperTokensTextField.Location = new Point(365, 173);
AutoMapperTokensTextField.Name = "AutoMapperTokensTextField";
AutoMapperTokensTextField.PlaceholderText = "Class Tokens To Match During Renaming";
AutoMapperTokensTextField.Size = new Size(353, 31);
AutoMapperTokensTextField.TabIndex = 34;
//
// AutoMapperTokensRemoveButton
//
AutoMapperTokensRemoveButton.Location = new Point(606, 445);
AutoMapperTokensRemoveButton.Name = "AutoMapperTokensRemoveButton";
AutoMapperTokensRemoveButton.Size = new Size(112, 34);
AutoMapperTokensRemoveButton.TabIndex = 33;
AutoMapperTokensRemoveButton.Text = "Remove";
AutoMapperTokensRemoveButton.UseVisualStyleBackColor = true;
AutoMapperTokensRemoveButton.Click += AutoMapperTokensRemoveButton_Click;
//
// AutoMapperTokensAddButton
//
AutoMapperTokensAddButton.Location = new Point(365, 445);
AutoMapperTokensAddButton.Name = "AutoMapperTokensAddButton";
AutoMapperTokensAddButton.Size = new Size(112, 34);
AutoMapperTokensAddButton.TabIndex = 32;
AutoMapperTokensAddButton.Text = "Add";
AutoMapperTokensAddButton.UseVisualStyleBackColor = true;
AutoMapperTokensAddButton.Click += AutoMapperTokensAddButton_Click;
//
// AutoMapperTokensBox
//
AutoMapperTokensBox.BackColor = Color.Gray;
AutoMapperTokensBox.FormattingEnabled = true;
AutoMapperTokensBox.ItemHeight = 25;
AutoMapperTokensBox.Location = new Point(365, 210);
AutoMapperTokensBox.Name = "AutoMapperTokensBox";
AutoMapperTokensBox.Size = new Size(353, 229);
AutoMapperTokensBox.TabIndex = 31;
//
// AutoMapperFPTextField
//
AutoMapperFPTextField.BackColor = SystemColors.ScrollBar;
AutoMapperFPTextField.Location = new Point(6, 496);
AutoMapperFPTextField.Name = "AutoMapperFPTextField";
AutoMapperFPTextField.PlaceholderText = "Field or property names to blacklist";
AutoMapperFPTextField.Size = new Size(353, 31);
AutoMapperFPTextField.TabIndex = 38;
//
// AutoMapperFPRemoveButton
//
AutoMapperFPRemoveButton.Location = new Point(247, 768);
AutoMapperFPRemoveButton.Name = "AutoMapperFPRemoveButton";
AutoMapperFPRemoveButton.Size = new Size(112, 34);
AutoMapperFPRemoveButton.TabIndex = 37;
AutoMapperFPRemoveButton.Text = "Remove";
AutoMapperFPRemoveButton.UseVisualStyleBackColor = true;
AutoMapperFPRemoveButton.Click += AutoMapperFPRemoveButton_Click;
//
// AutoMapperFPAddButton
//
AutoMapperFPAddButton.Location = new Point(6, 768);
AutoMapperFPAddButton.Name = "AutoMapperFPAddButton";
AutoMapperFPAddButton.Size = new Size(112, 34);
AutoMapperFPAddButton.TabIndex = 36;
AutoMapperFPAddButton.Text = "Add";
AutoMapperFPAddButton.UseVisualStyleBackColor = true;
AutoMapperFPAddButton.Click += AutoMapperFPAddButton_Click;
//
// AutoMapperFPBox
//
AutoMapperFPBox.BackColor = Color.Gray;
AutoMapperFPBox.FormattingEnabled = true;
AutoMapperFPBox.ItemHeight = 25;
AutoMapperFPBox.Location = new Point(6, 533);
AutoMapperFPBox.Name = "AutoMapperFPBox";
AutoMapperFPBox.Size = new Size(353, 229);
AutoMapperFPBox.TabIndex = 35;
//
// ReCodeItForm // ReCodeItForm
// //
AutoScaleDimensions = new SizeF(10F, 25F); AutoScaleDimensions = new SizeF(10F, 25F);
@ -1381,14 +1466,21 @@ partial class ReCodeItForm
private Label label1; private Label label1;
private Button EditRemapButton; private Button EditRemapButton;
private TabPage AutoMapperTab; private TabPage AutoMapperTab;
private TreeView treeView1; private TextBox AutoMapperTypesToIgnoreTextField;
private TextBox AutoMapperExcludeTextField; private Button AutoMapperExcludeTypesRemoveButton;
private Button AutoMapperExcludeRemoveButton; private Button AutoMapperExcludeTypesAddButton;
private Button AutoMapperExcludeAddButton; private ListBox AutoMapperTypesExcludeBox;
private ListBox AutoMapperExcludeBox;
private Label label2; private Label label2;
private NumericUpDown AutoMapperRequiredMatchesUpDown; private NumericUpDown AutoMapperRequiredMatchesUpDown;
private Button RunAutoRemapButton; private Button RunAutoRemapButton;
private Label label3; private Label label3;
private NumericUpDown AutoMapperMinLengthUpDown; private NumericUpDown AutoMapperMinLengthUpDown;
private TextBox AutoMapperTokensTextField;
private Button AutoMapperTokensRemoveButton;
private Button AutoMapperTokensAddButton;
private ListBox AutoMapperTokensBox;
private TextBox AutoMapperFPTextField;
private Button AutoMapperFPRemoveButton;
private Button AutoMapperFPAddButton;
private ListBox AutoMapperFPBox;
} }

View File

@ -314,21 +314,21 @@ public partial class ReCodeItForm : Form
private void AutoMapperExcludeAddButton_Click(object sender, EventArgs e) private void AutoMapperExcludeAddButton_Click(object sender, EventArgs e)
{ {
if (!AutoMapperExcludeBox.Items.Contains(AutoMapperExcludeTextField.Text)) if (!AutoMapperTypesExcludeBox.Items.Contains(AutoMapperTypesToIgnoreTextField.Text))
{ {
DataProvider.Settings.AutoMapper.TypesToIgnore.Add(AutoMapperExcludeTextField.Text); DataProvider.Settings.AutoMapper.TypesToIgnore.Add(AutoMapperTypesToIgnoreTextField.Text);
AutoMapperExcludeBox.Items.Add(AutoMapperExcludeTextField.Text); AutoMapperTypesExcludeBox.Items.Add(AutoMapperTypesToIgnoreTextField.Text);
AutoMapperExcludeTextField.Clear(); AutoMapperTypesToIgnoreTextField.Clear();
DataProvider.SaveAppSettings(); DataProvider.SaveAppSettings();
} }
} }
private void AutoMapperExcludeRemoveButton_Click(object sender, EventArgs e) private void AutoMapperExcludeRemoveButton_Click(object sender, EventArgs e)
{ {
if (AutoMapperExcludeBox.SelectedItem != null) if (AutoMapperTypesExcludeBox.SelectedItem != null)
{ {
DataProvider.Settings.AutoMapper.TypesToIgnore.RemoveAt(AutoMapperExcludeBox.SelectedIndex); DataProvider.Settings.AutoMapper.TypesToIgnore.RemoveAt(AutoMapperTypesExcludeBox.SelectedIndex);
AutoMapperExcludeBox.Items.Remove(AutoMapperExcludeBox.SelectedItem); AutoMapperTypesExcludeBox.Items.Remove(AutoMapperTypesExcludeBox.SelectedItem);
DataProvider.SaveAppSettings(); DataProvider.SaveAppSettings();
} }
} }
@ -357,10 +357,10 @@ public partial class ReCodeItForm : Form
PublicizeCheckbox.Checked = DataProvider.Settings.AppSettings.Publicize; PublicizeCheckbox.Checked = DataProvider.Settings.AppSettings.Publicize;
UnsealCheckbox.Checked = DataProvider.Settings.AppSettings.Unseal; UnsealCheckbox.Checked = DataProvider.Settings.AppSettings.Unseal;
AutoMapperExcludeBox.Items.Clear(); AutoMapperTypesExcludeBox.Items.Clear();
foreach (var method in DataProvider.Settings.AutoMapper.TypesToIgnore) foreach (var method in DataProvider.Settings.AutoMapper.TypesToIgnore)
{ {
AutoMapperExcludeBox.Items.Add(method); AutoMapperTypesExcludeBox.Items.Add(method);
} }
MaxMatchCountUpDown.Value = DataProvider.Settings.Remapper.MaxMatchCount; MaxMatchCountUpDown.Value = DataProvider.Settings.Remapper.MaxMatchCount;
@ -480,15 +480,27 @@ public partial class ReCodeItForm : Form
public void RefreshAutoMapperPage() public void RefreshAutoMapperPage()
{ {
AutoMapperExcludeBox.Items.Clear(); AutoMapperTypesExcludeBox.Items.Clear();
AutoMapperTokensBox.Items.Clear();
foreach (var method in DataProvider.Settings.AutoMapper.TypesToIgnore) AutoMapperFPBox.Items.Clear();
{
AutoMapperExcludeBox.Items.Add(method);
}
MaxMatchCountUpDown.Value = DataProvider.Settings.Remapper.MaxMatchCount; MaxMatchCountUpDown.Value = DataProvider.Settings.Remapper.MaxMatchCount;
AutoMapperRequiredMatchesUpDown.Value = DataProvider.Settings.AutoMapper.RequiredMatches; AutoMapperRequiredMatchesUpDown.Value = DataProvider.Settings.AutoMapper.RequiredMatches;
foreach (var type in DataProvider.Settings.AutoMapper.TypesToIgnore)
{
AutoMapperTypesExcludeBox.Items.Add(type);
}
foreach (var token in DataProvider.Settings.AutoMapper.TokensToMatch)
{
AutoMapperTokensBox.Items.Add(token);
}
foreach (var fp in DataProvider.Settings.AutoMapper.PropertyFieldBlackList)
{
AutoMapperFPBox.Items.Add(fp);
}
} }
private void AutoMapperRequiredMatchesUpDown_ValueChanged_1(object sender, EventArgs e) private void AutoMapperRequiredMatchesUpDown_ValueChanged_1(object sender, EventArgs e)
@ -503,6 +515,50 @@ public partial class ReCodeItForm : Form
DataProvider.SaveAppSettings(); DataProvider.SaveAppSettings();
} }
private void AutoMapperTokensAddButton_Click(object sender, EventArgs e)
{
if (!AutoMapperTokensBox.Items.Contains(AutoMapperTokensTextField.Text))
{
AutoMapperTokensBox.Items.Add(AutoMapperTokensTextField.Text);
AutoMapperTokensTextField.Clear();
DataProvider.Settings.AutoMapper.TokensToMatch.Add(AutoMapperTokensTextField.Text);
DataProvider.SaveAppSettings();
}
}
private void AutoMapperTokensRemoveButton_Click(object sender, EventArgs e)
{
if (AutoMapperTokensBox.SelectedItem != null)
{
AutoMapperTokensBox.Items.Remove(AutoMapperTokensBox.SelectedItem);
DataProvider.Settings.AutoMapper.TokensToMatch.RemoveAt(AutoMapperTokensBox.SelectedIndex);
DataProvider.SaveAppSettings();
}
}
private void AutoMapperFPAddButton_Click(object sender, EventArgs e)
{
if (!AutoMapperFPBox.Items.Contains(AutoMapperFPTextField.Text))
{
AutoMapperFPBox.Items.Add(AutoMapperFPTextField.Text);
AutoMapperFPTextField.Clear();
DataProvider.Settings.AutoMapper.PropertyFieldBlackList.Add(AutoMapperFPTextField.Text);
DataProvider.SaveAppSettings();
}
}
private void AutoMapperFPRemoveButton_Click(object sender, EventArgs e)
{
if (AutoMapperFPBox.SelectedItem != null)
{
AutoMapperFPBox.Items.Remove(AutoMapperFPBox.SelectedItem);
DataProvider.Settings.AutoMapper.PropertyFieldBlackList.RemoveAt(AutoMapperFPBox.SelectedIndex);
DataProvider.SaveAppSettings();
}
}
#endregion AUTOMAPPER #endregion AUTOMAPPER
// Reset All UI elements to default // Reset All UI elements to default

View File

@ -33,6 +33,8 @@ public class ReCodeItAutoMapper
MappingPairs = []; MappingPairs = [];
CompilerGeneratedClasses = []; CompilerGeneratedClasses = [];
DataProvider.LoadAssemblyDefinition();
Error = false; Error = false;
FailureCount = 0; FailureCount = 0;
TotalFieldRenameCount = 0; TotalFieldRenameCount = 0;