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;
var existingRemap = remaps
.Where(remap => remap.NewTypeName == newRemap.NewTypeName)
.FirstOrDefault();
.FirstOrDefault(remap => remap.NewTypeName == newRemap.NewTypeName);
if (existingRemap == null)
{
existingRemap = remaps
.Where(remap => _cachedNewTypeNames.Contains(remap.NewTypeName))
.FirstOrDefault();
.FirstOrDefault(remap => _cachedNewTypeNames.Contains(remap.NewTypeName));
}
// Handle overwriting an existing remap

View File

@ -148,22 +148,22 @@ public class ReCodeItRemapper
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.MatchMethods(remap.SearchParams, score),
type.MatchFields(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();
@ -268,7 +268,7 @@ public class ReCodeItRemapper
Logger.Log($"Renaming {highestScore.Definition.Name} to {highestScore.ProposedNewName}", 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);

View File

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

View File

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