More minor remap changes

This commit is contained in:
Cj 2024-06-21 21:46:10 -04:00
parent 295b8fe0a6
commit 398aabaf98
4 changed files with 19 additions and 18 deletions

View File

@ -281,14 +281,12 @@ public partial class ReCodeItForm : Form
: DataProvider.Remaps; : DataProvider.Remaps;
var existingRemap = remaps var existingRemap = remaps
.Where(remap => remap.NewTypeName == newRemap.NewTypeName) .FirstOrDefault(remap => remap.NewTypeName == newRemap.NewTypeName);
.FirstOrDefault();
if (existingRemap == null) if (existingRemap == null)
{ {
existingRemap = remaps existingRemap = remaps
.Where(remap => _cachedNewTypeNames.Contains(remap.NewTypeName)) .FirstOrDefault(remap => _cachedNewTypeNames.Contains(remap.NewTypeName));
.FirstOrDefault();
} }
// Handle overwriting an existing remap // Handle overwriting an existing remap

View File

@ -148,22 +148,22 @@ public class ReCodeItRemapper
Definition = type, Definition = type,
}; };
var matches = new HashSet<EMatchResult> var matches = new List<EMatchResult>
{ {
type.MatchIsAbstract(remap.SearchParams, score),
type.MatchIsEnum(remap.SearchParams, score) ,
type.MatchIsNested(remap.SearchParams, score),
type.MatchIsSealed(remap.SearchParams, score) ,
type.MatchIsDerived(remap.SearchParams, score) ,
type.MatchIsInterface(remap.SearchParams, score),
type.MatchHasGenericParameters(remap.SearchParams, score),
type.MatchIsPublic(remap.SearchParams, score) ,
type.MatchHasAttribute(remap.SearchParams, score),
type.MatchConstructors(remap.SearchParams, score), type.MatchConstructors(remap.SearchParams, score),
type.MatchMethods(remap.SearchParams, score), type.MatchMethods(remap.SearchParams, score),
type.MatchFields(remap.SearchParams, score), type.MatchFields(remap.SearchParams, score),
type.MatchProperties(remap.SearchParams, score), type.MatchProperties(remap.SearchParams, score),
type.MatchNestedTypes(remap.SearchParams, score) type.MatchNestedTypes(remap.SearchParams, score),
type.MatchIsPublic(remap.SearchParams, score) ,
type.MatchIsInterface(remap.SearchParams, score),
type.MatchIsAbstract(remap.SearchParams, score),
type.MatchIsSealed(remap.SearchParams, score) ,
type.MatchIsEnum(remap.SearchParams, score) ,
type.MatchIsNested(remap.SearchParams, score),
type.MatchIsDerived(remap.SearchParams, score) ,
type.MatchHasGenericParameters(remap.SearchParams, score),
type.MatchHasAttribute(remap.SearchParams, score),
}; };
var NoMatch = matches.Where(x => x.Equals(EMatchResult.NoMatch)).FirstOrDefault(); var NoMatch = matches.Where(x => x.Equals(EMatchResult.NoMatch)).FirstOrDefault();
@ -268,7 +268,7 @@ public class ReCodeItRemapper
Logger.Log($"Renaming {highestScore.Definition.Name} to {highestScore.ProposedNewName}", ConsoleColor.Green); Logger.Log($"Renaming {highestScore.Definition.Name} to {highestScore.ProposedNewName}", ConsoleColor.Green);
Logger.Log($"Scored: {highestScore.Score} points", ConsoleColor.Green); Logger.Log($"Scored: {highestScore.Score} points", ConsoleColor.Green);
if (filteredScores.Count() > 1) if (filteredScores.Count() > 1 && filteredScores.Skip(1).Any(score => score.Score == highestScore.Score))
{ {
Logger.Log($"Warning! There were {filteredScores.Count()} possible matches. Considering adding more search parameters, Only showing first 5.", ConsoleColor.Yellow); Logger.Log($"Warning! There were {filteredScores.Count()} possible matches. Considering adding more search parameters, Only showing first 5.", ConsoleColor.Yellow);

View File

@ -156,13 +156,15 @@ internal static class TypeDefExtensions
return EMatchResult.Disabled; return EMatchResult.Disabled;
} }
if (parms.IsPublic == false && type.IsNotPublic) if ((bool)!parms.IsPublic && type.IsNotPublic)
{ {
Logger.Log($"Match {type.Name}");
score.Score++; score.Score++;
return EMatchResult.Match; return EMatchResult.Match;
} }
else if ((bool)parms.IsPublic && type.IsPublic)
if ((bool)parms.IsPublic && type.IsPublic)
{ {
score.Score++; score.Score++;
return EMatchResult.Match; return EMatchResult.Match;

View File

@ -50,6 +50,7 @@
"Class", "Class",
"GClass", "GClass",
"GStruct", "GStruct",
"Interface",
"GInterface" "GInterface"
], ],
"PropertyFieldBlackList": [ // Property or fields names to ignore in the automap, these are case sanitized so case does not matter "PropertyFieldBlackList": [ // Property or fields names to ignore in the automap, these are case sanitized so case does not matter