Allow editing of existing tree items
This commit is contained in:
parent
867b218063
commit
845c0a84ac
39
RecodeItGUI/GUI/Main.Designer.cs
generated
39
RecodeItGUI/GUI/Main.Designer.cs
generated
@ -33,6 +33,7 @@ partial class ReCodeItForm
|
|||||||
TabPageRemapper = new TabPage();
|
TabPageRemapper = new TabPage();
|
||||||
RemapTreeView = new TreeView();
|
RemapTreeView = new TreeView();
|
||||||
groupBox1 = new GroupBox();
|
groupBox1 = new GroupBox();
|
||||||
|
EditRemapButton = new Button();
|
||||||
ConstuctorCountUpDown = new NumericUpDown();
|
ConstuctorCountUpDown = new NumericUpDown();
|
||||||
ConstructorCountEnabled = new CheckBox();
|
ConstructorCountEnabled = new CheckBox();
|
||||||
LoadMappingFileButton = new Button();
|
LoadMappingFileButton = new Button();
|
||||||
@ -93,7 +94,7 @@ partial class ReCodeItForm
|
|||||||
HasGenericParametersUpDown = new DomainUpDown();
|
HasGenericParametersUpDown = new DomainUpDown();
|
||||||
IsEnumUpDown = new DomainUpDown();
|
IsEnumUpDown = new DomainUpDown();
|
||||||
NestedTypeCountUpDown = new NumericUpDown();
|
NestedTypeCountUpDown = new NumericUpDown();
|
||||||
AddRemapButton = new Button();
|
SaveRemapButton = new Button();
|
||||||
IsDerivedUpDown = new DomainUpDown();
|
IsDerivedUpDown = new DomainUpDown();
|
||||||
IsNestedUpDown = new DomainUpDown();
|
IsNestedUpDown = new DomainUpDown();
|
||||||
HasAttributeUpDown = new DomainUpDown();
|
HasAttributeUpDown = new DomainUpDown();
|
||||||
@ -157,7 +158,7 @@ partial class ReCodeItForm
|
|||||||
TabPageRemapper.Padding = new Padding(3);
|
TabPageRemapper.Padding = new Padding(3);
|
||||||
TabPageRemapper.Size = new Size(1336, 953);
|
TabPageRemapper.Size = new Size(1336, 953);
|
||||||
TabPageRemapper.TabIndex = 1;
|
TabPageRemapper.TabIndex = 1;
|
||||||
TabPageRemapper.Text = "ReCodeItRemapper";
|
TabPageRemapper.Text = "Remapper";
|
||||||
//
|
//
|
||||||
// RemapTreeView
|
// RemapTreeView
|
||||||
//
|
//
|
||||||
@ -168,6 +169,7 @@ partial class ReCodeItForm
|
|||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
|
groupBox1.Controls.Add(EditRemapButton);
|
||||||
groupBox1.Controls.Add(ConstuctorCountUpDown);
|
groupBox1.Controls.Add(ConstuctorCountUpDown);
|
||||||
groupBox1.Controls.Add(ConstructorCountEnabled);
|
groupBox1.Controls.Add(ConstructorCountEnabled);
|
||||||
groupBox1.Controls.Add(LoadMappingFileButton);
|
groupBox1.Controls.Add(LoadMappingFileButton);
|
||||||
@ -192,7 +194,7 @@ partial class ReCodeItForm
|
|||||||
groupBox1.Controls.Add(HasGenericParametersUpDown);
|
groupBox1.Controls.Add(HasGenericParametersUpDown);
|
||||||
groupBox1.Controls.Add(IsEnumUpDown);
|
groupBox1.Controls.Add(IsEnumUpDown);
|
||||||
groupBox1.Controls.Add(NestedTypeCountUpDown);
|
groupBox1.Controls.Add(NestedTypeCountUpDown);
|
||||||
groupBox1.Controls.Add(AddRemapButton);
|
groupBox1.Controls.Add(SaveRemapButton);
|
||||||
groupBox1.Controls.Add(IsDerivedUpDown);
|
groupBox1.Controls.Add(IsDerivedUpDown);
|
||||||
groupBox1.Controls.Add(IsNestedUpDown);
|
groupBox1.Controls.Add(IsNestedUpDown);
|
||||||
groupBox1.Controls.Add(HasAttributeUpDown);
|
groupBox1.Controls.Add(HasAttributeUpDown);
|
||||||
@ -206,6 +208,16 @@ partial class ReCodeItForm
|
|||||||
groupBox1.TabStop = false;
|
groupBox1.TabStop = false;
|
||||||
groupBox1.Text = "Remap Editor";
|
groupBox1.Text = "Remap Editor";
|
||||||
//
|
//
|
||||||
|
// EditRemapButton
|
||||||
|
//
|
||||||
|
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.Click += EditRemapButton_Click;
|
||||||
|
//
|
||||||
// ConstuctorCountUpDown
|
// ConstuctorCountUpDown
|
||||||
//
|
//
|
||||||
ConstuctorCountUpDown.Location = new Point(224, 178);
|
ConstuctorCountUpDown.Location = new Point(224, 178);
|
||||||
@ -245,7 +257,7 @@ partial class ReCodeItForm
|
|||||||
//
|
//
|
||||||
// RunRemapButton
|
// RunRemapButton
|
||||||
//
|
//
|
||||||
RunRemapButton.Location = new Point(580, 145);
|
RunRemapButton.Location = new Point(580, 185);
|
||||||
RunRemapButton.Name = "RunRemapButton";
|
RunRemapButton.Name = "RunRemapButton";
|
||||||
RunRemapButton.Size = new Size(168, 34);
|
RunRemapButton.Size = new Size(168, 34);
|
||||||
RunRemapButton.TabIndex = 16;
|
RunRemapButton.TabIndex = 16;
|
||||||
@ -789,15 +801,15 @@ partial class ReCodeItForm
|
|||||||
NestedTypeCountUpDown.Size = new Size(55, 31);
|
NestedTypeCountUpDown.Size = new Size(55, 31);
|
||||||
NestedTypeCountUpDown.TabIndex = 4;
|
NestedTypeCountUpDown.TabIndex = 4;
|
||||||
//
|
//
|
||||||
// AddRemapButton
|
// SaveRemapButton
|
||||||
//
|
//
|
||||||
AddRemapButton.Location = new Point(580, 64);
|
SaveRemapButton.Location = new Point(580, 64);
|
||||||
AddRemapButton.Name = "AddRemapButton";
|
SaveRemapButton.Name = "SaveRemapButton";
|
||||||
AddRemapButton.Size = new Size(168, 34);
|
SaveRemapButton.Size = new Size(168, 34);
|
||||||
AddRemapButton.TabIndex = 4;
|
SaveRemapButton.TabIndex = 4;
|
||||||
AddRemapButton.Text = "Add Remap";
|
SaveRemapButton.Text = "Save Remap";
|
||||||
AddRemapButton.UseVisualStyleBackColor = true;
|
SaveRemapButton.UseVisualStyleBackColor = true;
|
||||||
AddRemapButton.Click += AddRemapButton_Click;
|
SaveRemapButton.Click += AddRemapButton_Click;
|
||||||
//
|
//
|
||||||
// IsDerivedUpDown
|
// IsDerivedUpDown
|
||||||
//
|
//
|
||||||
@ -1188,7 +1200,7 @@ partial class ReCodeItForm
|
|||||||
private TextBox OriginalTypeName;
|
private TextBox OriginalTypeName;
|
||||||
private TextBox NewTypeName;
|
private TextBox NewTypeName;
|
||||||
private Button RemoveRemapButton;
|
private Button RemoveRemapButton;
|
||||||
private Button AddRemapButton;
|
private Button SaveRemapButton;
|
||||||
private ListView RemapListView;
|
private ListView RemapListView;
|
||||||
private TabControl TabControlMain;
|
private TabControl TabControlMain;
|
||||||
private DomainUpDown IsPublicUpDown;
|
private DomainUpDown IsPublicUpDown;
|
||||||
@ -1234,4 +1246,5 @@ partial class ReCodeItForm
|
|||||||
private NumericUpDown AutoMapperRequiredMatchesUpDown;
|
private NumericUpDown AutoMapperRequiredMatchesUpDown;
|
||||||
private Label label1;
|
private Label label1;
|
||||||
private Label label2;
|
private Label label2;
|
||||||
|
private Button EditRemapButton;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ public partial class ReCodeItForm : Form
|
|||||||
{
|
{
|
||||||
public static ReCodeItRemapper Remapper { get; private set; } = new();
|
public static ReCodeItRemapper Remapper { get; private set; } = new();
|
||||||
|
|
||||||
|
private RemapModel CurrentRemap { get; set; }
|
||||||
|
|
||||||
public ReCodeItForm()
|
public ReCodeItForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -35,7 +37,7 @@ public partial class ReCodeItForm : Form
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var remap = new RemapModel
|
var newRemap = new RemapModel
|
||||||
{
|
{
|
||||||
Succeeded = false,
|
Succeeded = false,
|
||||||
FailureReason = EFailureReason.None,
|
FailureReason = EFailureReason.None,
|
||||||
@ -83,8 +85,31 @@ public partial class ReCodeItForm : Form
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RemapTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(remap, this));
|
var existingRemap = DataProvider.Remaps
|
||||||
DataProvider.Remaps.Add(remap);
|
.Where(remap => remap.NewTypeName == NewTypeName.Text)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
// Handle overwriting an existing remap
|
||||||
|
if (existingRemap != null)
|
||||||
|
{
|
||||||
|
var index = DataProvider.Remaps.IndexOf(existingRemap);
|
||||||
|
|
||||||
|
DataProvider.Remaps.Remove(existingRemap);
|
||||||
|
RemapTreeView.Nodes.RemoveAt(index);
|
||||||
|
|
||||||
|
DataProvider.Remaps.Insert(index, newRemap);
|
||||||
|
RemapTreeView.Nodes.Insert(index, GUIHelpers.GenerateTreeNode(newRemap, this));
|
||||||
|
|
||||||
|
CurrentRemap = existingRemap;
|
||||||
|
|
||||||
|
ResetAll();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CurrentRemap = newRemap;
|
||||||
|
RemapTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(newRemap, this));
|
||||||
|
DataProvider.Remaps.Add(newRemap);
|
||||||
|
|
||||||
ResetAll();
|
ResetAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +119,11 @@ public partial class ReCodeItForm : Form
|
|||||||
RemapTreeView.SelectedNode?.Remove();
|
RemapTreeView.SelectedNode?.Remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EditRemapButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EditSelectedRemap();
|
||||||
|
}
|
||||||
|
|
||||||
private void RunRemapButton_Click(object sender, EventArgs e)
|
private void RunRemapButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (ReCodeItRemapper.IsRunning) { return; }
|
if (ReCodeItRemapper.IsRunning) { return; }
|
||||||
@ -425,6 +455,7 @@ public partial class ReCodeItForm : Form
|
|||||||
|
|
||||||
// Numeric UpDowns
|
// Numeric UpDowns
|
||||||
|
|
||||||
|
ConstuctorCountUpDown.Value = 0;
|
||||||
MethodCountUpDown.Value = 0;
|
MethodCountUpDown.Value = 0;
|
||||||
FieldCountUpDown.Value = 0;
|
FieldCountUpDown.Value = 0;
|
||||||
PropertyCountUpDown.Value = 0;
|
PropertyCountUpDown.Value = 0;
|
||||||
@ -433,6 +464,7 @@ public partial class ReCodeItForm : Form
|
|||||||
// Check boxes
|
// Check boxes
|
||||||
|
|
||||||
ForceRenameCheckbox.Checked = false;
|
ForceRenameCheckbox.Checked = false;
|
||||||
|
ConstructorCountEnabled.Checked = false;
|
||||||
MethodCountEnabled.Checked = false;
|
MethodCountEnabled.Checked = false;
|
||||||
FieldCountEnabled.Checked = false;
|
FieldCountEnabled.Checked = false;
|
||||||
PropertyCountEnabled.Checked = false;
|
PropertyCountEnabled.Checked = false;
|
||||||
@ -450,6 +482,82 @@ public partial class ReCodeItForm : Form
|
|||||||
NestedTypesExcludeBox.Items.Clear();
|
NestedTypesExcludeBox.Items.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EditSelectedRemap()
|
||||||
|
{
|
||||||
|
ResetAll();
|
||||||
|
var remap = DataProvider.Remaps.ElementAt(RemapTreeView.SelectedNode.Index);
|
||||||
|
|
||||||
|
NewTypeName.Text = remap.NewTypeName;
|
||||||
|
OriginalTypeName.Text = remap.OriginalTypeName;
|
||||||
|
ForceRenameCheckbox.Checked = remap.UseForceRename;
|
||||||
|
|
||||||
|
BaseClassIncludeTextFIeld.Text = remap.SearchParams.MatchBaseClass;
|
||||||
|
BaseClassExcludeTextField.Text = remap.SearchParams.IgnoreBaseClass;
|
||||||
|
NestedTypeParentName.Text = remap.SearchParams.ParentName;
|
||||||
|
|
||||||
|
ConstructorCountEnabled.Checked = remap.SearchParams.ConstructorParameterCount != null ? remap.SearchParams.ConstructorParameterCount > 0 : false;
|
||||||
|
MethodCountEnabled.Checked = remap.SearchParams.MethodCount != null ? remap.SearchParams.MethodCount > 0 : false;
|
||||||
|
FieldCountEnabled.Checked = remap.SearchParams.FieldCount != null ? remap.SearchParams.FieldCount > 0 : false;
|
||||||
|
PropertyCountEnabled.Checked = remap.SearchParams.PropertyCount != null ? remap.SearchParams.PropertyCount > 0 : false;
|
||||||
|
NestedTypeCountEnabled.Checked = remap.SearchParams.NestedTypeCount != null ? remap.SearchParams.NestedTypeCount > 0 : false;
|
||||||
|
|
||||||
|
ConstuctorCountUpDown.Value = (decimal)((remap.SearchParams.ConstructorParameterCount != null ? remap.SearchParams.ConstructorParameterCount : 0));
|
||||||
|
MethodCountUpDown.Value = (decimal)(remap.SearchParams.MethodCount != null ? remap.SearchParams.MethodCount : 0);
|
||||||
|
FieldCountUpDown.Value = (decimal)(remap.SearchParams.FieldCount != null ? remap.SearchParams.FieldCount : 0);
|
||||||
|
PropertyCountUpDown.Value = (decimal)(remap.SearchParams.PropertyCount != null ? remap.SearchParams.PropertyCount : 0);
|
||||||
|
NestedTypeCountUpDown.Value = (decimal)(remap.SearchParams.NestedTypeCount != null ? remap.SearchParams.NestedTypeCount : 0);
|
||||||
|
|
||||||
|
IsPublicUpDown.BuildStringList("IsPublic", remap.SearchParams.IsPublic);
|
||||||
|
IsAbstractUpDown.BuildStringList("IsAbstract", remap.SearchParams.IsAbstract);
|
||||||
|
IsInterfaceUpDown.BuildStringList("IsInterface", remap.SearchParams.IsInterface);
|
||||||
|
IsEnumUpDown.BuildStringList("IsEnum", remap.SearchParams.IsEnum);
|
||||||
|
IsNestedUpDown.BuildStringList("IsNested", remap.SearchParams.IsNested);
|
||||||
|
IsSealedUpDown.BuildStringList("IsSealed", remap.SearchParams.IsSealed);
|
||||||
|
HasAttributeUpDown.BuildStringList("HasAttribute", remap.SearchParams.HasAttribute);
|
||||||
|
IsDerivedUpDown.BuildStringList("IsDerived", remap.SearchParams.IsDerived);
|
||||||
|
HasGenericParametersUpDown.BuildStringList("HasGenericParams", remap.SearchParams.HasGenericParameters);
|
||||||
|
|
||||||
|
foreach (var method in remap.SearchParams.IncludeMethods)
|
||||||
|
{
|
||||||
|
MethodIncludeBox.Items.Add(method);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var method in remap.SearchParams.ExcludeMethods)
|
||||||
|
{
|
||||||
|
MethodExcludeBox.Items.Add(method);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var method in remap.SearchParams.IncludeFields)
|
||||||
|
{
|
||||||
|
FieldIncludeBox.Items.Add(method);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var method in remap.SearchParams.ExcludeFields)
|
||||||
|
{
|
||||||
|
FieldExcludeBox.Items.Add(method);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var method in remap.SearchParams.IncludeProperties)
|
||||||
|
{
|
||||||
|
PropertiesIncludeBox.Items.Add(method);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var method in remap.SearchParams.ExcludeProperties)
|
||||||
|
{
|
||||||
|
PropertiesExcludeBox.Items.Add(method);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var method in remap.SearchParams.IncludeNestedTypes)
|
||||||
|
{
|
||||||
|
NestedTypesIncludeBox.Items.Add(method);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var method in remap.SearchParams.ExcludeNestedTypes)
|
||||||
|
{
|
||||||
|
NestedTypesExcludeBox.Items.Add(method);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void PopulateDomainUpDowns()
|
private void PopulateDomainUpDowns()
|
||||||
{
|
{
|
||||||
// Clear them all first just incase
|
// Clear them all first just incase
|
||||||
|
@ -38,7 +38,7 @@ internal static class GUIHelpers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="domainUpDown"></param>
|
/// <param name="domainUpDown"></param>
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
public static void BuildStringList(this DomainUpDown domainUpDown, string name)
|
public static void BuildStringList(this DomainUpDown domainUpDown, string name, bool? update = null)
|
||||||
{
|
{
|
||||||
domainUpDown.Items.Clear();
|
domainUpDown.Items.Clear();
|
||||||
domainUpDown.Text = name + " (Disabled)";
|
domainUpDown.Text = name + " (Disabled)";
|
||||||
@ -51,6 +51,11 @@ internal static class GUIHelpers
|
|||||||
"False",
|
"False",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (update != null)
|
||||||
|
{
|
||||||
|
domainUpDown.Text = update.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
domainUpDown.Items.AddRange(list);
|
domainUpDown.Items.AddRange(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +76,7 @@ internal static class GUIHelpers
|
|||||||
var IsDerived = model.SearchParams.IsDerived == null ? null : model.SearchParams.IsDerived;
|
var IsDerived = model.SearchParams.IsDerived == null ? null : model.SearchParams.IsDerived;
|
||||||
var HasGenericParameters = model.SearchParams.HasGenericParameters == null ? null : model.SearchParams.HasGenericParameters;
|
var HasGenericParameters = model.SearchParams.HasGenericParameters == null ? null : model.SearchParams.HasGenericParameters;
|
||||||
|
|
||||||
var remapTreeItem = new TreeNode($"Remap: {model.NewTypeName}");
|
var remapTreeItem = new TreeNode($"{model.NewTypeName}");
|
||||||
|
|
||||||
var originalTypeName = new TreeNode($"Original Name: {model.OriginalTypeName}");
|
var originalTypeName = new TreeNode($"Original Name: {model.OriginalTypeName}");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user