From 5e71f13100b611683379df8a501142d1ee51b97f Mon Sep 17 00:00:00 2001 From: Cj <161484149+CJ-SPT@users.noreply.github.com> Date: Fri, 21 Jun 2024 17:01:07 -0400 Subject: [PATCH] Minor remapper fixes --- RecodeItLib/Remapper/ReCodeItRemapper.cs | 6 ++---- RecodeItLib/Remapper/RenameHelper.cs | 11 +++++++++-- RecodeItLib/Remapper/Search/TypeDefExtensions.cs | 5 ++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/RecodeItLib/Remapper/ReCodeItRemapper.cs b/RecodeItLib/Remapper/ReCodeItRemapper.cs index 48b146b..efa0797 100644 --- a/RecodeItLib/Remapper/ReCodeItRemapper.cs +++ b/RecodeItLib/Remapper/ReCodeItRemapper.cs @@ -286,6 +286,7 @@ public class ReCodeItRemapper } // Rename type and all associated type members + RenameHelper.RenameAll(highestScore); Logger.Log("-----------------------------------------------", ConsoleColor.Green); @@ -296,10 +297,7 @@ public class ReCodeItRemapper /// private void WriteAssembly() { - var fileName = Path.GetFileName(AssemblyPath); - var path = Path.Combine(OutPath, fileName); - - path = DataProvider.WriteAssemblyDefinition(path); + var path = DataProvider.WriteAssemblyDefinition(OutPath); Logger.Log("-----------------------------------------------", ConsoleColor.Green); Logger.Log($"Complete: Assembly written to `{path}`", ConsoleColor.Green); diff --git a/RecodeItLib/Remapper/RenameHelper.cs b/RecodeItLib/Remapper/RenameHelper.cs index 4dde7b0..4b58c5d 100644 --- a/RecodeItLib/Remapper/RenameHelper.cs +++ b/RecodeItLib/Remapper/RenameHelper.cs @@ -18,8 +18,15 @@ internal static class RenameHelper var types = DataProvider.ModuleDefinition.Types; // Rename all fields and properties first - RenameAllFields(score.Definition.Name, score.ReMap.NewTypeName, types); - RenameAllProperties(score.Definition.Name, score.ReMap.NewTypeName, types); + if (DataProvider.Settings.Remapper.MappingSettings.RenameFields) + { + RenameAllFields(score.Definition.Name, score.ReMap.NewTypeName, types); + } + + if (DataProvider.Settings.Remapper.MappingSettings.RenameProperties) + { + RenameAllProperties(score.Definition.Name, score.ReMap.NewTypeName, types); + } if (!direct) { diff --git a/RecodeItLib/Remapper/Search/TypeDefExtensions.cs b/RecodeItLib/Remapper/Search/TypeDefExtensions.cs index 2a69084..9d3f8da 100644 --- a/RecodeItLib/Remapper/Search/TypeDefExtensions.cs +++ b/RecodeItLib/Remapper/Search/TypeDefExtensions.cs @@ -1,5 +1,4 @@ using Mono.Cecil; -using Mono.Cecil.Rocks; using ReCodeIt.Enums; using ReCodeIt.Models; using ReCodeIt.Utils; @@ -15,8 +14,8 @@ internal static class TypeDefExtensions return EMatchResult.Disabled; } - // Interfaces cannot be abstract, and abstract cannot be static - if (type.IsInterface || type.GetStaticConstructor() is not null) + // Interfaces cannot be abstract + if (type.IsInterface) { score.FailureReason = EFailureReason.IsAbstract; return EMatchResult.NoMatch;