52 lines
1.3 KiB
C#
Raw Normal View History

2024-06-11 23:07:59 -04:00
using AssemblyRemapper.Utils;
2024-06-11 19:18:48 -04:00
using Mono.Cecil;
namespace AssemblyRemapper.Models;
internal class ScoringModel
{
public int Score { get; set; } = 0;
public string ProposedNewName { get; set; }
public TypeDefinition Definition { get; set; }
public ScoringModel()
{
}
}
internal static class ScoringModelExtensions
{
public static void AddModelToResult(this ScoringModel model)
{
try
{
2024-06-11 23:07:59 -04:00
if (DataProvider.ScoringModels.TryGetValue(model.ProposedNewName, out HashSet<ScoringModel> modelHashset))
2024-06-11 19:18:48 -04:00
{
2024-06-11 23:07:59 -04:00
foreach (var outVal in modelHashset)
{
if (outVal.Definition.FullName == model.Definition.FullName)
{
Logger.Log("Skipping adding duplicate type match to list", ConsoleColor.Yellow);
return;
}
}
2024-06-11 19:18:48 -04:00
modelHashset.Add(model);
return;
}
var newHash = new HashSet<ScoringModel>
{
model
};
2024-06-11 23:07:59 -04:00
DataProvider.ScoringModels.Add(model.ProposedNewName, newHash);
2024-06-11 19:18:48 -04:00
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
}