More bug fixes, add reloading of the tree

This commit is contained in:
Cj 2024-06-14 14:34:24 -04:00
parent 622df3391a
commit b2d90365b2
3 changed files with 31 additions and 13 deletions

View File

@ -11,6 +11,10 @@ public class Remapper
{
public static bool IsRunning { get; private set; } = false;
public delegate void OnCompleteHandler(object sender, EventArgs e);
public event OnCompleteHandler OnComplete;
private static Stopwatch Stopwatch = new();
/// <summary>
@ -260,6 +264,7 @@ public class Remapper
Reset();
IsRunning = false;
OnComplete.Invoke(this, EventArgs.Empty);
}
private void Reset()

View File

@ -15,10 +15,8 @@ namespace AssemblyRemapperGUI
InitializeComponent();
PopulateDomainUpDowns();
foreach (var remap in DataProvider.Remaps)
{
RemapTreeView.Nodes.Add(GUI.GenerateTreeNode(remap));
}
Remapper.OnComplete += ReloadTreeView;
ReloadTreeView(this, EventArgs.Empty);
}
#region BUTTONS
@ -101,7 +99,7 @@ namespace AssemblyRemapperGUI
{
if (Remapper.IsRunning) { return; }
Task.Run(() => Remapper.InitializeRemap());
Remapper.InitializeRemap();
}
private void SaveMappingFileButton_Click(object sender, EventArgs e)
@ -338,5 +336,20 @@ namespace AssemblyRemapperGUI
IsDerivedUpDown.BuildStringList("IsDerived");
HasGenericParametersUpDown.BuildStringList("HasGenericParams");
}
/// <summary>
/// Subscribes the the remappers OnComplete event
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ReloadTreeView(object sender, EventArgs e)
{
RemapTreeView.Nodes.Clear();
foreach (var remap in DataProvider.Remaps)
{
RemapTreeView.Nodes.Add(GUI.GenerateTreeNode(remap));
}
}
}
}

View File

@ -132,7 +132,7 @@ internal static class GUI
remapTreeItem.Nodes.Add(IsDerivedNode);
remapTreeItem.Nodes.Add(HasGenericsNode);
if (model.SearchParams.IncludeMethods.Count > 0)
if (model.SearchParams.IncludeMethods?.Count > 0)
{
var includeMethodsNode =
GenerateNodeFromList(model.SearchParams.IncludeMethods, "Include Methods");
@ -140,7 +140,7 @@ internal static class GUI
remapTreeItem.Nodes.Add(includeMethodsNode);
}
if (model.SearchParams.ExcludeMethods.Count > 0)
if (model.SearchParams.ExcludeMethods?.Count > 0)
{
var excludeMethodsNode =
GenerateNodeFromList(model.SearchParams.ExcludeMethods, "Exclude Methods");
@ -148,7 +148,7 @@ internal static class GUI
remapTreeItem.Nodes.Add(excludeMethodsNode);
}
if (model.SearchParams.IncludeFields.Count > 0)
if (model.SearchParams.IncludeFields?.Count > 0)
{
var includeFieldsNode =
GenerateNodeFromList(model.SearchParams.IncludeFields, "Include Fields");
@ -156,7 +156,7 @@ internal static class GUI
remapTreeItem.Nodes.Add(includeFieldsNode);
}
if (model.SearchParams.ExcludeFields.Count > 0)
if (model.SearchParams.ExcludeFields?.Count > 0)
{
var excludeFieldsNode =
GenerateNodeFromList(model.SearchParams.ExcludeFields, "Exclude Fields");
@ -164,7 +164,7 @@ internal static class GUI
remapTreeItem.Nodes.Add(excludeFieldsNode);
}
if (model.SearchParams.IncludeProperties.Count > 0)
if (model.SearchParams.IncludeProperties?.Count > 0)
{
var includeProperties =
GenerateNodeFromList(model.SearchParams.IncludeProperties, "Include Properties");
@ -172,7 +172,7 @@ internal static class GUI
remapTreeItem.Nodes.Add(includeProperties);
}
if (model.SearchParams.ExcludeProperties.Count > 0)
if (model.SearchParams.ExcludeProperties?.Count > 0)
{
var excludeProperties =
GenerateNodeFromList(model.SearchParams.ExcludeProperties, "Exclude Properties");
@ -180,7 +180,7 @@ internal static class GUI
remapTreeItem.Nodes.Add(excludeProperties);
}
if (model.SearchParams.IncludeNestedTypes.Count > 0)
if (model.SearchParams.IncludeNestedTypes?.Count > 0)
{
var includeNestedTypes =
GenerateNodeFromList(model.SearchParams.IncludeNestedTypes, "Include Nested Types");
@ -188,7 +188,7 @@ internal static class GUI
remapTreeItem.Nodes.Add(includeNestedTypes);
}
if (model.SearchParams.IncludeNestedTypes.Count > 0)
if (model.SearchParams.IncludeNestedTypes?.Count > 0)
{
var excludeNestedTypes =
GenerateNodeFromList(model.SearchParams.ExcludeNestedTypes, "Exclude Nested Types");