diff --git a/AssemblyRemapper/Models/ScoringModel.cs b/AssemblyRemapper/Models/ScoringModel.cs index d491c30..f35785f 100644 --- a/AssemblyRemapper/Models/ScoringModel.cs +++ b/AssemblyRemapper/Models/ScoringModel.cs @@ -20,7 +20,7 @@ internal class ScoringModel internal static class ScoringModelExtensions { - public static void AddModelToResult(this ScoringModel model) + public static void AddScoreToResult(this ScoringModel model) { try { @@ -28,7 +28,7 @@ internal static class ScoringModelExtensions { foreach (var outVal in modelHashset) { - if (outVal.Definition.FullName == model.Definition.FullName) + if (outVal.Definition.Name == model.Definition.Name) { Logger.Log("Skipping adding duplicate type match to list", ConsoleColor.Yellow); return; diff --git a/AssemblyRemapper/Reflection/Remapper.cs b/AssemblyRemapper/Reflection/Remapper.cs index e3dd15c..2fb1609 100644 --- a/AssemblyRemapper/Reflection/Remapper.cs +++ b/AssemblyRemapper/Reflection/Remapper.cs @@ -192,7 +192,7 @@ internal class Remapper return EFailureReason.HasNestedTypes; } - ScoringModelExtensions.AddModelToResult(score); + score.AddScoreToResult(); return EFailureReason.None; } @@ -222,13 +222,13 @@ internal class Remapper private void ChooseBestMatch(HashSet scores, bool isBest = false) { - if (DataProvider.ScoringModels.Count == 0) + if (scores.Count == 0) { return; } - var highestScore = scores.OrderByDescending(model => model.Score).FirstOrDefault(); - var nextHighestScores = scores.OrderByDescending(model => model.Score).Skip(1); + var highestScore = scores.OrderByDescending(score => score.Score).FirstOrDefault(); + var nextHighestScores = scores.OrderByDescending(score => score.Score).Skip(1); if (highestScore is null) { return; } @@ -243,9 +243,9 @@ internal class Remapper if (scores.Count > 1) { - Logger.Log($"Warning! There were {scores.Count} possible matches. Considering adding more search parameters", ConsoleColor.Yellow); + Logger.Log($"Warning! There were {scores.Count - 1} possible matches. Considering adding more search parameters", ConsoleColor.Yellow); - foreach (var score in scores) + foreach (var score in scores.OrderByDescending(score => score.Score).Skip(1)) { Logger.Log($"{score.Definition.Name} - Score [{score.Score}]", ConsoleColor.Yellow); }