mirror of
https://github.com/sp-tarkov/assembly-tool.git
synced 2025-02-13 05:10:46 -05:00
Remove GUI
This commit is contained in:
parent
1891c872e1
commit
9798d896ba
File diff suppressed because it is too large
Load Diff
22
RecodeIt.sln
22
RecodeIt.sln
@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.9.34728.123
|
VisualStudioVersion = 17.9.34728.123
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
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}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReCodeItLib", "RecodeItLib\ReCodeItLib.csproj", "{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReCodeItCLI", "ReCodeItCLI\ReCodeItCLI.csproj", "{E404EC0B-06D2-4964-8ABA-A634F259655C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReCodeItCLI", "ReCodeItCLI\ReCodeItCLI.csproj", "{E404EC0B-06D2-4964-8ABA-A634F259655C}"
|
||||||
@ -39,26 +37,6 @@ Global
|
|||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{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}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Debug|ARM.Build.0 = Debug|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Debug|ARM64.Build.0 = Debug|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Release|ARM.ActiveCfg = Release|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Release|ARM.Build.0 = Release|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Release|ARM64.ActiveCfg = Release|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Release|ARM64.Build.0 = Release|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{7C4A62CE-8072-454F-9D95-6CB4D837F485}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||||
|
1619
RecodeItGUI/GUI/Main.Designer.cs
generated
1619
RecodeItGUI/GUI/Main.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -1,994 +0,0 @@
|
|||||||
using ReCodeItLib.Models;
|
|
||||||
using ReCodeItLib.ReMapper;
|
|
||||||
using ReCodeItLib.Utils;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace ReCodeIt.GUI;
|
|
||||||
|
|
||||||
public partial class ReCodeItForm : Form
|
|
||||||
{
|
|
||||||
private static ReMapper Remapper { get; set; } = new();
|
|
||||||
private static Settings AppSettings => DataProvider.Settings;
|
|
||||||
|
|
||||||
private bool _isSearched = false;
|
|
||||||
public static Dictionary<TreeNode, RemapModel> RemapNodes = [];
|
|
||||||
|
|
||||||
private int _selectedRemapTreeIndex = 0;
|
|
||||||
private int _selectedCCRemapTreeIndex = 0;
|
|
||||||
|
|
||||||
private List<string> _cachedNewTypeNames = [];
|
|
||||||
|
|
||||||
public ReCodeItForm()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
|
|
||||||
SubscribeToEvents();
|
|
||||||
PopulateDomainUpDowns();
|
|
||||||
RefreshSettingsPage();
|
|
||||||
LoadMappingFile();
|
|
||||||
|
|
||||||
var remaps = DataProvider.Remaps;
|
|
||||||
|
|
||||||
ReloadRemapTreeView(remaps);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SubscribeToEvents()
|
|
||||||
{
|
|
||||||
RemapTreeView.NodeMouseDoubleClick += ManualEditSelectedRemap;
|
|
||||||
Remapper.OnComplete += ReloadTreeAfterMapping;
|
|
||||||
|
|
||||||
#region MANUAL_REMAPPER
|
|
||||||
|
|
||||||
NewTypeName.GotFocus += (sender, e) =>
|
|
||||||
{
|
|
||||||
_cachedNewTypeNames.Add(NewTypeName.Text);
|
|
||||||
};
|
|
||||||
|
|
||||||
IncludeMethodTextBox.KeyDown += (sender, e) =>
|
|
||||||
{
|
|
||||||
if (e.KeyCode == Keys.Enter)
|
|
||||||
{
|
|
||||||
MethodIncludeAddButton_Click(sender, e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ExcludeMethodTextBox.KeyDown += (sender, e) =>
|
|
||||||
{
|
|
||||||
if (e.KeyCode == Keys.Enter)
|
|
||||||
{
|
|
||||||
MethodExcludeAddButton_Click(sender, e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
FieldsIncludeTextInput.KeyDown += (sender, e) =>
|
|
||||||
{
|
|
||||||
if (e.KeyCode == Keys.Enter)
|
|
||||||
{
|
|
||||||
FIeldIncludeAddButton_Click(sender, e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
FieldsExcludeTextInput.KeyDown += (sender, e) =>
|
|
||||||
{
|
|
||||||
if (e.KeyCode == Keys.Enter)
|
|
||||||
{
|
|
||||||
FieldExcludeAddButton_Click(sender, e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
PropertiesIncludeTextField.KeyDown += (sender, e) =>
|
|
||||||
{
|
|
||||||
if (e.KeyCode == Keys.Enter)
|
|
||||||
{
|
|
||||||
PropertiesIncludeAddButton_Click(sender, e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
PropertiesExcludeTextField.KeyDown += (sender, e) =>
|
|
||||||
{
|
|
||||||
if (e.KeyCode == Keys.Enter)
|
|
||||||
{
|
|
||||||
PropertiesExcludeAddButton_Click(sender, e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
NestedTypesIncludeTextField.KeyDown += (sender, e) =>
|
|
||||||
{
|
|
||||||
if (e.KeyCode == Keys.Enter)
|
|
||||||
{
|
|
||||||
NestedTypesAddButton_Click(sender, e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
NestedTypesExcludeTextField.KeyDown += (sender, e) =>
|
|
||||||
{
|
|
||||||
if (e.KeyCode == Keys.Enter)
|
|
||||||
{
|
|
||||||
NestedTypesExlcudeAddButton_Click(sender, e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EventsIncludeTextField.KeyDown += (sender, e) =>
|
|
||||||
{
|
|
||||||
if (e.KeyCode == Keys.Enter)
|
|
||||||
{
|
|
||||||
EventsAddButton_Click(sender, e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EventsExcludeTextField.KeyDown += (sender, e) =>
|
|
||||||
{
|
|
||||||
if (e.KeyCode == Keys.Enter)
|
|
||||||
{
|
|
||||||
EventsExcludeAddButton_Click(sender, e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endregion MANUAL_REMAPPER
|
|
||||||
}
|
|
||||||
|
|
||||||
#region MANUAL_REMAPPER
|
|
||||||
|
|
||||||
private void LoadMappingFile()
|
|
||||||
{
|
|
||||||
DataProvider.Remaps = DataProvider.LoadMappingFile(AppSettings.Remapper.MappingPath);
|
|
||||||
LoadedMappingFilePath.Text = AppSettings.Remapper.MappingPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region BUTTONS
|
|
||||||
|
|
||||||
#region MAIN_BUTTONS
|
|
||||||
|
|
||||||
private void SearchTreeView(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (RemapTreeView.Nodes.Count == 0) { return; }
|
|
||||||
if (RMSearchBox.Text == string.Empty) { return; }
|
|
||||||
|
|
||||||
bool projectMode = AppSettings.Remapper.UseProjectMappings;
|
|
||||||
|
|
||||||
var remaps = DataProvider.Remaps;
|
|
||||||
|
|
||||||
var matches = remaps
|
|
||||||
.Where(x => x.NewTypeName == RMSearchBox.Text
|
|
||||||
|| x.NewTypeName.StartsWith(RMSearchBox.Text));
|
|
||||||
|
|
||||||
if (!matches.Any()) { return; }
|
|
||||||
|
|
||||||
RemapTreeView.Nodes.Clear();
|
|
||||||
|
|
||||||
foreach (var match in matches)
|
|
||||||
{
|
|
||||||
RemapTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(match, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
_isSearched = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ResetSearchButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
bool projectMode = AppSettings.Remapper.UseProjectMappings;
|
|
||||||
|
|
||||||
var remaps = DataProvider.Remaps;
|
|
||||||
|
|
||||||
RemapTreeView.Nodes.Clear();
|
|
||||||
ReloadRemapTreeView(remaps);
|
|
||||||
|
|
||||||
RMSearchBox.Clear();
|
|
||||||
_isSearched = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private RemapModel? CreateRemapFromGUI()
|
|
||||||
{
|
|
||||||
if (NewTypeName.Text == string.Empty)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Please enter a new type name", "Invalid data");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var newRemap = new RemapModel
|
|
||||||
{
|
|
||||||
Succeeded = false,
|
|
||||||
NoMatchReasons = [],
|
|
||||||
NewTypeName = NewTypeName.Text,
|
|
||||||
OriginalTypeName = OriginalTypeName.Text == string.Empty ? null : OriginalTypeName.Text,
|
|
||||||
UseForceRename = RemapperUseForceRename.Checked,
|
|
||||||
SearchParams = new SearchParams
|
|
||||||
{
|
|
||||||
GenericParams =
|
|
||||||
{
|
|
||||||
IsPublic = bool.Parse(IsPublicComboBox.GetSelectedItem<string>().AsSpan()),
|
|
||||||
|
|
||||||
IsAbstract = IsAbstractComboBox.SelectedItem as string != "Disabled"
|
|
||||||
? bool.Parse(IsAbstractComboBox.GetSelectedItem<string>().AsSpan())
|
|
||||||
: null,
|
|
||||||
|
|
||||||
IsSealed = IsSealedComboBox.SelectedItem as string != "Disabled"
|
|
||||||
? bool.Parse(IsSealedComboBox.GetSelectedItem<string>().AsSpan())
|
|
||||||
: null,
|
|
||||||
|
|
||||||
IsInterface = IsInterfaceComboBox.SelectedItem as string != "Disabled"
|
|
||||||
? bool.Parse(IsInterfaceComboBox.GetSelectedItem<string>().AsSpan())
|
|
||||||
: null,
|
|
||||||
|
|
||||||
IsStruct = IsStructComboBox.SelectedItem as string != "Disabled"
|
|
||||||
? bool.Parse(IsStructComboBox.GetSelectedItem<string>().AsSpan())
|
|
||||||
: null,
|
|
||||||
|
|
||||||
IsEnum = IsEnumComboBox.SelectedItem as string != "Disabled"
|
|
||||||
? bool.Parse(IsEnumComboBox.GetSelectedItem<string>().AsSpan())
|
|
||||||
: null,
|
|
||||||
|
|
||||||
HasAttribute = HasAttributeComboBox.SelectedItem as string != "Disabled"
|
|
||||||
? bool.Parse(HasAttributeComboBox.GetSelectedItem<string>().AsSpan())
|
|
||||||
: null,
|
|
||||||
|
|
||||||
HasGenericParameters = HasGenericParamsComboBox.SelectedItem as string != "Disabled"
|
|
||||||
? bool.Parse(HasGenericParamsComboBox.GetSelectedItem<string>().AsSpan())
|
|
||||||
: null,
|
|
||||||
|
|
||||||
|
|
||||||
IsDerived = IsDerivedUpDown.GetEnabled(),
|
|
||||||
|
|
||||||
MatchBaseClass = BaseClassIncludeTextFIeld.Text == string.Empty
|
|
||||||
? null
|
|
||||||
: BaseClassIncludeTextFIeld.Text,
|
|
||||||
},
|
|
||||||
|
|
||||||
Methods =
|
|
||||||
{
|
|
||||||
ConstructorParameterCount = (int)ConstructorCountEnabled.GetCount(ConstuctorCountUpDown),
|
|
||||||
MethodCount = (int)MethodCountEnabled.GetCount(MethodCountUpDown),
|
|
||||||
IncludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodIncludeBox).ToHashSet(),
|
|
||||||
ExcludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodExcludeBox).ToHashSet(),
|
|
||||||
},
|
|
||||||
Fields =
|
|
||||||
{
|
|
||||||
FieldCount = (int)FieldCountEnabled.GetCount(FieldCountUpDown),
|
|
||||||
IncludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldIncludeBox).ToHashSet(),
|
|
||||||
ExcludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldExcludeBox).ToHashSet(),
|
|
||||||
},
|
|
||||||
Properties =
|
|
||||||
{
|
|
||||||
PropertyCount = (int)PropertyCountEnabled.GetCount(PropertyCountUpDown),
|
|
||||||
IncludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesIncludeBox).ToHashSet(),
|
|
||||||
ExcludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesExcludeBox).ToHashSet(),
|
|
||||||
},
|
|
||||||
NestedTypes =
|
|
||||||
{
|
|
||||||
IsNested = IsNestedUpDown.GetEnabled(),
|
|
||||||
NestedTypeParentName = NestedTypeParentName.Text == string.Empty
|
|
||||||
? null
|
|
||||||
: NestedTypeParentName.Text,
|
|
||||||
NestedTypeCount = (int)NestedTypeCountEnabled.GetCount(NestedTypeCountUpDown),
|
|
||||||
IncludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesIncludeBox).ToHashSet(),
|
|
||||||
ExcludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesExcludeBox).ToHashSet(),
|
|
||||||
},
|
|
||||||
Events =
|
|
||||||
{
|
|
||||||
IncludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsIncludeBox).ToHashSet(),
|
|
||||||
ExcludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsExcludeBox).ToHashSet()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return newRemap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Construct a new remap when the button is pressed
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void AddRemapButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
ResetSearchButton_Click(this, e);
|
|
||||||
|
|
||||||
var newRemap = CreateRemapFromGUI();
|
|
||||||
|
|
||||||
if (newRemap is null) return;
|
|
||||||
|
|
||||||
bool projectMode = AppSettings.Remapper.UseProjectMappings;
|
|
||||||
|
|
||||||
Logger.Log(projectMode);
|
|
||||||
|
|
||||||
var remaps = DataProvider.Remaps;
|
|
||||||
|
|
||||||
var existingRemap = remaps
|
|
||||||
.FirstOrDefault(remap => remap.NewTypeName == newRemap.NewTypeName);
|
|
||||||
|
|
||||||
if (existingRemap == null)
|
|
||||||
{
|
|
||||||
existingRemap = remaps
|
|
||||||
.FirstOrDefault(remap => _cachedNewTypeNames.Contains(remap.NewTypeName));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle overwriting an existing remap
|
|
||||||
if (existingRemap != null)
|
|
||||||
{
|
|
||||||
var index = remaps.IndexOf(existingRemap);
|
|
||||||
|
|
||||||
remaps.Remove(existingRemap);
|
|
||||||
RemapTreeView.Nodes.RemoveAt(index);
|
|
||||||
|
|
||||||
remaps.Insert(index, newRemap);
|
|
||||||
RemapTreeView.Nodes.Insert(index, GUIHelpers.GenerateTreeNode(newRemap, this));
|
|
||||||
|
|
||||||
DataProvider.SaveMapping();
|
|
||||||
|
|
||||||
ReloadRemapTreeView(remaps);
|
|
||||||
|
|
||||||
ResetAllRemapFields();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DataProvider.Remaps.Add(newRemap);
|
|
||||||
DataProvider.SaveMapping();
|
|
||||||
|
|
||||||
var node = GUIHelpers.GenerateTreeNode(newRemap, this);
|
|
||||||
|
|
||||||
node.Clone();
|
|
||||||
|
|
||||||
//RemapTreeView.Nodes.Remove(node);
|
|
||||||
RemapTreeView.Nodes.Add(node);
|
|
||||||
|
|
||||||
_cachedNewTypeNames.Clear();
|
|
||||||
|
|
||||||
ReloadRemapTreeView(remaps);
|
|
||||||
|
|
||||||
ResetAllRemapFields();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RemoveRemapButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
foreach (var node in RemapNodes.ToArray())
|
|
||||||
{
|
|
||||||
if (node.Key == RemapTreeView.SelectedNode)
|
|
||||||
{
|
|
||||||
bool projectMode = AppSettings.Remapper.UseProjectMappings;
|
|
||||||
|
|
||||||
var remaps = DataProvider.Remaps;
|
|
||||||
|
|
||||||
remaps.Remove(node.Value);
|
|
||||||
RemapNodes.Remove(node.Key);
|
|
||||||
RemapTreeView.Nodes.Remove(node.Key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ResetAllRemapFields();
|
|
||||||
|
|
||||||
DataProvider.SaveMapping();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RunRemapButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (ReMapper.IsRunning) { return; }
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(AppSettings.Remapper.AssemblyPath))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Please select an assembly path", "Assembly not loaded");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Remapper.InitializeRemap(
|
|
||||||
DataProvider.LoadMappingFile(AppSettings.Remapper.MappingPath),
|
|
||||||
AppSettings.Remapper.AssemblyPath,
|
|
||||||
AppSettings.Remapper.OutputPath);
|
|
||||||
|
|
||||||
ReloadRemapTreeView(DataProvider.Remaps);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ValidateRemapButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
List<RemapModel> validation = [];
|
|
||||||
|
|
||||||
var remapToValidate = CreateRemapFromGUI();
|
|
||||||
|
|
||||||
if (remapToValidate is null) return;
|
|
||||||
|
|
||||||
validation.Add(remapToValidate);
|
|
||||||
|
|
||||||
Remapper.InitializeRemap(
|
|
||||||
validation,
|
|
||||||
AppSettings.Remapper.AssemblyPath,
|
|
||||||
AppSettings.Remapper.OutputPath,
|
|
||||||
validate: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Only used by the manual remap process, not apart of the cross compiler process
|
|
||||||
/// </summary>
|
|
||||||
private void ReloadTreeAfterMapping()
|
|
||||||
{
|
|
||||||
ReloadRemapTreeView(DataProvider.Remaps);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveMappingFileButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DataProvider.SaveMapping();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadMappingFileButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var result = GUIHelpers.OpenFileDialog("Select a mapping file",
|
|
||||||
"JSON Files (*.json)|*.json|JSONC Files (*.jsonc)|*.jsonc|All Files (*.*)|*.*");
|
|
||||||
|
|
||||||
if (result == string.Empty) { return; }
|
|
||||||
|
|
||||||
DataProvider.Remaps = DataProvider.LoadMappingFile(result);
|
|
||||||
AppSettings.Remapper.MappingPath = result;
|
|
||||||
AppSettings.Remapper.UseProjectMappings = false;
|
|
||||||
|
|
||||||
LoadedMappingFilePath.Text = result;
|
|
||||||
|
|
||||||
RemapTreeView.Nodes.Clear();
|
|
||||||
|
|
||||||
foreach (var remap in DataProvider.Remaps)
|
|
||||||
{
|
|
||||||
RemapTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(remap, this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PickAssemblyPathButton_Click_1(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var result = GUIHelpers.OpenFileDialog("Select a DLL file",
|
|
||||||
"DLL Files (*.dll)|*.dll|All Files (*.*)|*.*");
|
|
||||||
|
|
||||||
if (result != string.Empty)
|
|
||||||
{
|
|
||||||
AppSettings.Remapper.AssemblyPath = result;
|
|
||||||
TargetAssemblyPath.Text = result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OutputDirectoryButton_Click_1(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var result = GUIHelpers.OpenFolderDialog("Select an output directory");
|
|
||||||
|
|
||||||
if (result != string.Empty)
|
|
||||||
{
|
|
||||||
AppSettings.Remapper.OutputPath = result;
|
|
||||||
RemapperOutputDirectoryPath.Text = result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion MAIN_BUTTONS
|
|
||||||
|
|
||||||
#region LISTBOX_BUTTONS
|
|
||||||
|
|
||||||
private void MethodIncludeAddButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (IncludeMethodTextBox.Text == string.Empty) return;
|
|
||||||
|
|
||||||
if (!MethodIncludeBox.Items.Contains(IncludeMethodTextBox.Text))
|
|
||||||
{
|
|
||||||
MethodIncludeBox.Items.Add(IncludeMethodTextBox.Text);
|
|
||||||
IncludeMethodTextBox.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MethodIncludeRemoveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (MethodIncludeBox.SelectedItem != null)
|
|
||||||
{
|
|
||||||
MethodIncludeBox.Items.Remove(MethodIncludeBox.SelectedItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MethodExcludeAddButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (ExcludeMethodTextBox.Text == string.Empty) return;
|
|
||||||
|
|
||||||
if (!MethodExcludeBox.Items.Contains(ExcludeMethodTextBox.Text))
|
|
||||||
{
|
|
||||||
MethodExcludeBox.Items.Add(ExcludeMethodTextBox.Text);
|
|
||||||
ExcludeMethodTextBox.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MethodExcludeRemoveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (MethodExcludeBox.SelectedItem != null)
|
|
||||||
{
|
|
||||||
MethodExcludeBox.Items.Remove(MethodExcludeBox.SelectedItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FIeldIncludeAddButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (FieldsIncludeTextInput.Text == string.Empty) return;
|
|
||||||
|
|
||||||
if (!FieldIncludeBox.Items.Contains(FieldsIncludeTextInput.Text))
|
|
||||||
{
|
|
||||||
FieldIncludeBox.Items.Add(FieldsIncludeTextInput.Text);
|
|
||||||
FieldsIncludeTextInput.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FieldIncludeRemoveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (FieldIncludeBox.SelectedItem != null)
|
|
||||||
{
|
|
||||||
FieldIncludeBox.Items.Remove(FieldIncludeBox.SelectedItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FieldExcludeAddButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (FieldsExcludeTextInput.Text == string.Empty) return;
|
|
||||||
|
|
||||||
if (!FieldExcludeBox.Items.Contains(FieldsExcludeTextInput.Text))
|
|
||||||
{
|
|
||||||
FieldExcludeBox.Items.Add(FieldsExcludeTextInput.Text);
|
|
||||||
FieldsExcludeTextInput.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FieldExcludeRemoveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (FieldExcludeBox.SelectedItem != null)
|
|
||||||
{
|
|
||||||
FieldExcludeBox.Items.Remove(FieldExcludeBox.SelectedItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PropertiesIncludeAddButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (PropertiesIncludeTextField.Text == string.Empty) return;
|
|
||||||
|
|
||||||
if (!PropertiesIncludeBox.Items.Contains(PropertiesIncludeTextField.Text))
|
|
||||||
{
|
|
||||||
PropertiesIncludeBox.Items.Add(PropertiesIncludeTextField.Text);
|
|
||||||
PropertiesIncludeTextField.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PropertiesIncludeRemoveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (PropertiesIncludeBox.SelectedItem != null)
|
|
||||||
{
|
|
||||||
PropertiesIncludeBox.Items.Remove(PropertiesIncludeBox.SelectedItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PropertiesExcludeAddButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (PropertiesExcludeTextField.Text == string.Empty) return;
|
|
||||||
|
|
||||||
if (!PropertiesExcludeBox.Items.Contains(PropertiesExcludeTextField.Text))
|
|
||||||
{
|
|
||||||
PropertiesExcludeBox.Items.Add(PropertiesExcludeTextField.Text);
|
|
||||||
PropertiesExcludeTextField.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PropertiesExcludeRemoveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (PropertiesExcludeBox.SelectedItem != null)
|
|
||||||
{
|
|
||||||
PropertiesExcludeBox.Items.Remove(PropertiesExcludeBox.SelectedItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NestedTypesAddButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (NestedTypesIncludeTextField.Text == string.Empty) return;
|
|
||||||
|
|
||||||
if (!NestedTypesIncludeBox.Items.Contains(NestedTypesIncludeTextField.Text))
|
|
||||||
{
|
|
||||||
NestedTypesIncludeBox.Items.Add(NestedTypesIncludeTextField.Text);
|
|
||||||
NestedTypesIncludeTextField.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NestedTypesRemoveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (NestedTypesIncludeBox.SelectedItem != null)
|
|
||||||
{
|
|
||||||
NestedTypesIncludeBox.Items.Remove(NestedTypesIncludeBox.SelectedItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NestedTypesExlcudeAddButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (NestedTypesExcludeTextField.Text == string.Empty) return;
|
|
||||||
|
|
||||||
if (!NestedTypesExcludeBox.Items.Contains(NestedTypesExcludeTextField.Text))
|
|
||||||
{
|
|
||||||
NestedTypesExcludeBox.Items.Add(NestedTypesExcludeTextField.Text);
|
|
||||||
NestedTypesExcludeTextField.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NestedTypesExcludeRemoveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (NestedTypesExcludeBox.SelectedItem != null)
|
|
||||||
{
|
|
||||||
NestedTypesExcludeBox.Items.Remove(NestedTypesExcludeBox.SelectedItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void EventsAddButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (EventsIncludeTextField.Text == string.Empty) return;
|
|
||||||
|
|
||||||
if (!EventsIncludeBox.Items.Contains(EventsIncludeTextField.Text))
|
|
||||||
{
|
|
||||||
EventsIncludeBox.Items.Add(EventsIncludeTextField.Text);
|
|
||||||
EventsIncludeTextField.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EventsRemoveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (EventsIncludeBox.SelectedItem != null)
|
|
||||||
{
|
|
||||||
EventsIncludeBox.Items.Remove(EventsIncludeBox.SelectedItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EventsExcludeAddButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (EventsExcludeTextField.Text == string.Empty) return;
|
|
||||||
|
|
||||||
if (!EventsExcludeBox.Items.Contains(EventsExcludeTextField.Text))
|
|
||||||
{
|
|
||||||
EventsExcludeBox.Items.Add(EventsExcludeTextField.Text);
|
|
||||||
EventsExcludeTextField.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EventsExcludeRemoveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (EventsExcludeBox.SelectedItem != null)
|
|
||||||
{
|
|
||||||
EventsExcludeBox.Items.Remove(EventsExcludeBox.SelectedItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AutoMapperExcludeAddButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AutoMapperExcludeRemoveButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RunAutoRemapButton_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Feature has been removed from this build.", "Feature Removed");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion LISTBOX_BUTTONS
|
|
||||||
|
|
||||||
#region CHECKBOX
|
|
||||||
|
|
||||||
private void RemapperUnseal_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AppSettings.Remapper.MappingSettings.Unseal = RemapperUnseal.Checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RemapperPublicicize_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AppSettings.Remapper.MappingSettings.Publicize = RemapperPublicicize.Checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RenameFieldsCheckbox_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AppSettings.Remapper.MappingSettings.RenameFields = RenameFieldsCheckbox.Checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RenamePropertiesCheckbox_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AppSettings.Remapper.MappingSettings.RenameProperties = RenamePropertiesCheckbox.Checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion CHECKBOX
|
|
||||||
|
|
||||||
#endregion BUTTONS
|
|
||||||
|
|
||||||
#endregion MANUAL_REMAPPER
|
|
||||||
|
|
||||||
#region SETTINGS_TAB
|
|
||||||
|
|
||||||
public void RefreshSettingsPage()
|
|
||||||
{
|
|
||||||
// Settings page
|
|
||||||
DebugLoggingCheckbox.Checked = AppSettings.AppSettings.Debug;
|
|
||||||
SilentModeCheckbox.Checked = AppSettings.AppSettings.SilentMode;
|
|
||||||
|
|
||||||
// Remapper page
|
|
||||||
TargetAssemblyPath.Text = AppSettings.Remapper.AssemblyPath;
|
|
||||||
RemapperOutputDirectoryPath.Text = AppSettings.Remapper.OutputPath;
|
|
||||||
RenameFieldsCheckbox.Checked = AppSettings.Remapper.MappingSettings.RenameFields;
|
|
||||||
RenamePropertiesCheckbox.Checked = AppSettings.Remapper.MappingSettings.RenameProperties;
|
|
||||||
RemapperPublicicize.Checked = AppSettings.Remapper.MappingSettings.Publicize;
|
|
||||||
RemapperUnseal.Checked = AppSettings.Remapper.MappingSettings.Unseal;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region CHECKBOXES
|
|
||||||
|
|
||||||
private void DebugLoggingCheckbox_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DataProvider.Settings.AppSettings.Debug = DebugLoggingCheckbox.Checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SilentModeCheckbox_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DataProvider.Settings.AppSettings.SilentMode = SilentModeCheckbox.Checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion CHECKBOXES
|
|
||||||
|
|
||||||
#endregion SETTINGS_TAB
|
|
||||||
|
|
||||||
// Reset All UI elements to default
|
|
||||||
private void ResetAllRemapFields()
|
|
||||||
{
|
|
||||||
PopulateDomainUpDowns();
|
|
||||||
|
|
||||||
// Text fields
|
|
||||||
|
|
||||||
NewTypeName.Clear();
|
|
||||||
OriginalTypeName.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();
|
|
||||||
EventsIncludeTextField.Clear();
|
|
||||||
EventsExcludeTextField.Clear();
|
|
||||||
|
|
||||||
// Numeric UpDowns
|
|
||||||
|
|
||||||
ConstuctorCountUpDown.Value = 0;
|
|
||||||
MethodCountUpDown.Value = 0;
|
|
||||||
FieldCountUpDown.Value = 0;
|
|
||||||
PropertyCountUpDown.Value = 0;
|
|
||||||
NestedTypeCountUpDown.Value = 0;
|
|
||||||
|
|
||||||
// Check boxes
|
|
||||||
|
|
||||||
RemapperUseForceRename.Checked = false;
|
|
||||||
ConstructorCountEnabled.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();
|
|
||||||
EventsIncludeBox.Items.Clear();
|
|
||||||
EventsExcludeBox.Items.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ManualEditSelectedRemap(object? sender, TreeNodeMouseClickEventArgs e)
|
|
||||||
{
|
|
||||||
EditSelectedRemap(this, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EditSelectedRemap(
|
|
||||||
object? sender,
|
|
||||||
TreeNodeMouseClickEventArgs e,
|
|
||||||
bool isComingFromOtherTab = false)
|
|
||||||
{
|
|
||||||
if (e?.Node.Level != 0 || RemapTreeView?.SelectedNode?.Index < 0 || RemapTreeView?.SelectedNode?.Index == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RemapModel remap = null;
|
|
||||||
|
|
||||||
foreach (var node in RemapNodes.ToArray())
|
|
||||||
{
|
|
||||||
if (node.Key == RemapTreeView.SelectedNode)
|
|
||||||
{
|
|
||||||
bool projectMode = AppSettings.Remapper.UseProjectMappings;
|
|
||||||
|
|
||||||
var remaps = DataProvider.Remaps;
|
|
||||||
|
|
||||||
remap = remaps.FirstOrDefault(x => x.NewTypeName == node.Value.NewTypeName);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (remap == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_selectedRemapTreeIndex = RemapTreeView.SelectedNode.Index;
|
|
||||||
|
|
||||||
ResetAllRemapFields();
|
|
||||||
|
|
||||||
NewTypeName.Text = remap.NewTypeName;
|
|
||||||
OriginalTypeName.Text = remap.OriginalTypeName;
|
|
||||||
RemapperUseForceRename.Checked = remap.UseForceRename;
|
|
||||||
|
|
||||||
BaseClassIncludeTextFIeld.Text = remap.SearchParams.GenericParams.MatchBaseClass;
|
|
||||||
NestedTypeParentName.Text = remap.SearchParams.NestedTypes.NestedTypeParentName;
|
|
||||||
|
|
||||||
ConstructorCountEnabled.Checked = remap.SearchParams.Methods.ConstructorParameterCount >= 0;
|
|
||||||
|
|
||||||
MethodCountEnabled.Checked = remap.SearchParams.Methods.MethodCount >= 0;
|
|
||||||
|
|
||||||
FieldCountEnabled.Checked = remap.SearchParams.Fields.FieldCount >= 0;
|
|
||||||
|
|
||||||
PropertyCountEnabled.Checked = remap.SearchParams.Properties.PropertyCount >= 0;
|
|
||||||
|
|
||||||
NestedTypeCountEnabled.Checked = remap.SearchParams.NestedTypes.NestedTypeCount >= 0;
|
|
||||||
|
|
||||||
ConstuctorCountUpDown.Value = remap.SearchParams.Methods.ConstructorParameterCount;
|
|
||||||
|
|
||||||
MethodCountUpDown.Value = remap.SearchParams.Methods.MethodCount;
|
|
||||||
|
|
||||||
FieldCountUpDown.Value = remap.SearchParams.Fields.FieldCount;
|
|
||||||
|
|
||||||
PropertyCountUpDown.Value = remap.SearchParams.Properties.PropertyCount;
|
|
||||||
|
|
||||||
NestedTypeCountUpDown.Value = remap.SearchParams.NestedTypes.NestedTypeCount;
|
|
||||||
|
|
||||||
IsPublicComboBox.SelectedItem = remap.SearchParams.GenericParams.IsPublic.ToString();
|
|
||||||
|
|
||||||
IsAbstractComboBox.SelectedItem = remap.SearchParams.GenericParams.IsAbstract is not null
|
|
||||||
? remap.SearchParams.GenericParams.IsAbstract.ToString()
|
|
||||||
: "Disabled";
|
|
||||||
|
|
||||||
IsSealedComboBox.SelectedItem = remap.SearchParams.GenericParams.IsSealed is not null
|
|
||||||
? remap.SearchParams.GenericParams.IsSealed.ToString()
|
|
||||||
: "Disabled";
|
|
||||||
|
|
||||||
IsInterfaceComboBox.SelectedItem = remap.SearchParams.GenericParams.IsInterface is not null
|
|
||||||
? remap.SearchParams.GenericParams.IsInterface.ToString()
|
|
||||||
: "Disabled";
|
|
||||||
|
|
||||||
IsStructComboBox.SelectedItem = remap.SearchParams.GenericParams.IsStruct is not null
|
|
||||||
? remap.SearchParams.GenericParams.IsStruct.ToString()
|
|
||||||
: "Disabled";
|
|
||||||
|
|
||||||
IsEnumComboBox.SelectedItem = remap.SearchParams.GenericParams.IsEnum is not null
|
|
||||||
? remap.SearchParams.GenericParams.IsEnum.ToString()
|
|
||||||
: "Disabled";
|
|
||||||
|
|
||||||
HasAttributeComboBox.SelectedItem = remap.SearchParams.GenericParams.HasAttribute is not null
|
|
||||||
? remap.SearchParams.GenericParams.HasAttribute.ToString()
|
|
||||||
: "Disabled";
|
|
||||||
|
|
||||||
HasGenericParamsComboBox.SelectedItem = remap.SearchParams.GenericParams.HasGenericParameters is not null
|
|
||||||
? remap.SearchParams.GenericParams.HasGenericParameters.ToString()
|
|
||||||
: "Disabled";
|
|
||||||
|
|
||||||
IsNestedUpDown.BuildStringList("IsNested", false, remap.SearchParams.NestedTypes.IsNested);
|
|
||||||
IsDerivedUpDown.BuildStringList("IsDerived", false, remap.SearchParams.GenericParams.IsDerived);
|
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.Methods.IncludeMethods)
|
|
||||||
{
|
|
||||||
MethodIncludeBox.Items.Add(method);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.Methods.ExcludeMethods)
|
|
||||||
{
|
|
||||||
MethodExcludeBox.Items.Add(method);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.Fields.IncludeFields)
|
|
||||||
{
|
|
||||||
FieldIncludeBox.Items.Add(method);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.Fields.ExcludeFields)
|
|
||||||
{
|
|
||||||
FieldExcludeBox.Items.Add(method);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.Properties.IncludeProperties)
|
|
||||||
{
|
|
||||||
PropertiesIncludeBox.Items.Add(method);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.Properties.ExcludeProperties)
|
|
||||||
{
|
|
||||||
PropertiesExcludeBox.Items.Add(method);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.NestedTypes.IncludeNestedTypes)
|
|
||||||
{
|
|
||||||
NestedTypesIncludeBox.Items.Add(method);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.NestedTypes.ExcludeNestedTypes)
|
|
||||||
{
|
|
||||||
NestedTypesExcludeBox.Items.Add(method);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.Events.IncludeEvents)
|
|
||||||
{
|
|
||||||
EventsIncludeBox.Items.Add(method);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var method in remap.SearchParams.Events.ExcludeEvents)
|
|
||||||
{
|
|
||||||
EventsExcludeBox.Items.Add(method);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PopulateDomainUpDowns()
|
|
||||||
{
|
|
||||||
// Clear them all first just incase
|
|
||||||
IsPublicComboBox.AddItemsToComboBox(["True", "False"]);
|
|
||||||
IsPublicComboBox.SelectedItem = "True";
|
|
||||||
|
|
||||||
IsAbstractComboBox.AddItemsToComboBox(["Disabled", "True", "False"]);
|
|
||||||
IsAbstractComboBox.SelectedItem = "Disabled";
|
|
||||||
|
|
||||||
IsSealedComboBox.AddItemsToComboBox(["Disabled", "True", "False"]);
|
|
||||||
IsSealedComboBox.SelectedItem = "Disabled";
|
|
||||||
|
|
||||||
IsInterfaceComboBox.AddItemsToComboBox(["Disabled", "True", "False"]);
|
|
||||||
IsInterfaceComboBox.SelectedItem = "Disabled";
|
|
||||||
|
|
||||||
IsStructComboBox.AddItemsToComboBox(["Disabled", "True", "False"]);
|
|
||||||
IsStructComboBox.SelectedItem = "Disabled";
|
|
||||||
|
|
||||||
IsEnumComboBox.AddItemsToComboBox(["Disabled", "True", "False"]);
|
|
||||||
IsEnumComboBox.SelectedItem = "Disabled";
|
|
||||||
|
|
||||||
HasAttributeComboBox.AddItemsToComboBox(["Disabled", "True", "False"]);
|
|
||||||
HasAttributeComboBox.SelectedItem = "Disabled";
|
|
||||||
|
|
||||||
HasGenericParamsComboBox.AddItemsToComboBox(["Disabled", "True", "False"]);
|
|
||||||
HasGenericParamsComboBox.SelectedItem = "Disabled";
|
|
||||||
|
|
||||||
IsNestedUpDown.BuildStringList("IsNested", false);
|
|
||||||
IsDerivedUpDown.BuildStringList("IsDerived", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Subscribes the the remappers OnComplete event
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="remaps"></param>
|
|
||||||
private void ReloadRemapTreeView(List<RemapModel>? remaps)
|
|
||||||
{
|
|
||||||
RemapTreeView.Nodes.Clear();
|
|
||||||
RemapNodes.Clear();
|
|
||||||
|
|
||||||
if (remaps is null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var remap in remaps)
|
|
||||||
{
|
|
||||||
RemapTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(remap, this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GithubLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
||||||
{
|
|
||||||
Process.Start(new ProcessStartInfo
|
|
||||||
{
|
|
||||||
FileName = GithubLinkLabel.Text,
|
|
||||||
UseShellExecute = true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,132 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<metadata name="groupBox6.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>False</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="groupBox7.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>False</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>47</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
@ -1,20 +0,0 @@
|
|||||||
using ReCodeIt.GUI;
|
|
||||||
using ReCodeItLib.Utils;
|
|
||||||
|
|
||||||
namespace ReCodeIt;
|
|
||||||
|
|
||||||
internal static class Program
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
|
||||||
private static void Main()
|
|
||||||
{
|
|
||||||
DataProvider.LoadAppSettings();
|
|
||||||
|
|
||||||
// To customize application configuration such as set high DPI settings or default font, see https://aka.ms/applicationconfiguration.
|
|
||||||
ApplicationConfiguration.Initialize();
|
|
||||||
Application.Run(new ReCodeItForm());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<Version>0.1.0</Version>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>net8.0-windows10.0.26100.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
|
||||||
<Exec Command="xcopy "$(SolutionDir)\Assets\Templates" "$(TargetDir)Data" /E /I /Y" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\RecodeItLib\ReCodeItLib.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,360 +0,0 @@
|
|||||||
using ReCodeItLib.Models;
|
|
||||||
using ReCodeItLib.Utils;
|
|
||||||
|
|
||||||
namespace ReCodeIt.GUI;
|
|
||||||
|
|
||||||
internal static class GUIHelpers
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the value of the count or null if disabled
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="box"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static int? GetCount(this CheckBox box, NumericUpDown upDown)
|
|
||||||
{
|
|
||||||
if (box.Checked)
|
|
||||||
{
|
|
||||||
return (int?)upDown.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool? GetEnabled(this DomainUpDown domainUpDown)
|
|
||||||
{
|
|
||||||
if (domainUpDown.Text == "True")
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (domainUpDown.Text == "False")
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
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, bool required, bool? update = null)
|
|
||||||
{
|
|
||||||
domainUpDown.Items.Clear();
|
|
||||||
|
|
||||||
domainUpDown.Text = required
|
|
||||||
? name + @" (Required)"
|
|
||||||
: name + @" (Disabled)";
|
|
||||||
|
|
||||||
domainUpDown.ReadOnly = true;
|
|
||||||
|
|
||||||
var list = new List<string>
|
|
||||||
{
|
|
||||||
name + " (Disabled)",
|
|
||||||
"True",
|
|
||||||
"False",
|
|
||||||
};
|
|
||||||
|
|
||||||
if (required)
|
|
||||||
{
|
|
||||||
list.RemoveAt(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (update != null)
|
|
||||||
{
|
|
||||||
domainUpDown.Text = update.ToString();
|
|
||||||
|
|
||||||
if (update.ToString() == "True")
|
|
||||||
{
|
|
||||||
Logger.Log("Updating!");
|
|
||||||
domainUpDown.SelectedItem = "True";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
domainUpDown.SelectedItem = "False";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
domainUpDown.Items.AddRange(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AddItemsToComboBox(this ComboBox cb, List<string> items)
|
|
||||||
{
|
|
||||||
cb.Items.Clear();
|
|
||||||
|
|
||||||
foreach (var item in items)
|
|
||||||
{
|
|
||||||
cb.Items.Add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static T? GetSelectedItem<T>(this ComboBox cb)
|
|
||||||
{
|
|
||||||
return (T)cb.SelectedItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Generates a tree node to display on the GUI
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static TreeNode GenerateTreeNode(RemapModel model, ReCodeItForm gui)
|
|
||||||
{
|
|
||||||
var isPublic = model.SearchParams.GenericParams.IsPublic;
|
|
||||||
var isAbstract = model.SearchParams.GenericParams.IsAbstract == null ? null : model.SearchParams.GenericParams.IsAbstract;
|
|
||||||
var isInterface = model.SearchParams.GenericParams.IsInterface == null ? null : model.SearchParams.GenericParams.IsInterface;
|
|
||||||
var isStruct = model.SearchParams.GenericParams.IsStruct == null ? null : model.SearchParams.GenericParams.IsStruct;
|
|
||||||
var isEnum = model.SearchParams.GenericParams.IsEnum == null ? null : model.SearchParams.GenericParams.IsEnum;
|
|
||||||
var isNested = model.SearchParams.NestedTypes.IsNested == null ? null : model.SearchParams.NestedTypes.IsNested;
|
|
||||||
var isSealed = model.SearchParams.GenericParams.IsSealed == null ? null : model.SearchParams.GenericParams.IsSealed;
|
|
||||||
var HasAttribute = model.SearchParams.GenericParams.HasAttribute == null ? null : model.SearchParams.GenericParams.HasAttribute;
|
|
||||||
var IsDerived = model.SearchParams.GenericParams.IsDerived == null ? null : model.SearchParams.GenericParams.IsDerived;
|
|
||||||
var HasGenericParameters = model.SearchParams.GenericParams.HasGenericParameters == null ? null : model.SearchParams.GenericParams.HasGenericParameters;
|
|
||||||
|
|
||||||
var remapTreeItem = new TreeNode($"{model.NewTypeName}");
|
|
||||||
|
|
||||||
var originalTypeName = new TreeNode($"Original Name: {model.OriginalTypeName}");
|
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(originalTypeName);
|
|
||||||
|
|
||||||
if (model.UseForceRename)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"Force Rename: {model.UseForceRename}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"IsPublic: {isPublic}"));
|
|
||||||
|
|
||||||
if (isAbstract is not null)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"IsAbstract: {isAbstract}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isInterface is not null)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"IsInterface: {isInterface}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isStruct is not null)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"IsStruct: {isStruct}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isEnum is not null)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"IsEnum: {isEnum}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNested is not null)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"IsNested: {isNested}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isSealed is not null)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"IsSealed: {isSealed}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HasAttribute is not null)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"HasAttribute: {HasAttribute}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsDerived is not null)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"IsDerived: {IsDerived}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HasGenericParameters is not null)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"HasGenericParameters: {HasGenericParameters}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.Methods.ConstructorParameterCount > 0)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"Constructor Parameter Count: {model.SearchParams.Methods.ConstructorParameterCount}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.Methods.MethodCount >= 0)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"Method Count: {model.SearchParams.Methods.MethodCount}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.Fields.FieldCount >= 0)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"Field Count: {model.SearchParams.Fields.FieldCount}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.Properties.PropertyCount >= 0)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"Property Count: {model.SearchParams.Properties.PropertyCount}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.NestedTypes.NestedTypeCount >= 0)
|
|
||||||
{
|
|
||||||
remapTreeItem.Nodes.Add(new TreeNode($"Nested OriginalTypeRef Count: {model.SearchParams.NestedTypes.NestedTypeCount}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.Methods.IncludeMethods.Count > 0)
|
|
||||||
{
|
|
||||||
var includeMethodsNode =
|
|
||||||
GenerateNodeFromList(model.SearchParams.Methods.IncludeMethods, "Include Methods");
|
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(includeMethodsNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.Methods.ExcludeMethods?.Count > 0)
|
|
||||||
{
|
|
||||||
var excludeMethodsNode =
|
|
||||||
GenerateNodeFromList(model.SearchParams.Methods.ExcludeMethods, "Exclude Methods");
|
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(excludeMethodsNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.Fields.IncludeFields?.Count > 0)
|
|
||||||
{
|
|
||||||
var includeFieldsNode =
|
|
||||||
GenerateNodeFromList(model.SearchParams.Fields.IncludeFields, "Include Fields");
|
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(includeFieldsNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.Fields.ExcludeFields?.Count > 0)
|
|
||||||
{
|
|
||||||
var excludeFieldsNode =
|
|
||||||
GenerateNodeFromList(model.SearchParams.Fields.ExcludeFields, "Exclude Fields");
|
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(excludeFieldsNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.Properties.IncludeProperties?.Count > 0)
|
|
||||||
{
|
|
||||||
var includeProperties =
|
|
||||||
GenerateNodeFromList(model.SearchParams.Properties.IncludeProperties, "Include Properties");
|
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(includeProperties);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.Properties.ExcludeProperties?.Count > 0)
|
|
||||||
{
|
|
||||||
var excludeProperties =
|
|
||||||
GenerateNodeFromList(model.SearchParams.Properties.ExcludeProperties, "Exclude Properties");
|
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(excludeProperties);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.NestedTypes.IncludeNestedTypes?.Count > 0)
|
|
||||||
{
|
|
||||||
var includeNestedTypes =
|
|
||||||
GenerateNodeFromList(model.SearchParams.NestedTypes.IncludeNestedTypes, "Include Nested Types");
|
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(includeNestedTypes);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.NestedTypes.ExcludeNestedTypes?.Count > 0)
|
|
||||||
{
|
|
||||||
var excludeNestedTypes =
|
|
||||||
GenerateNodeFromList(model.SearchParams.NestedTypes.ExcludeNestedTypes, "Exclude Nested Types");
|
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(excludeNestedTypes);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.Events.IncludeEvents?.Count > 0)
|
|
||||||
{
|
|
||||||
var includeEvents =
|
|
||||||
GenerateNodeFromList(model.SearchParams.Events.IncludeEvents, "Include Events");
|
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(includeEvents);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.SearchParams.Events.ExcludeEvents?.Count > 0)
|
|
||||||
{
|
|
||||||
var excludeEvents =
|
|
||||||
GenerateNodeFromList(model.SearchParams.Events.ExcludeEvents, "Exclude Events");
|
|
||||||
|
|
||||||
remapTreeItem.Nodes.Add(excludeEvents);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReCodeItForm.RemapNodes.Add(remapTreeItem, model);
|
|
||||||
|
|
||||||
return remapTreeItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Generates a new node from a list of strings
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="items"></param>
|
|
||||||
/// <param name="name"></param>
|
|
||||||
/// <returns>A new tree node, or null if the provided list is empty</returns>
|
|
||||||
private static TreeNode GenerateNodeFromList(HashSet<string> items, string name)
|
|
||||||
{
|
|
||||||
var node = new TreeNode(name);
|
|
||||||
|
|
||||||
foreach (var item in items)
|
|
||||||
{
|
|
||||||
node.Nodes.Add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Buils a list of strings from list box entries
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="lb"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static List<string> GetAllEntriesFromListBox(ListBox lb)
|
|
||||||
{
|
|
||||||
var tmp = new List<string>();
|
|
||||||
|
|
||||||
foreach (var entry in lb.Items)
|
|
||||||
{
|
|
||||||
tmp.Add((string)entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Opens and returns a path from a file dialogue
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="title"></param>
|
|
||||||
/// <param name="filter"></param>
|
|
||||||
/// <returns>Path if selected, or empty string</returns>
|
|
||||||
public static string OpenFileDialog(string title, string filter)
|
|
||||||
{
|
|
||||||
OpenFileDialog fDialog = new()
|
|
||||||
{
|
|
||||||
Title = title,
|
|
||||||
Filter = filter,
|
|
||||||
Multiselect = false
|
|
||||||
};
|
|
||||||
|
|
||||||
if (fDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
return fDialog.FileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Opens and returns a path from a folder dialogue
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="description"></param>
|
|
||||||
/// <returns>Path if selected, or empty string</returns>
|
|
||||||
public static string OpenFolderDialog(string description)
|
|
||||||
{
|
|
||||||
using FolderBrowserDialog fDialog = new();
|
|
||||||
|
|
||||||
fDialog.Description = description;
|
|
||||||
fDialog.ShowNewFolderButton = true;
|
|
||||||
|
|
||||||
if (fDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
return fDialog.SelectedPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
@ -96,12 +96,12 @@ public class PropertyParams
|
|||||||
|
|
||||||
public class NestedTypeParams
|
public class NestedTypeParams
|
||||||
{
|
{
|
||||||
public bool? IsNested { get; set; } = null;
|
public bool IsNested { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Name of the nested types parent
|
/// Name of the nested types parent
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? NestedTypeParentName { get; set; } = null;
|
public string NestedTypeParentName { get; set; } = string.Empty;
|
||||||
public int NestedTypeCount { get; set; } = -1;
|
public int NestedTypeCount { get; set; } = -1;
|
||||||
public HashSet<string> IncludeNestedTypes { get; set; } = [];
|
public HashSet<string> IncludeNestedTypes { get; set; } = [];
|
||||||
public HashSet<string> ExcludeNestedTypes { get; set; } = [];
|
public HashSet<string> ExcludeNestedTypes { get; set; } = [];
|
||||||
|
@ -50,7 +50,7 @@ internal static class GenericTypeFilters
|
|||||||
|
|
||||||
private static IEnumerable<TypeDef> FilterNestedByName(IEnumerable<TypeDef> types, SearchParams parms)
|
private static IEnumerable<TypeDef> FilterNestedByName(IEnumerable<TypeDef> types, SearchParams parms)
|
||||||
{
|
{
|
||||||
if (parms.NestedTypes.NestedTypeParentName is not null)
|
if (parms.NestedTypes.NestedTypeParentName is not "")
|
||||||
{
|
{
|
||||||
types = types.Where(t => t.DeclaringType.Name.String == parms.NestedTypes.NestedTypeParentName);
|
types = types.Where(t => t.DeclaringType.Name.String == parms.NestedTypes.NestedTypeParentName);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user