Refactor
This commit is contained in:
parent
dfd50b3b75
commit
dcae6663b4
@ -25,8 +25,17 @@ namespace AssemblyRemapper.Commands
|
|||||||
{
|
{
|
||||||
var remapper = new Remapper();
|
var remapper = new Remapper();
|
||||||
|
|
||||||
|
DataProvider.LoadMappingFile();
|
||||||
|
DataProvider.LoadAssemblyDefinition();
|
||||||
|
|
||||||
remapper.InitializeRemap();
|
remapper.InitializeRemap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (command == "clear")
|
||||||
|
{
|
||||||
|
Console.Clear();
|
||||||
|
ShowStartText();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowStartText()
|
private void ShowStartText()
|
||||||
@ -34,7 +43,7 @@ namespace AssemblyRemapper.Commands
|
|||||||
Logger.Log($"-----------------------------------------------------------------", ConsoleColor.Green);
|
Logger.Log($"-----------------------------------------------------------------", ConsoleColor.Green);
|
||||||
Logger.Log($"Cj's Assembly Tool", ConsoleColor.Green);
|
Logger.Log($"Cj's Assembly Tool", ConsoleColor.Green);
|
||||||
Logger.Log($"Version 0.1.0", ConsoleColor.Green);
|
Logger.Log($"Version 0.1.0", ConsoleColor.Green);
|
||||||
Logger.Log($"Available Commands: `remap` `help`", ConsoleColor.Green);
|
Logger.Log($"Available Commands: `remap` `clear`", ConsoleColor.Green);
|
||||||
Logger.Log($"-----------------------------------------------------------------", ConsoleColor.Green);
|
Logger.Log($"-----------------------------------------------------------------", ConsoleColor.Green);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,51 +14,5 @@ internal class AppSettings
|
|||||||
|
|
||||||
public string AssemblyPath { get; set; }
|
public string AssemblyPath { get; set; }
|
||||||
public string OutputPath { get; set; }
|
public string OutputPath { get; set; }
|
||||||
|
public string MappingPath { get; set; }
|
||||||
public HashSet<Remap> Remaps { get; set; } = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Object to store linq statements in inside of json to search and remap classes
|
|
||||||
/// </summary>
|
|
||||||
internal class Remap
|
|
||||||
{
|
|
||||||
public string NewTypeName { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public string OldTypeName { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public bool UseForceRename { get; set; }
|
|
||||||
|
|
||||||
public RemapSearchParams SearchParams { get; set; } = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Search filters to find types and remap them
|
|
||||||
/// </summary>
|
|
||||||
internal class RemapSearchParams
|
|
||||||
{
|
|
||||||
public bool? IsPublic { get; set; } = null;
|
|
||||||
public bool? IsAbstract { get; set; } = null;
|
|
||||||
public bool? IsInterface { get; set; } = null;
|
|
||||||
public bool? IsEnum { get; set; } = null;
|
|
||||||
public bool? IsNested { get; set; } = null;
|
|
||||||
public string? ParentName { get; set; } = null;
|
|
||||||
public bool? IsSealed { get; set; } = null;
|
|
||||||
public bool? HasAttribute { get; set; } = null;
|
|
||||||
public bool? IsDerived { get; set; } = null;
|
|
||||||
public bool? HasGenericParameters { get; set; } = null;
|
|
||||||
public HashSet<string> MethodNamesToMatch { get; set; } = [];
|
|
||||||
public HashSet<string> MethodNamesToIgnore { get; set; } = [];
|
|
||||||
|
|
||||||
public HashSet<string> FieldNamesToMatch { get; set; } = [];
|
|
||||||
public HashSet<string> FieldNamesToIgnore { get; set; } = [];
|
|
||||||
public HashSet<string> PropertyNamesToMatch { get; set; } = [];
|
|
||||||
public HashSet<string> PropertyNamesToIgnore { get; set; } = [];
|
|
||||||
|
|
||||||
public HashSet<string> NestedTypesToMatch { get; set; } = [];
|
|
||||||
public HashSet<string> NestedTypesToIgnore { get; set; } = [];
|
|
||||||
|
|
||||||
public RemapSearchParams()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
46
AssemblyRemapper/Models/RemapModel.cs
Normal file
46
AssemblyRemapper/Models/RemapModel.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
namespace AssemblyRemapper.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Object to store linq statements in inside of json to search and remap classes
|
||||||
|
/// </summary>
|
||||||
|
internal class RemapModel
|
||||||
|
{
|
||||||
|
public string NewTypeName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string OriginalTypeName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public bool UseForceRename { get; set; }
|
||||||
|
|
||||||
|
public SearchParams SearchParams { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Search filters to find types and remap them
|
||||||
|
/// </summary>
|
||||||
|
internal class SearchParams
|
||||||
|
{
|
||||||
|
public bool? IsPublic { get; set; } = null;
|
||||||
|
public bool? IsAbstract { get; set; } = null;
|
||||||
|
public bool? IsInterface { get; set; } = null;
|
||||||
|
public bool? IsEnum { get; set; } = null;
|
||||||
|
public bool? IsNested { get; set; } = null;
|
||||||
|
public string? ParentName { get; set; } = null;
|
||||||
|
public bool? IsSealed { get; set; } = null;
|
||||||
|
public bool? HasAttribute { get; set; } = null;
|
||||||
|
public bool? IsDerived { get; set; } = null;
|
||||||
|
public bool? HasGenericParameters { get; set; } = null;
|
||||||
|
public HashSet<string> MethodNamesToMatch { get; set; } = [];
|
||||||
|
public HashSet<string> MethodNamesToIgnore { get; set; } = [];
|
||||||
|
|
||||||
|
public HashSet<string> FieldNamesToMatch { get; set; } = [];
|
||||||
|
public HashSet<string> FieldNamesToIgnore { get; set; } = [];
|
||||||
|
public HashSet<string> PropertyNamesToMatch { get; set; } = [];
|
||||||
|
public HashSet<string> PropertyNamesToIgnore { get; set; } = [];
|
||||||
|
|
||||||
|
public HashSet<string> NestedTypesToMatch { get; set; } = [];
|
||||||
|
public HashSet<string> NestedTypesToIgnore { get; set; } = [];
|
||||||
|
|
||||||
|
public SearchParams()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -5,11 +5,12 @@ namespace AssemblyRemapper.Models;
|
|||||||
|
|
||||||
internal class ScoringModel
|
internal class ScoringModel
|
||||||
{
|
{
|
||||||
|
public string ProposedNewName { get; set; }
|
||||||
|
public Remap Remap { get; set; }
|
||||||
public int Score { get; set; } = 0;
|
public int Score { get; set; } = 0;
|
||||||
|
|
||||||
public string ProposedNewName { get; set; }
|
|
||||||
|
|
||||||
public TypeDefinition Definition { get; set; }
|
public TypeDefinition Definition { get; set; }
|
||||||
|
public RemapModel RemapModel { get; internal set; }
|
||||||
|
|
||||||
public ScoringModel()
|
public ScoringModel()
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@ internal class Remapper
|
|||||||
|
|
||||||
private void StartRemap()
|
private void StartRemap()
|
||||||
{
|
{
|
||||||
foreach (var remap in DataProvider.AppSettings.Remaps)
|
foreach (var remap in DataProvider.Remaps)
|
||||||
{
|
{
|
||||||
Logger.Log($"Trying to remap {remap.NewTypeName}...", ConsoleColor.Gray);
|
Logger.Log($"Trying to remap {remap.NewTypeName}...", ConsoleColor.Gray);
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ internal class Remapper
|
|||||||
WriteAssembly();
|
WriteAssembly();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleMapping(Remap mapping)
|
private void HandleMapping(RemapModel mapping)
|
||||||
{
|
{
|
||||||
foreach (var type in DataProvider.ModuleDefinition.Types)
|
foreach (var type in DataProvider.ModuleDefinition.Types)
|
||||||
{
|
{
|
||||||
@ -101,7 +101,7 @@ internal class Remapper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ScoreType(TypeDefinition type, Remap remap, string parentTypeName = "")
|
private void ScoreType(TypeDefinition type, RemapModel remap, string parentTypeName = "")
|
||||||
{
|
{
|
||||||
// Handle Direct Remaps by strict naming first bypasses everything else
|
// Handle Direct Remaps by strict naming first bypasses everything else
|
||||||
if (remap.UseForceRename)
|
if (remap.UseForceRename)
|
||||||
@ -117,8 +117,9 @@ internal class Remapper
|
|||||||
|
|
||||||
var score = new ScoringModel
|
var score = new ScoringModel
|
||||||
{
|
{
|
||||||
Definition = type,
|
|
||||||
ProposedNewName = remap.NewTypeName,
|
ProposedNewName = remap.NewTypeName,
|
||||||
|
RemapModel = remap,
|
||||||
|
Definition = type,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (type.MatchIsAbstract(remap.SearchParams, score) == EMatchResult.NoMatch)
|
if (type.MatchIsAbstract(remap.SearchParams, score) == EMatchResult.NoMatch)
|
||||||
@ -126,7 +127,7 @@ internal class Remapper
|
|||||||
LogDiscard("IsAbstract", type.Name, score.ProposedNewName);
|
LogDiscard("IsAbstract", type.Name, score.ProposedNewName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (type.MatchIsEnum(remap.SearchParams, score) == EMatchResult.NoMatch)
|
if (type.MatchIsEnum(remap.SearchParams, score) == EMatchResult.NoMatch)
|
||||||
{
|
{
|
||||||
LogDiscard("IsEnum", type.Name, score.ProposedNewName);
|
LogDiscard("IsEnum", type.Name, score.ProposedNewName);
|
||||||
@ -145,7 +146,6 @@ internal class Remapper
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
if (type.MatchIsDerived(remap.SearchParams, score) == EMatchResult.NoMatch)
|
if (type.MatchIsDerived(remap.SearchParams, score) == EMatchResult.NoMatch)
|
||||||
{
|
{
|
||||||
LogDiscard("IsDerived", type.Name, score.ProposedNewName);
|
LogDiscard("IsDerived", type.Name, score.ProposedNewName);
|
||||||
@ -202,9 +202,9 @@ internal class Remapper
|
|||||||
ScoringModelExtensions.AddModelToResult(score);
|
ScoringModelExtensions.AddModelToResult(score);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleByDirectName(TypeDefinition type, Remap remap)
|
private void HandleByDirectName(TypeDefinition type, RemapModel remap)
|
||||||
{
|
{
|
||||||
if (type.Name != remap.OldTypeName) { return; }
|
if (type.Name != remap.OriginalTypeName) { return; }
|
||||||
|
|
||||||
var oldName = type.Name;
|
var oldName = type.Name;
|
||||||
type.Name = remap.NewTypeName;
|
type.Name = remap.NewTypeName;
|
||||||
@ -248,12 +248,13 @@ internal class Remapper
|
|||||||
: "Next potential";
|
: "Next potential";
|
||||||
|
|
||||||
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
|
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
|
||||||
Logger.Log($"Found {scores.Count} results from search", ConsoleColor.Green);
|
Logger.Log($"Renaming {highestScore.Definition.Name} to {highestScore.ProposedNewName}", ConsoleColor.Green);
|
||||||
Logger.Log($"{potentialText} match is `{highestScore.Definition.Name}` for `{highestScore.ProposedNewName}`", ConsoleColor.Green);
|
|
||||||
|
highestScore.Definition.Name = highestScore.ProposedNewName;
|
||||||
|
|
||||||
foreach (var score in nextHighestScores)
|
foreach (var score in nextHighestScores)
|
||||||
{
|
{
|
||||||
Logger.Log($"Next potential match is `{score.Definition.Name}` for `{highestScore.ProposedNewName}`", ConsoleColor.Yellow);
|
Logger.Log($"Alternative match `{score.Definition.Name}` for `{highestScore.ProposedNewName}`", ConsoleColor.Yellow);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DataProvider.AppSettings.ScoringMode)
|
if (DataProvider.AppSettings.ScoringMode)
|
||||||
|
@ -8,7 +8,7 @@ namespace AssemblyRemapper.Reflection;
|
|||||||
internal static class RenameService
|
internal static class RenameService
|
||||||
{
|
{
|
||||||
public static void RenameAllFields(
|
public static void RenameAllFields(
|
||||||
Remap remap,
|
RemapModel remap,
|
||||||
Collection<TypeDefinition> typesToCheck)
|
Collection<TypeDefinition> typesToCheck)
|
||||||
{
|
{
|
||||||
foreach (var type in typesToCheck)
|
foreach (var type in typesToCheck)
|
||||||
@ -36,7 +36,7 @@ internal static class RenameService
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void RenameAllProperties(
|
public static void RenameAllProperties(
|
||||||
Remap remap,
|
RemapModel remap,
|
||||||
Collection<TypeDefinition> typesToCheck)
|
Collection<TypeDefinition> typesToCheck)
|
||||||
{
|
{
|
||||||
foreach (var type in typesToCheck)
|
foreach (var type in typesToCheck)
|
||||||
|
@ -8,7 +8,7 @@ internal static class SearchProvider
|
|||||||
{
|
{
|
||||||
public static int MatchCount { get; private set; }
|
public static int MatchCount { get; private set; }
|
||||||
|
|
||||||
public static EMatchResult MatchIsAbstract(this TypeDefinition type, RemapSearchParams parms, ScoringModel score)
|
public static EMatchResult MatchIsAbstract(this TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.IsAbstract is null)
|
if (parms.IsAbstract is null)
|
||||||
{
|
{
|
||||||
@ -30,7 +30,7 @@ internal static class SearchProvider
|
|||||||
return EMatchResult.NoMatch;
|
return EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchIsEnum(this TypeDefinition type, RemapSearchParams parms, ScoringModel score)
|
public static EMatchResult MatchIsEnum(this TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.IsEnum is null)
|
if (parms.IsEnum is null)
|
||||||
{
|
{
|
||||||
@ -46,7 +46,7 @@ internal static class SearchProvider
|
|||||||
return EMatchResult.NoMatch;
|
return EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchIsNested(this TypeDefinition type, RemapSearchParams parms, ScoringModel score)
|
public static EMatchResult MatchIsNested(this TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.IsNested is null)
|
if (parms.IsNested is null)
|
||||||
{
|
{
|
||||||
@ -62,7 +62,7 @@ internal static class SearchProvider
|
|||||||
return EMatchResult.NoMatch;
|
return EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchIsSealed(this TypeDefinition type, RemapSearchParams parms, ScoringModel score)
|
public static EMatchResult MatchIsSealed(this TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.IsSealed is null)
|
if (parms.IsSealed is null)
|
||||||
{
|
{
|
||||||
@ -78,7 +78,7 @@ internal static class SearchProvider
|
|||||||
return EMatchResult.NoMatch;
|
return EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchIsDerived(this TypeDefinition type, RemapSearchParams parms, ScoringModel score)
|
public static EMatchResult MatchIsDerived(this TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.IsDerived is null)
|
if (parms.IsDerived is null)
|
||||||
{
|
{
|
||||||
@ -94,7 +94,7 @@ internal static class SearchProvider
|
|||||||
return EMatchResult.NoMatch;
|
return EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchIsInterface(this TypeDefinition type, RemapSearchParams parms, ScoringModel score)
|
public static EMatchResult MatchIsInterface(this TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.IsInterface is null)
|
if (parms.IsInterface is null)
|
||||||
{
|
{
|
||||||
@ -110,7 +110,7 @@ internal static class SearchProvider
|
|||||||
return EMatchResult.NoMatch;
|
return EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchIsGeneric(this TypeDefinition type, RemapSearchParams parms, ScoringModel score)
|
public static EMatchResult MatchIsGeneric(this TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.HasGenericParameters is null)
|
if (parms.HasGenericParameters is null)
|
||||||
{
|
{
|
||||||
@ -126,7 +126,7 @@ internal static class SearchProvider
|
|||||||
return EMatchResult.NoMatch;
|
return EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchIsPublic(this TypeDefinition type, RemapSearchParams parms, ScoringModel score)
|
public static EMatchResult MatchIsPublic(this TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.IsPublic is null)
|
if (parms.IsPublic is null)
|
||||||
{
|
{
|
||||||
@ -144,7 +144,7 @@ internal static class SearchProvider
|
|||||||
return EMatchResult.NoMatch;
|
return EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchHasAttribute(this TypeDefinition type, RemapSearchParams parms, ScoringModel score)
|
public static EMatchResult MatchHasAttribute(this TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.HasAttribute is null)
|
if (parms.HasAttribute is null)
|
||||||
{
|
{
|
||||||
@ -160,7 +160,7 @@ internal static class SearchProvider
|
|||||||
return EMatchResult.NoMatch;
|
return EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchMethods(this TypeDefinition type, RemapSearchParams parms, ScoringModel score)
|
public static EMatchResult MatchMethods(this TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.MethodNamesToMatch.Count == 0) { return EMatchResult.Disabled; }
|
if (parms.MethodNamesToMatch.Count == 0) { return EMatchResult.Disabled; }
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ internal static class SearchProvider
|
|||||||
return matchCount > 0 ? EMatchResult.Match : EMatchResult.NoMatch;
|
return matchCount > 0 ? EMatchResult.Match : EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchFields(this TypeDefinition type, RemapSearchParams parms, ScoringModel score)
|
public static EMatchResult MatchFields(this TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.FieldNamesToMatch.Count == 0) { return EMatchResult.Disabled; }
|
if (parms.FieldNamesToMatch.Count == 0) { return EMatchResult.Disabled; }
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ internal static class SearchProvider
|
|||||||
return matchCount > 0 ? EMatchResult.Match : EMatchResult.NoMatch;
|
return matchCount > 0 ? EMatchResult.Match : EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchProperties(this TypeDefinition type, RemapSearchParams parms, ScoringModel score)
|
public static EMatchResult MatchProperties(this TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.PropertyNamesToMatch.Count == 0) { return EMatchResult.Disabled; }
|
if (parms.PropertyNamesToMatch.Count == 0) { return EMatchResult.Disabled; }
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ internal static class SearchProvider
|
|||||||
return matchCount > 0 ? EMatchResult.Match : EMatchResult.NoMatch;
|
return matchCount > 0 ? EMatchResult.Match : EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchNestedTypes(this TypeDefinition type, RemapSearchParams parms, ScoringModel score)
|
public static EMatchResult MatchNestedTypes(this TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.NestedTypesToMatch.Count == 0) { return EMatchResult.Disabled; }
|
if (parms.NestedTypesToMatch.Count == 0) { return EMatchResult.Disabled; }
|
||||||
|
|
||||||
|
@ -9,9 +9,10 @@ internal static class DataProvider
|
|||||||
static DataProvider()
|
static DataProvider()
|
||||||
{
|
{
|
||||||
LoadAppSettings();
|
LoadAppSettings();
|
||||||
LoadAssemblyDefinition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HashSet<RemapModel> Remaps { get; private set; } = [];
|
||||||
|
|
||||||
public static Dictionary<string, HashSet<ScoringModel>> ScoringModels { get; set; } = [];
|
public static Dictionary<string, HashSet<ScoringModel>> ScoringModels { get; set; } = [];
|
||||||
|
|
||||||
public static AppSettings AppSettings { get; private set; }
|
public static AppSettings AppSettings { get; private set; }
|
||||||
@ -39,7 +40,22 @@ internal static class DataProvider
|
|||||||
AppSettings = JsonConvert.DeserializeObject<AppSettings>(jsonText, settings);
|
AppSettings = JsonConvert.DeserializeObject<AppSettings>(jsonText, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LoadAssemblyDefinition()
|
public static void LoadMappingFile()
|
||||||
|
{
|
||||||
|
if (!File.Exists(AppSettings.MappingPath))
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"path `{AppSettings.MappingPath}` does not exist...");
|
||||||
|
}
|
||||||
|
|
||||||
|
var jsonText = File.ReadAllText(AppSettings.MappingPath);
|
||||||
|
|
||||||
|
Remaps = [];
|
||||||
|
ScoringModels = [];
|
||||||
|
|
||||||
|
Remaps = JsonConvert.DeserializeObject<HashSet<RemapModel>>(jsonText);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void LoadAssemblyDefinition()
|
||||||
{
|
{
|
||||||
DefaultAssemblyResolver resolver = new();
|
DefaultAssemblyResolver resolver = new();
|
||||||
resolver.AddSearchDirectory(Path.GetDirectoryName(AppSettings.AssemblyPath)); // Replace with the correct path
|
resolver.AddSearchDirectory(Path.GetDirectoryName(AppSettings.AssemblyPath)); // Replace with the correct path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user