mirror of
https://github.com/sp-tarkov/assembly-tool.git
synced 2025-02-12 14:30:45 -05:00
Add fields to ignore, currently unused. Other misc changes
This commit is contained in:
parent
a6199ce4a0
commit
06a56a924e
@ -1,6 +1,6 @@
|
||||
{
|
||||
"MappingPath": "",
|
||||
"TypeNamesToMatch": [
|
||||
"TypeNamesToMatch": [ // These are the only types considered when looking for a match
|
||||
"Class",
|
||||
"GClass",
|
||||
"GStruct",
|
||||
@ -9,9 +9,26 @@
|
||||
"Interface",
|
||||
"GInterface"
|
||||
],
|
||||
"MethodsToIgnore": [
|
||||
"MethodNamesToIgnore": [ // Don't try to match on these
|
||||
"method_",
|
||||
"smethod_",
|
||||
"vmethod_"
|
||||
],
|
||||
"FieldNamesToIgnore": [ // Don't try to match on these
|
||||
"action",
|
||||
"bool",
|
||||
"dictionary",
|
||||
"list",
|
||||
"vector",
|
||||
"int",
|
||||
"float",
|
||||
"single",
|
||||
"double",
|
||||
"string",
|
||||
"transform",
|
||||
"ushort",
|
||||
"byte",
|
||||
"object",
|
||||
"gameobject"
|
||||
]
|
||||
}
|
@ -20,5 +20,10 @@ public class Settings
|
||||
/// <summary>
|
||||
/// List of method names to be ignored during the auto-match process.
|
||||
/// </summary>
|
||||
public required List<string> MethodsToIgnore { get; set; }
|
||||
public required List<string> MethodNamesToIgnore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of method names to be ignored during the auto-match process.
|
||||
/// </summary>
|
||||
public required List<string> FieldNamesToIgnore { get; set; }
|
||||
}
|
@ -11,7 +11,8 @@ public class AutoMatcher(List<RemapModel> mappings, string mappingPath)
|
||||
private List<TypeDef>? CandidateTypes { get; set; }
|
||||
|
||||
private static readonly List<string> TypesToMatch = DataProvider.Settings.TypeNamesToMatch;
|
||||
private static readonly List<string> MethodsToIgnore = DataProvider.Settings.MethodsToIgnore;
|
||||
private static readonly List<string> MethodsToIgnore = DataProvider.Settings.MethodNamesToIgnore;
|
||||
private static readonly List<string> FieldsToIgnore = DataProvider.Settings.FieldNamesToIgnore;
|
||||
|
||||
public void AutoMatch(string assemblyPath, string oldTypeName, string newTypeName)
|
||||
{
|
||||
@ -37,6 +38,7 @@ public class AutoMatcher(List<RemapModel> mappings, string mappingPath)
|
||||
|
||||
var remapModel = new RemapModel();
|
||||
remapModel.NewTypeName = newTypeName;
|
||||
remapModel.AutoGenerated = true;
|
||||
|
||||
StartFilter(targetTypeDef, remapModel, assemblyPath);
|
||||
}
|
||||
@ -58,13 +60,13 @@ public class AutoMatcher(List<RemapModel> mappings, string mappingPath)
|
||||
CandidateTypes!.Remove(candidate);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
if (!ContainsTargetMethods(target, candidate, remapModel.SearchParams.Methods))
|
||||
{
|
||||
CandidateTypes!.Remove(candidate);
|
||||
continue;
|
||||
}
|
||||
|
||||
*/
|
||||
if (!ContainsTargetFields(target, candidate, remapModel.SearchParams.Fields))
|
||||
{
|
||||
CandidateTypes!.Remove(candidate);
|
||||
@ -200,18 +202,20 @@ public class AutoMatcher(List<RemapModel> mappings, string mappingPath)
|
||||
if (target.Fields.Count != candidate.Fields.Count) return false;
|
||||
|
||||
var commonFields = target.Fields
|
||||
.Select(s => s.Name)
|
||||
.Intersect(candidate.Fields.Select(s => s.Name));
|
||||
.Select(s => s.Name.String)
|
||||
.Intersect(candidate.Fields.Select(s => s.Name.String));
|
||||
|
||||
// Methods in target that are not in candidate
|
||||
// Fields in target that are not in candidate
|
||||
var includeFields = target.Fields
|
||||
.Select(s => s.Name.ToString())
|
||||
.Except(candidate.Fields.Select(s => s.Name.ToString()));
|
||||
.Select(s => s.Name.String)
|
||||
.Except(candidate.Fields.Select(s => s.Name.String));
|
||||
|
||||
// Methods in candidate that are not in target
|
||||
// Fields in candidate that are not in target
|
||||
var excludeFields = candidate.Fields
|
||||
.Select(s => s.Name.ToString())
|
||||
.Except(target.Fields.Select(s => s.Name.ToString()));
|
||||
.Select(s => s.Name.String)
|
||||
.Except(target.Fields.Select(s => s.Name.String));
|
||||
|
||||
Logger.LogSync(string.Join(", ", includeFields));
|
||||
|
||||
fields.IncludeFields.UnionWith(includeFields);
|
||||
fields.ExcludeFields.UnionWith(excludeFields);
|
||||
@ -371,8 +375,6 @@ public class AutoMatcher(List<RemapModel> mappings, string mappingPath)
|
||||
return;
|
||||
}
|
||||
|
||||
remapModel.AutoGenerated = true;
|
||||
|
||||
mappings.Add(remapModel);
|
||||
DataProvider.UpdateMapping(mappingPath, mappings);
|
||||
}
|
||||
|
@ -78,10 +78,10 @@ public class Statistics(
|
||||
|
||||
if (validate && remap.Succeeded)
|
||||
{
|
||||
Logger.Log("Generated Model: ", ConsoleColor.Blue);
|
||||
Logger.LogSync("Generated Model: ", ConsoleColor.Blue);
|
||||
Logger.LogRemapModel(remap);
|
||||
|
||||
Logger.Log("Passed validation", ConsoleColor.Green);
|
||||
Logger.LogSync("Passed validation", ConsoleColor.Green);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,12 @@ public static class Logger
|
||||
|
||||
public static void LogRemapModel(RemapModel remapModel)
|
||||
{
|
||||
var str = JsonConvert.SerializeObject(remapModel, Formatting.Indented);
|
||||
var settings = new JsonSerializerSettings()
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
};
|
||||
|
||||
var str = JsonConvert.SerializeObject(remapModel, Formatting.Indented, settings);
|
||||
LogSync(str, ConsoleColor.Blue);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user