203 lines
6.9 KiB
C#
Raw Normal View History

2024-06-13 21:20:48 -04:00
using AssemblyRemapper.Enums;
using AssemblyRemapper.Models;
using AssemblyRemapper.Remapper;
2024-06-13 20:25:11 -04:00
2024-06-13 18:09:31 -04:00
namespace AssemblyRemapperGUI
{
2024-06-13 20:25:11 -04:00
public partial class AssemblyToolGUI : Form
2024-06-13 18:09:31 -04:00
{
2024-06-13 21:20:48 -04:00
public static Remapper Remapper { get; private set; }
2024-06-13 20:25:11 -04:00
public AssemblyToolGUI()
2024-06-13 18:09:31 -04:00
{
InitializeComponent();
}
2024-06-13 20:25:11 -04:00
#region BUTTONS
2024-06-13 21:20:48 -04:00
/// <summary>
/// Construct a new remap when the button is pressed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2024-06-13 20:25:11 -04:00
private void AddRemapButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
MethodIncludeBox.Items.Add("TEST");
var remap = new RemapModel
{
Succeeded = false,
FailureReason = EFailureReason.None,
NewTypeName = NewTypeName.Text,
OriginalTypeName = OriginalTypeName.Text,
UseForceRename = ForceRenameCheckbox.Checked,
SearchParams = new SearchParams
{
IsPublic = IsPublic.Checked,
IsAbstract = IsAbstract.Checked,
IsInterface = IsInterface.Checked,
IsEnum = IsEnum.Checked,
IsNested = IsNested.Checked,
IsSealed = IsSealed.Checked,
HasAttribute = HasAttribute.Checked,
IsDerived = IsDerived.Checked,
HasGenericParameters = HasGenericParameters.Checked,
ParentName = NestedTypeParentName.Text,
MatchBaseClass = BaseClassExcludeTextField.Text,
IgnoreBaseClass = BaseClassIncludeTextFIeld.Text,
// Constructor
MethodCount = (int)MethodCountUpDown.Value,
FieldCount = (int)FieldCountUpDown.Value,
PropertyCount = (int)PropertiesCountUpDown.Value,
NestedTypeCount = (int)NestedTypeCountUpDown.Value,
IncludeMethods = [],
ExcludeMethods = [],
IncludeFields = [],
ExcludeFields = [],
IncludeProperties = [],
ExcludeProperties = [],
IncludeNestedTypes = [],
ExcludeNestedTypes = [],
}
};
2024-06-13 20:25:11 -04:00
}
private void RemoveRemapButton_Click(object sender, EventArgs e)
{
}
private void ScoreButton_Click(object sender, EventArgs e)
{
}
private void MethodIncludeAddButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (!MethodIncludeBox.Items.Contains(IncludeMethodTextBox.Text))
{
MethodIncludeBox.Items.Add(IncludeMethodTextBox.Text);
}
2024-06-13 20:25:11 -04:00
}
private void MethodIncludeRemoveButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (MethodIncludeBox.SelectedItem != null)
{
MethodIncludeBox.Items.Remove(MethodIncludeBox.SelectedItem);
}
2024-06-13 20:25:11 -04:00
}
private void MethodExcludeAddButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (!MethodExcludeBox.Items.Contains(ExcludeMethodTextBox.Text))
{
MethodExcludeBox.Items.Add(ExcludeMethodTextBox.Text);
}
2024-06-13 20:25:11 -04:00
}
private void MethodExcludeRemoveButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (MethodExcludeBox.SelectedItem != null)
{
MethodExcludeBox.Items.Remove(MethodExcludeBox.SelectedItem);
}
2024-06-13 20:25:11 -04:00
}
private void FIeldIncludeAddButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (!FieldIncludeBox.Items.Contains(FieldsIncludeTextInput.Text))
{
FieldIncludeBox.Items.Add(FieldsIncludeTextInput.Text);
}
2024-06-13 20:25:11 -04:00
}
private void FieldIncludeRemoveButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (FieldIncludeBox.SelectedItem != null)
{
FieldIncludeBox.Items.Remove(FieldIncludeBox.SelectedItem);
}
2024-06-13 20:25:11 -04:00
}
private void FieldExcludeAddButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (!FieldExcludeBox.Items.Contains(FieldsExcludeTextInput.Text))
{
FieldExcludeBox.Items.Add(FieldsExcludeTextInput.Text);
}
2024-06-13 20:25:11 -04:00
}
private void FieldExcludeRemoveButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (FieldExcludeBox.SelectedItem != null)
{
FieldExcludeBox.Items.Remove(FieldExcludeBox.SelectedItem);
}
2024-06-13 20:25:11 -04:00
}
private void PropertiesIncludeAddButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (!PropertiesIncludeBox.Items.Contains(PropertiesIncludeTextField.Text))
{
PropertiesIncludeBox.Items.Add(PropertiesIncludeTextField.Text);
}
2024-06-13 20:25:11 -04:00
}
private void PropertiesIncludeRemoveButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (PropertiesIncludeBox.SelectedItem != null)
{
PropertiesIncludeBox.Items.Remove(PropertiesIncludeBox.SelectedItem);
}
2024-06-13 20:25:11 -04:00
}
private void PropertiesExcludeAddButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (!PropertiesExcludeBox.Items.Contains(PropertiesExcludeTextField.Text))
{
PropertiesExcludeBox.Items.Add(PropertiesExcludeTextField.Text);
}
2024-06-13 20:25:11 -04:00
}
private void PropertiesExcludeRemoveButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (PropertiesExcludeBox.SelectedItem != null)
{
PropertiesExcludeBox.Items.Remove(PropertiesExcludeBox.SelectedItem);
}
2024-06-13 20:25:11 -04:00
}
private void NestedTypesAddButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (!NestedTypesIncludeBox.Items.Contains(NestedTypesIncludeTextField.Text))
{
NestedTypesIncludeBox.Items.Add(NestedTypesIncludeTextField.Text);
}
2024-06-13 20:25:11 -04:00
}
private void NestedTypesRemoveButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (NestedTypesIncludeBox.SelectedItem != null)
{
NestedTypesIncludeBox.Items.Remove(NestedTypesIncludeBox.SelectedItem);
}
2024-06-13 20:25:11 -04:00
}
private void NestedTypesExlcudeAddButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (!NestedTypesExcludeBox.Items.Contains(NestedTypesExcludeTextField.Text))
{
NestedTypesExcludeBox.Items.Add(NestedTypesExcludeTextField.Text);
}
2024-06-13 20:25:11 -04:00
}
private void NestedTypesExcludeRemoveButton_Click(object sender, EventArgs e)
{
2024-06-13 21:20:48 -04:00
if (NestedTypesExcludeBox.SelectedItem != null)
{
NestedTypesExcludeBox.Items.Remove(NestedTypesExcludeBox.SelectedItem);
}
2024-06-13 20:25:11 -04:00
}
#endregion BUTTONS
2024-06-13 18:09:31 -04:00
}
2024-06-13 20:25:11 -04:00
}