More GUI work
This commit is contained in:
parent
f29e22f076
commit
711419e426
@ -243,7 +243,7 @@ public class Remapper
|
||||
var remappedPath = Path.Combine(strippedPath, filename);
|
||||
|
||||
DataProvider.AssemblyDefinition.Write(remappedPath);
|
||||
DataProvider.UpdateMapping();
|
||||
//DataProvider.UpdateMapping();
|
||||
|
||||
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
|
||||
Logger.Log($"Complete: Assembly written to `{remappedPath}`", ConsoleColor.Green);
|
||||
|
@ -10,7 +10,7 @@ public static class DataProvider
|
||||
{
|
||||
}
|
||||
|
||||
public static HashSet<RemapModel> Remaps { get; private set; } = [];
|
||||
public static List<RemapModel> Remaps { get; private set; } = [];
|
||||
|
||||
public static Dictionary<string, HashSet<ScoringModel>> ScoringModels { get; set; } = [];
|
||||
|
||||
@ -41,19 +41,23 @@ public static class DataProvider
|
||||
Logger.Log($"Settings loaded from '{settingsPath}'");
|
||||
}
|
||||
|
||||
public static void LoadMappingFile()
|
||||
public static void LoadMappingFile(string path = "")
|
||||
{
|
||||
if (!File.Exists(Settings.Remapper.MappingPath))
|
||||
{
|
||||
throw new InvalidOperationException($"path `{Settings.Remapper.MappingPath}` does not exist...");
|
||||
}
|
||||
|
||||
var jsonText = File.ReadAllText(Settings.Remapper.MappingPath);
|
||||
var fpath = path == string.Empty
|
||||
? Settings.Remapper.MappingPath
|
||||
: path;
|
||||
|
||||
var jsonText = File.ReadAllText(fpath);
|
||||
|
||||
Remaps = [];
|
||||
ScoringModels = [];
|
||||
|
||||
Remaps = JsonConvert.DeserializeObject<HashSet<RemapModel>>(jsonText);
|
||||
Remaps = JsonConvert.DeserializeObject<List<RemapModel>>(jsonText);
|
||||
|
||||
var properties = typeof(SearchParams).GetProperties();
|
||||
|
||||
@ -71,14 +75,27 @@ public static class DataProvider
|
||||
Logger.Log($"Mapping file loaded from '{Settings.Remapper.MappingPath}'");
|
||||
}
|
||||
|
||||
public static void SaveMapping()
|
||||
{
|
||||
JsonSerializerSettings settings = new()
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
Formatting = Formatting.Indented
|
||||
};
|
||||
|
||||
var jsonText = JsonConvert.SerializeObject(Remaps, settings);
|
||||
|
||||
File.WriteAllText(Settings.Remapper.MappingPath, jsonText);
|
||||
}
|
||||
|
||||
public static void UpdateMapping()
|
||||
{
|
||||
if (!File.Exists(Settings.Remapper.MappingPath))
|
||||
{
|
||||
throw new InvalidOperationException($"path `{Settings.Remapper.MappingPath}` does not exist...");
|
||||
throw new FileNotFoundException($"path `{Settings.Remapper.MappingPath}` does not exist...");
|
||||
}
|
||||
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings
|
||||
JsonSerializerSettings settings = new()
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
Formatting = Formatting.Indented
|
||||
@ -104,19 +121,21 @@ public static class DataProvider
|
||||
var jsonText = JsonConvert.SerializeObject(Remaps, settings);
|
||||
|
||||
File.WriteAllText(Settings.Remapper.MappingPath, jsonText);
|
||||
|
||||
Logger.Log($"Mapping file saved to {Settings.Remapper.MappingPath}");
|
||||
}
|
||||
|
||||
public static void LoadAssemblyDefinition()
|
||||
{
|
||||
DefaultAssemblyResolver resolver = new();
|
||||
resolver.AddSearchDirectory(Path.GetDirectoryName(Settings.Remapper.AssemblyPath)); // Replace with the correct path
|
||||
resolver.AddSearchDirectory(Path.GetDirectoryName(Settings.Remapper.AssemblyPath)); // Replace with the correct path : (6/14) I have no idea what I met by that
|
||||
ReaderParameters parameters = new() { AssemblyResolver = resolver };
|
||||
|
||||
AssemblyDefinition = AssemblyDefinition.ReadAssembly(Settings.Remapper.AssemblyPath, parameters);
|
||||
|
||||
if (AssemblyDefinition is null)
|
||||
{
|
||||
throw new InvalidOperationException("AssemblyDefinition was null...");
|
||||
throw new NullReferenceException("AssemblyDefinition was null...");
|
||||
}
|
||||
|
||||
var fileName = Path.GetFileName(Settings.Remapper.AssemblyPath);
|
||||
|
112
AssemblyRemapperGUI/Form1.Designer.cs
generated
112
AssemblyRemapperGUI/Form1.Designer.cs
generated
@ -33,6 +33,9 @@ partial class AssemblyToolGUI
|
||||
TabPageRemapper = new TabPage();
|
||||
RemapTreeView = new TreeView();
|
||||
groupBox1 = new GroupBox();
|
||||
LoadMappingFileButton = new Button();
|
||||
SaveMappingFileButton = new Button();
|
||||
RunRemapButton = new Button();
|
||||
ScoreButton = new Button();
|
||||
Inclusions = new TabControl();
|
||||
tabPage1 = new TabPage();
|
||||
@ -97,8 +100,6 @@ partial class AssemblyToolGUI
|
||||
MethodCountEnabled = new CheckBox();
|
||||
IsSealedUpDown = new DomainUpDown();
|
||||
TabControlMain = new TabControl();
|
||||
menuStrip1 = new MenuStrip();
|
||||
SettingsButton = new ToolStripMenuItem();
|
||||
colorDialog1 = new ColorDialog();
|
||||
((System.ComponentModel.ISupportInitialize)bindingSource1).BeginInit();
|
||||
TabPageRemapper.SuspendLayout();
|
||||
@ -113,7 +114,6 @@ partial class AssemblyToolGUI
|
||||
((System.ComponentModel.ISupportInitialize)MethodCountUpDown).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)NestedTypeCountUpDown).BeginInit();
|
||||
TabControlMain.SuspendLayout();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// TabPageRemapper
|
||||
@ -124,7 +124,7 @@ partial class AssemblyToolGUI
|
||||
TabPageRemapper.Location = new Point(4, 34);
|
||||
TabPageRemapper.Name = "TabPageRemapper";
|
||||
TabPageRemapper.Padding = new Padding(3);
|
||||
TabPageRemapper.Size = new Size(1695, 1055);
|
||||
TabPageRemapper.Size = new Size(1336, 953);
|
||||
TabPageRemapper.TabIndex = 1;
|
||||
TabPageRemapper.Text = "Remapper";
|
||||
//
|
||||
@ -137,6 +137,9 @@ partial class AssemblyToolGUI
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Controls.Add(LoadMappingFileButton);
|
||||
groupBox1.Controls.Add(SaveMappingFileButton);
|
||||
groupBox1.Controls.Add(RunRemapButton);
|
||||
groupBox1.Controls.Add(ScoreButton);
|
||||
groupBox1.Controls.Add(Inclusions);
|
||||
groupBox1.Controls.Add(NewTypeName);
|
||||
@ -171,6 +174,36 @@ partial class AssemblyToolGUI
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Remap Editor";
|
||||
//
|
||||
// LoadMappingFileButton
|
||||
//
|
||||
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.Click += LoadMappingFileButton_Click;
|
||||
//
|
||||
// SaveMappingFileButton
|
||||
//
|
||||
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.Click += SaveMappingFileButton_Click;
|
||||
//
|
||||
// RunRemapButton
|
||||
//
|
||||
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.Click += RunRemapButton_Click;
|
||||
//
|
||||
// ScoreButton
|
||||
//
|
||||
ScoreButton.Location = new Point(580, 145);
|
||||
@ -187,15 +220,16 @@ partial class AssemblyToolGUI
|
||||
Inclusions.Controls.Add(tabPage2);
|
||||
Inclusions.Controls.Add(tabPage3);
|
||||
Inclusions.Controls.Add(tabPage4);
|
||||
Inclusions.Location = new Point(6, 453);
|
||||
Inclusions.Location = new Point(6, 529);
|
||||
Inclusions.Name = "Inclusions";
|
||||
Inclusions.SelectedIndex = 0;
|
||||
Inclusions.Size = new Size(751, 455);
|
||||
Inclusions.Size = new Size(751, 364);
|
||||
Inclusions.TabIndex = 14;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
tabPage1.BackColor = SystemColors.ControlDarkDark;
|
||||
tabPage1.BorderStyle = BorderStyle.FixedSingle;
|
||||
tabPage1.Controls.Add(ExcludeMethodTextBox);
|
||||
tabPage1.Controls.Add(IncludeMethodTextBox);
|
||||
tabPage1.Controls.Add(MethodExcludeRemoveButton);
|
||||
@ -207,7 +241,7 @@ partial class AssemblyToolGUI
|
||||
tabPage1.Location = new Point(4, 34);
|
||||
tabPage1.Name = "tabPage1";
|
||||
tabPage1.Padding = new Padding(3);
|
||||
tabPage1.Size = new Size(743, 417);
|
||||
tabPage1.Size = new Size(743, 326);
|
||||
tabPage1.TabIndex = 0;
|
||||
tabPage1.Text = "Methods";
|
||||
//
|
||||
@ -299,7 +333,7 @@ partial class AssemblyToolGUI
|
||||
tabPage2.Location = new Point(4, 34);
|
||||
tabPage2.Name = "tabPage2";
|
||||
tabPage2.Padding = new Padding(3);
|
||||
tabPage2.Size = new Size(743, 417);
|
||||
tabPage2.Size = new Size(743, 326);
|
||||
tabPage2.TabIndex = 1;
|
||||
tabPage2.Text = "Fields";
|
||||
//
|
||||
@ -391,7 +425,7 @@ partial class AssemblyToolGUI
|
||||
tabPage3.Location = new Point(4, 34);
|
||||
tabPage3.Name = "tabPage3";
|
||||
tabPage3.Padding = new Padding(3);
|
||||
tabPage3.Size = new Size(743, 417);
|
||||
tabPage3.Size = new Size(743, 326);
|
||||
tabPage3.TabIndex = 2;
|
||||
tabPage3.Text = "Properties";
|
||||
//
|
||||
@ -483,7 +517,7 @@ partial class AssemblyToolGUI
|
||||
tabPage4.Location = new Point(4, 34);
|
||||
tabPage4.Name = "tabPage4";
|
||||
tabPage4.Padding = new Padding(3);
|
||||
tabPage4.Size = new Size(743, 417);
|
||||
tabPage4.Size = new Size(743, 326);
|
||||
tabPage4.TabIndex = 3;
|
||||
tabPage4.Text = "Other";
|
||||
//
|
||||
@ -591,9 +625,6 @@ partial class AssemblyToolGUI
|
||||
//
|
||||
// IsInterfaceUpDown
|
||||
//
|
||||
IsInterfaceUpDown.Items.Add("Disabled");
|
||||
IsInterfaceUpDown.Items.Add("False");
|
||||
IsInterfaceUpDown.Items.Add("True");
|
||||
IsInterfaceUpDown.Location = new Point(10, 183);
|
||||
IsInterfaceUpDown.Name = "IsInterfaceUpDown";
|
||||
IsInterfaceUpDown.Size = new Size(208, 31);
|
||||
@ -637,9 +668,6 @@ partial class AssemblyToolGUI
|
||||
//
|
||||
// IsPublicUpDown
|
||||
//
|
||||
IsPublicUpDown.Items.Add("Disabled");
|
||||
IsPublicUpDown.Items.Add("False");
|
||||
IsPublicUpDown.Items.Add("True");
|
||||
IsPublicUpDown.Location = new Point(10, 107);
|
||||
IsPublicUpDown.Name = "IsPublicUpDown";
|
||||
IsPublicUpDown.Size = new Size(208, 31);
|
||||
@ -674,9 +702,6 @@ partial class AssemblyToolGUI
|
||||
//
|
||||
// IsAbstractUpDown
|
||||
//
|
||||
IsAbstractUpDown.Items.Add("Disabled");
|
||||
IsAbstractUpDown.Items.Add("False");
|
||||
IsAbstractUpDown.Items.Add("True");
|
||||
IsAbstractUpDown.Location = new Point(10, 144);
|
||||
IsAbstractUpDown.Name = "IsAbstractUpDown";
|
||||
IsAbstractUpDown.Size = new Size(208, 31);
|
||||
@ -702,9 +727,6 @@ partial class AssemblyToolGUI
|
||||
//
|
||||
// HasGenericParametersUpDown
|
||||
//
|
||||
HasGenericParametersUpDown.Items.Add("Disabled");
|
||||
HasGenericParametersUpDown.Items.Add("False");
|
||||
HasGenericParametersUpDown.Items.Add("True");
|
||||
HasGenericParametersUpDown.Location = new Point(10, 366);
|
||||
HasGenericParametersUpDown.Name = "HasGenericParametersUpDown";
|
||||
HasGenericParametersUpDown.Size = new Size(208, 31);
|
||||
@ -714,9 +736,6 @@ partial class AssemblyToolGUI
|
||||
//
|
||||
// IsEnumUpDown
|
||||
//
|
||||
IsEnumUpDown.Items.Add("Disabled");
|
||||
IsEnumUpDown.Items.Add("False");
|
||||
IsEnumUpDown.Items.Add("True");
|
||||
IsEnumUpDown.Location = new Point(10, 255);
|
||||
IsEnumUpDown.Name = "IsEnumUpDown";
|
||||
IsEnumUpDown.Size = new Size(208, 31);
|
||||
@ -743,9 +762,6 @@ partial class AssemblyToolGUI
|
||||
//
|
||||
// IsDerivedUpDown
|
||||
//
|
||||
IsDerivedUpDown.Items.Add("Disabled");
|
||||
IsDerivedUpDown.Items.Add("False");
|
||||
IsDerivedUpDown.Items.Add("True");
|
||||
IsDerivedUpDown.Location = new Point(10, 329);
|
||||
IsDerivedUpDown.Name = "IsDerivedUpDown";
|
||||
IsDerivedUpDown.Size = new Size(208, 31);
|
||||
@ -755,9 +771,6 @@ partial class AssemblyToolGUI
|
||||
//
|
||||
// IsNestedUpDown
|
||||
//
|
||||
IsNestedUpDown.Items.Add("Disabled");
|
||||
IsNestedUpDown.Items.Add("False");
|
||||
IsNestedUpDown.Items.Add("True");
|
||||
IsNestedUpDown.Location = new Point(10, 68);
|
||||
IsNestedUpDown.Name = "IsNestedUpDown";
|
||||
IsNestedUpDown.Size = new Size(208, 31);
|
||||
@ -767,9 +780,6 @@ partial class AssemblyToolGUI
|
||||
//
|
||||
// HasAttributeUpDown
|
||||
//
|
||||
HasAttributeUpDown.Items.Add("Disabled");
|
||||
HasAttributeUpDown.Items.Add("False");
|
||||
HasAttributeUpDown.Items.Add("True");
|
||||
HasAttributeUpDown.Location = new Point(10, 292);
|
||||
HasAttributeUpDown.Name = "HasAttributeUpDown";
|
||||
HasAttributeUpDown.Size = new Size(208, 31);
|
||||
@ -797,9 +807,6 @@ partial class AssemblyToolGUI
|
||||
//
|
||||
// IsSealedUpDown
|
||||
//
|
||||
IsSealedUpDown.Items.Add("Disabled");
|
||||
IsSealedUpDown.Items.Add("False");
|
||||
IsSealedUpDown.Items.Add("True");
|
||||
IsSealedUpDown.Location = new Point(10, 218);
|
||||
IsSealedUpDown.Name = "IsSealedUpDown";
|
||||
IsSealedUpDown.Size = new Size(208, 31);
|
||||
@ -810,36 +817,19 @@ partial class AssemblyToolGUI
|
||||
// TabControlMain
|
||||
//
|
||||
TabControlMain.Controls.Add(TabPageRemapper);
|
||||
TabControlMain.Location = new Point(12, 40);
|
||||
TabControlMain.Location = new Point(-5, 1);
|
||||
TabControlMain.Name = "TabControlMain";
|
||||
TabControlMain.SelectedIndex = 0;
|
||||
TabControlMain.Size = new Size(1703, 1093);
|
||||
TabControlMain.Size = new Size(1344, 991);
|
||||
TabControlMain.TabIndex = 6;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.ImageScalingSize = new Size(24, 24);
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { SettingsButton });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(1297, 33);
|
||||
menuStrip1.TabIndex = 7;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// SettingsButton
|
||||
//
|
||||
SettingsButton.Name = "SettingsButton";
|
||||
SettingsButton.Size = new Size(92, 29);
|
||||
SettingsButton.Text = "Settings";
|
||||
//
|
||||
// AssemblyToolGUI
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = SystemColors.ControlDarkDark;
|
||||
ClientSize = new Size(1297, 998);
|
||||
ClientSize = new Size(1297, 966);
|
||||
Controls.Add(TabControlMain);
|
||||
Controls.Add(menuStrip1);
|
||||
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||
Name = "AssemblyToolGUI";
|
||||
Text = "Cj's Assembly Tool V0.1.0";
|
||||
@ -861,10 +851,7 @@ partial class AssemblyToolGUI
|
||||
((System.ComponentModel.ISupportInitialize)MethodCountUpDown).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)NestedTypeCountUpDown).EndInit();
|
||||
TabControlMain.ResumeLayout(false);
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -923,8 +910,6 @@ partial class AssemblyToolGUI
|
||||
private Button AddRemapButton;
|
||||
private ListView RemapListView;
|
||||
private TabControl TabControlMain;
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem SettingsButton;
|
||||
private DomainUpDown IsPublicUpDown;
|
||||
private ColorDialog colorDialog1;
|
||||
private DomainUpDown HasGenericParametersUpDown;
|
||||
@ -940,4 +925,7 @@ partial class AssemblyToolGUI
|
||||
private CheckBox NestedTypeCountEnabled;
|
||||
private DomainUpDown IsInterfaceUpDown;
|
||||
private TreeView RemapTreeView;
|
||||
private Button SaveMappingFileButton;
|
||||
private Button RunRemapButton;
|
||||
private Button LoadMappingFileButton;
|
||||
}
|
||||
|
@ -1,21 +1,30 @@
|
||||
using AssemblyRemapper.Enums;
|
||||
using AssemblyRemapper.Models;
|
||||
using AssemblyRemapper.Remapper;
|
||||
using AssemblyRemapper.Utils;
|
||||
using RemapperGUI.Utils;
|
||||
|
||||
namespace AssemblyRemapperGUI
|
||||
{
|
||||
public partial class AssemblyToolGUI : Form
|
||||
{
|
||||
public static Remapper Remapper { get; private set; }
|
||||
public static Remapper Remapper { get; private set; } = new();
|
||||
|
||||
public AssemblyToolGUI()
|
||||
{
|
||||
InitializeComponent();
|
||||
PopulateDomainUpDowns();
|
||||
|
||||
foreach (var remap in DataProvider.Remaps)
|
||||
{
|
||||
RemapTreeView.Nodes.Add(GUI.GenerateTreeNode(remap));
|
||||
}
|
||||
}
|
||||
|
||||
#region BUTTONS
|
||||
|
||||
#region MAIN_BUTTONS
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new remap when the button is pressed
|
||||
/// </summary>
|
||||
@ -25,7 +34,7 @@ namespace AssemblyRemapperGUI
|
||||
{
|
||||
if (NewTypeName.Text == string.Empty)
|
||||
{
|
||||
MessageBox.Show("Please enter a new type name", "Invald data");
|
||||
MessageBox.Show("Please enter a new type name", "Invalid data");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -77,10 +86,13 @@ namespace AssemblyRemapperGUI
|
||||
};
|
||||
|
||||
RemapTreeView.Nodes.Add(GUI.GenerateTreeNode(remap));
|
||||
DataProvider.Remaps.Add(remap);
|
||||
ResetAll();
|
||||
}
|
||||
|
||||
private void RemoveRemapButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DataProvider.Remaps?.RemoveAt(RemapTreeView.SelectedNode.Index);
|
||||
RemapTreeView.SelectedNode?.Remove();
|
||||
}
|
||||
|
||||
@ -88,6 +100,52 @@ namespace AssemblyRemapperGUI
|
||||
{
|
||||
}
|
||||
|
||||
private void RunRemapButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Remapper.InitializeRemap();
|
||||
}
|
||||
|
||||
private void SaveMappingFileButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show(
|
||||
"Are you sure?",
|
||||
"Confirmation",
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Exclamation,
|
||||
MessageBoxDefaultButton.Button2) == DialogResult.Yes)
|
||||
{
|
||||
DataProvider.SaveMapping();
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadMappingFileButton_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)
|
||||
{
|
||||
var fileName = fDialog.FileName;
|
||||
|
||||
DataProvider.LoadMappingFile(fileName);
|
||||
}
|
||||
|
||||
RemapTreeView.Nodes.Clear();
|
||||
|
||||
foreach (var remap in DataProvider.Remaps)
|
||||
{
|
||||
RemapTreeView.Nodes.Add(GUI.GenerateTreeNode(remap));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion MAIN_BUTTONS
|
||||
|
||||
#region LISTBOX_BUTTONS
|
||||
|
||||
private void MethodIncludeAddButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MethodIncludeBox.Items.Contains(IncludeMethodTextBox.Text))
|
||||
@ -216,6 +274,70 @@ namespace AssemblyRemapperGUI
|
||||
}
|
||||
}
|
||||
|
||||
#endregion LISTBOX_BUTTONS
|
||||
|
||||
#endregion BUTTONS
|
||||
|
||||
// Reset All UI elements to default
|
||||
private void ResetAll()
|
||||
{
|
||||
PopulateDomainUpDowns();
|
||||
|
||||
// Text fields
|
||||
|
||||
NewTypeName.Clear();
|
||||
BaseClassIncludeTextFIeld.Clear();
|
||||
BaseClassExcludeTextField.Clear();
|
||||
NestedTypeParentName.Clear();
|
||||
BaseClassExcludeTextField.Clear();
|
||||
IncludeMethodTextBox.Clear();
|
||||
ExcludeMethodTextBox.Clear();
|
||||
FieldsIncludeTextInput.Clear();
|
||||
FieldsExcludeTextInput.Clear();
|
||||
PropertiesIncludeTextField.Clear();
|
||||
PropertiesExcludeTextField.Clear();
|
||||
NestedTypesIncludeTextField.Clear();
|
||||
NestedTypesExcludeTextField.Clear();
|
||||
|
||||
// Numeric UpDowns
|
||||
|
||||
MethodCountUpDown.Value = 0;
|
||||
FieldCountUpDown.Value = 0;
|
||||
PropertyCountUpDown.Value = 0;
|
||||
NestedTypeCountUpDown.Value = 0;
|
||||
|
||||
// Check boxes
|
||||
|
||||
ForceRenameCheckbox.Checked = false;
|
||||
MethodCountEnabled.Checked = false;
|
||||
FieldCountEnabled.Checked = false;
|
||||
PropertyCountEnabled.Checked = false;
|
||||
NestedTypeCountEnabled.Checked = false;
|
||||
|
||||
// List boxes
|
||||
|
||||
MethodIncludeBox.Items.Clear();
|
||||
MethodExcludeBox.Items.Clear();
|
||||
FieldIncludeBox.Items.Clear();
|
||||
FieldExcludeBox.Items.Clear();
|
||||
PropertiesIncludeBox.Items.Clear();
|
||||
PropertiesExcludeBox.Items.Clear();
|
||||
NestedTypesIncludeBox.Items.Clear();
|
||||
NestedTypesExcludeBox.Items.Clear();
|
||||
}
|
||||
|
||||
private void PopulateDomainUpDowns()
|
||||
{
|
||||
// Clear them all first just incase
|
||||
IsPublicUpDown.BuildStringList("IsPublic");
|
||||
IsAbstractUpDown.BuildStringList("IsAbstract");
|
||||
IsInterfaceUpDown.BuildStringList("IsInterface");
|
||||
IsEnumUpDown.BuildStringList("IsEnum");
|
||||
IsNestedUpDown.BuildStringList("IsNested");
|
||||
IsSealedUpDown.BuildStringList("IsSealed");
|
||||
HasAttributeUpDown.BuildStringList("HasAttribute");
|
||||
IsDerivedUpDown.BuildStringList("IsDerived");
|
||||
HasGenericParametersUpDown.BuildStringList("HasGenericParams");
|
||||
}
|
||||
}
|
||||
}
|
@ -120,9 +120,6 @@
|
||||
<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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>209, 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>
|
||||
|
@ -1,5 +1,4 @@
|
||||
using AssemblyRemapper.Models;
|
||||
using AssemblyRemapper.Utils;
|
||||
|
||||
namespace RemapperGUI.Utils;
|
||||
|
||||
@ -34,6 +33,27 @@ internal static class GUI
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds the name list for the this updown
|
||||
/// </summary>
|
||||
/// <param name="domainUpDown"></param>
|
||||
/// <param name="name"></param>
|
||||
public static void BuildStringList(this DomainUpDown domainUpDown, string name)
|
||||
{
|
||||
domainUpDown.Items.Clear();
|
||||
domainUpDown.Text = name + " (Disabled)";
|
||||
domainUpDown.ReadOnly = true;
|
||||
|
||||
var list = new List<string>
|
||||
{
|
||||
name + " (Disabled)",
|
||||
"True",
|
||||
"False",
|
||||
};
|
||||
|
||||
domainUpDown.Items.AddRange(list);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a tree node to display on the GUI
|
||||
/// </summary>
|
||||
@ -73,6 +93,31 @@ internal static class GUI
|
||||
|
||||
var HasGenericsNode = new TreeNode($"HasGenericParameters: {(HasGenericParameters != null ? HasGenericParameters : "Disabled")}");
|
||||
|
||||
if (model.SearchParams.ConstructorParameterCount > 0)
|
||||
{
|
||||
remapTreeItem.Nodes.Add(new TreeNode($"Constructor Parameter Count: {model.SearchParams.ConstructorParameterCount}"));
|
||||
}
|
||||
|
||||
if (model.SearchParams.MethodCount > 0)
|
||||
{
|
||||
remapTreeItem.Nodes.Add(new TreeNode($"Method Count: {model.SearchParams.MethodCount}"));
|
||||
}
|
||||
|
||||
if (model.SearchParams.FieldCount > 0)
|
||||
{
|
||||
remapTreeItem.Nodes.Add(new TreeNode($"Field Count: {model.SearchParams.FieldCount}"));
|
||||
}
|
||||
|
||||
if (model.SearchParams.PropertyCount > 0)
|
||||
{
|
||||
remapTreeItem.Nodes.Add(new TreeNode($"Property Count: {model.SearchParams.PropertyCount}"));
|
||||
}
|
||||
|
||||
if (model.SearchParams.NestedTypeCount > 0)
|
||||
{
|
||||
remapTreeItem.Nodes.Add(new TreeNode($"Nested Type Count: {model.SearchParams.NestedTypeCount}"));
|
||||
}
|
||||
|
||||
remapTreeItem.Nodes.Add(forceRenameNode);
|
||||
remapTreeItem.Nodes.Add(ispublicNode);
|
||||
remapTreeItem.Nodes.Add(isAbstractNode);
|
||||
@ -180,7 +225,6 @@ internal static class GUI
|
||||
|
||||
foreach (var entry in lb.Items)
|
||||
{
|
||||
Logger.Log(entry);
|
||||
tmp.Add((string)entry);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user