Minor remapper fixes

This commit is contained in:
Cj 2024-06-21 17:01:07 -04:00
parent 6fae190b6e
commit 5e71f13100
3 changed files with 13 additions and 9 deletions

View File

@ -286,6 +286,7 @@ public class ReCodeItRemapper
} }
// Rename type and all associated type members // Rename type and all associated type members
RenameHelper.RenameAll(highestScore); RenameHelper.RenameAll(highestScore);
Logger.Log("-----------------------------------------------", ConsoleColor.Green); Logger.Log("-----------------------------------------------", ConsoleColor.Green);
@ -296,10 +297,7 @@ public class ReCodeItRemapper
/// </summary> /// </summary>
private void WriteAssembly() private void WriteAssembly()
{ {
var fileName = Path.GetFileName(AssemblyPath); var path = DataProvider.WriteAssemblyDefinition(OutPath);
var path = Path.Combine(OutPath, fileName);
path = DataProvider.WriteAssemblyDefinition(path);
Logger.Log("-----------------------------------------------", ConsoleColor.Green); Logger.Log("-----------------------------------------------", ConsoleColor.Green);
Logger.Log($"Complete: Assembly written to `{path}`", ConsoleColor.Green); Logger.Log($"Complete: Assembly written to `{path}`", ConsoleColor.Green);

View File

@ -18,8 +18,15 @@ internal static class RenameHelper
var types = DataProvider.ModuleDefinition.Types; var types = DataProvider.ModuleDefinition.Types;
// Rename all fields and properties first // Rename all fields and properties first
if (DataProvider.Settings.Remapper.MappingSettings.RenameFields)
{
RenameAllFields(score.Definition.Name, score.ReMap.NewTypeName, types); RenameAllFields(score.Definition.Name, score.ReMap.NewTypeName, types);
}
if (DataProvider.Settings.Remapper.MappingSettings.RenameProperties)
{
RenameAllProperties(score.Definition.Name, score.ReMap.NewTypeName, types); RenameAllProperties(score.Definition.Name, score.ReMap.NewTypeName, types);
}
if (!direct) if (!direct)
{ {

View File

@ -1,5 +1,4 @@
using Mono.Cecil; using Mono.Cecil;
using Mono.Cecil.Rocks;
using ReCodeIt.Enums; using ReCodeIt.Enums;
using ReCodeIt.Models; using ReCodeIt.Models;
using ReCodeIt.Utils; using ReCodeIt.Utils;
@ -15,8 +14,8 @@ internal static class TypeDefExtensions
return EMatchResult.Disabled; return EMatchResult.Disabled;
} }
// Interfaces cannot be abstract, and abstract cannot be static // Interfaces cannot be abstract
if (type.IsInterface || type.GetStaticConstructor() is not null) if (type.IsInterface)
{ {
score.FailureReason = EFailureReason.IsAbstract; score.FailureReason = EFailureReason.IsAbstract;
return EMatchResult.NoMatch; return EMatchResult.NoMatch;