mirror of
https://github.com/sp-tarkov/assembly-tool.git
synced 2025-02-13 00:50:45 -05:00
Fix some remapper issues
This commit is contained in:
parent
6ec22dbd98
commit
85fba2fb56
@ -129,6 +129,8 @@ public class ReCodeItRemapper
|
|||||||
|
|
||||||
foreach (var nestedType in type.NestedTypes)
|
foreach (var nestedType in type.NestedTypes)
|
||||||
{
|
{
|
||||||
|
if (remap.SearchParams.IsNested is false) { return; }
|
||||||
|
|
||||||
FindMatch(nestedType, remap);
|
FindMatch(nestedType, remap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +167,10 @@ public class ReCodeItRemapper
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var match = matches.Where(x => x.Equals(EMatchResult.Match)).Any();
|
var match = matches
|
||||||
|
.Where(x => x.Equals(EMatchResult.Match))
|
||||||
|
.Where(x => !x.Equals(EMatchResult.Disabled))
|
||||||
|
.Any();
|
||||||
|
|
||||||
if (match)
|
if (match)
|
||||||
{
|
{
|
||||||
@ -244,7 +249,9 @@ public class ReCodeItRemapper
|
|||||||
if (scores.Count == 0) { return; }
|
if (scores.Count == 0) { return; }
|
||||||
|
|
||||||
var filteredScores = scores
|
var filteredScores = scores
|
||||||
.OrderByDescending(score => score.Score);
|
.Where(score => score.Score > 0)
|
||||||
|
.OrderByDescending(score => score.Score)
|
||||||
|
.Take(5);
|
||||||
|
|
||||||
var highestScore = filteredScores.FirstOrDefault();
|
var highestScore = filteredScores.FirstOrDefault();
|
||||||
|
|
||||||
@ -252,13 +259,11 @@ public class ReCodeItRemapper
|
|||||||
|
|
||||||
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
|
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
|
||||||
Logger.Log($"Renaming {highestScore.Definition.Name} to {highestScore.ProposedNewName}", ConsoleColor.Green);
|
Logger.Log($"Renaming {highestScore.Definition.Name} to {highestScore.ProposedNewName}", ConsoleColor.Green);
|
||||||
Logger.Log($"Max possible score: {highestScore.ReMap.SearchParams.CalculateMaxScore()}", ConsoleColor.Green);
|
|
||||||
Logger.Log($"Scored: {highestScore.Score} points", ConsoleColor.Green);
|
Logger.Log($"Scored: {highestScore.Score} points", ConsoleColor.Green);
|
||||||
|
|
||||||
if (scores.Count > 1)
|
if (filteredScores.Count() > 1)
|
||||||
{
|
{
|
||||||
Logger.Log($"Warning! There were {filteredScores.Count()} possible matches. Considering adding more search parameters", ConsoleColor.Yellow);
|
Logger.Log($"Warning! There were {filteredScores.Count()} possible matches. Considering adding more search parameters, Only showing first 5.", ConsoleColor.Yellow);
|
||||||
Logger.Log($"Only showing first 5.", ConsoleColor.Yellow);
|
|
||||||
|
|
||||||
foreach (var score in filteredScores.Skip(1).Take(5))
|
foreach (var score in filteredScores.Skip(1).Take(5))
|
||||||
{
|
{
|
||||||
|
@ -19,12 +19,14 @@ internal static class Fields
|
|||||||
if (parms.IncludeFields is null || parms.IncludeFields.Count == 0) return EMatchResult.Disabled;
|
if (parms.IncludeFields is null || parms.IncludeFields.Count == 0) return EMatchResult.Disabled;
|
||||||
|
|
||||||
var matches = type.Fields
|
var matches = type.Fields
|
||||||
.Where(field => parms.IncludeFields.Contains(field.Name));
|
.Where(field => parms.IncludeFields.Contains(field.Name))
|
||||||
score.Score += matches.Count();
|
.Count();
|
||||||
|
|
||||||
score.FailureReason = matches.Any() ? EFailureReason.None : EFailureReason.FieldsInclude;
|
score.Score += matches;
|
||||||
|
|
||||||
return matches.Any()
|
score.FailureReason = matches > 0 ? EFailureReason.None : EFailureReason.FieldsInclude;
|
||||||
|
|
||||||
|
return matches > 0
|
||||||
? EMatchResult.Match
|
? EMatchResult.Match
|
||||||
: EMatchResult.NoMatch;
|
: EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
@ -44,9 +46,9 @@ internal static class Fields
|
|||||||
.Where(field => parms.ExcludeFields.Contains(field.Name))
|
.Where(field => parms.ExcludeFields.Contains(field.Name))
|
||||||
.Count();
|
.Count();
|
||||||
|
|
||||||
score.Score += matches;
|
score.Score -= matches;
|
||||||
|
|
||||||
score.FailureReason = matches > 0 ? EFailureReason.None : EFailureReason.FieldsExclude;
|
score.FailureReason = matches > 0 ? EFailureReason.FieldsExclude : EFailureReason.None;
|
||||||
|
|
||||||
return matches > 0
|
return matches > 0
|
||||||
? EMatchResult.NoMatch
|
? EMatchResult.NoMatch
|
||||||
|
@ -46,9 +46,9 @@ internal static class Methods
|
|||||||
.Where(method => parms.ExcludeMethods.Contains(method.Name))
|
.Where(method => parms.ExcludeMethods.Contains(method.Name))
|
||||||
.Count();
|
.Count();
|
||||||
|
|
||||||
score.Score += matches;
|
score.Score -= matches;
|
||||||
|
|
||||||
score.FailureReason = matches > 0 ? EFailureReason.None : EFailureReason.MethodsExclude;
|
score.FailureReason = matches > 0 ? EFailureReason.MethodsExclude : EFailureReason.None;
|
||||||
|
|
||||||
return matches > 0
|
return matches > 0
|
||||||
? EMatchResult.NoMatch
|
? EMatchResult.NoMatch
|
||||||
|
@ -31,9 +31,9 @@ namespace ReCodeIt.ReMapper.Search
|
|||||||
.Where(property => parms.ExcludeProperties.Contains(property.Name))
|
.Where(property => parms.ExcludeProperties.Contains(property.Name))
|
||||||
.Count();
|
.Count();
|
||||||
|
|
||||||
score.Score += matches;
|
score.Score -= matches;
|
||||||
|
|
||||||
score.FailureReason = matches > 0 ? EFailureReason.None : EFailureReason.PropertiesExclude;
|
score.FailureReason = matches > 0 ? EFailureReason.PropertiesExclude : EFailureReason.None;
|
||||||
|
|
||||||
return matches > 0
|
return matches > 0
|
||||||
? EMatchResult.NoMatch
|
? EMatchResult.NoMatch
|
||||||
|
Loading…
x
Reference in New Issue
Block a user