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 string ProposedNewName { get; set; }
|
2024-06-12 00:05:59 -04:00
|
|
|
|
public Remap Remap { get; set; }
|
|
|
|
|
public int Score { get; set; } = 0;
|
2024-06-11 19:18:48 -04:00
|
|
|
|
|
|
|
|
|
public TypeDefinition Definition { get; set; }
|
2024-06-12 00:05:59 -04:00
|
|
|
|
public RemapModel RemapModel { get; internal set; }
|
2024-06-11 19:18:48 -04:00
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|