diff --git a/RecodeItGUI/GUI/Main.cs b/RecodeItGUI/GUI/Main.cs index 761eef2..01be27c 100644 --- a/RecodeItGUI/GUI/Main.cs +++ b/RecodeItGUI/GUI/Main.cs @@ -41,7 +41,7 @@ public partial class ReCodeItForm : Form LoadMappingFile(); var remaps = AppSettings.Remapper.UseProjectMappings - ? CrossCompiler.ActiveProject.RemapModels + ? CrossCompiler.ActiveProject?.RemapModels : DataProvider.Remaps; ReloadRemapTreeView(remaps); @@ -1319,11 +1319,16 @@ public partial class ReCodeItForm : Form /// Subscribes the the remappers OnComplete event /// /// - private void ReloadRemapTreeView(List remaps) + private void ReloadRemapTreeView(List? remaps) { RemapTreeView.Nodes.Clear(); RemapNodes.Clear(); + if (remaps is null) + { + return; + } + foreach (var remap in remaps) { RemapTreeView.Nodes.Add(GUIHelpers.GenerateTreeNode(remap, this)); diff --git a/RecodeItLib/Remapper/RenameHelper.cs b/RecodeItLib/Remapper/RenameHelper.cs index da1e7cd..cdbd833 100644 --- a/RecodeItLib/Remapper/RenameHelper.cs +++ b/RecodeItLib/Remapper/RenameHelper.cs @@ -1,5 +1,5 @@ using Mono.Cecil; -using Mono.Collections.Generic; +using Mono.Cecil.Rocks; using ReCodeIt.Models; using ReCodeIt.Utils; @@ -15,7 +15,7 @@ internal static class RenameHelper /// public static void RenameAll(ScoringModel score, bool direct = false) { - var types = DataProvider.ModuleDefinition.Types; + var types = DataProvider.ModuleDefinition.GetAllTypes(); // Rename all fields and properties first if (DataProvider.Settings.Remapper.MappingSettings.RenameFields) @@ -60,7 +60,7 @@ internal static class RenameHelper public static int RenameAllFields( string oldTypeName, string newTypeName, - Collection typesToCheck, + IEnumerable typesToCheck, int overAllCount = 0) { foreach (var type in typesToCheck) @@ -108,7 +108,7 @@ internal static class RenameHelper public static int RenameAllProperties( string oldTypeName, string newTypeName, - Collection typesToCheck, + IEnumerable typesToCheck, int overAllCount = 0) { foreach (var type in typesToCheck) @@ -157,7 +157,7 @@ internal static class RenameHelper return propertyCount > 0 ? $"{newName}_{propertyCount}" : newName; } - private static void RenameType(Collection typesToCheck, ScoringModel score) + private static void RenameType(IEnumerable typesToCheck, ScoringModel score) { foreach (var type in typesToCheck) {