diff --git a/Assets/Templates/Settings.jsonc b/Assets/Templates/Settings.jsonc
index 2dac8c4..9e3bef3 100644
--- a/Assets/Templates/Settings.jsonc
+++ b/Assets/Templates/Settings.jsonc
@@ -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"
]
}
\ No newline at end of file
diff --git a/RecodeItLib/Models/AppSettingsModel.cs b/RecodeItLib/Models/AppSettingsModel.cs
index 29cbe9f..7ab51f6 100644
--- a/RecodeItLib/Models/AppSettingsModel.cs
+++ b/RecodeItLib/Models/AppSettingsModel.cs
@@ -20,5 +20,10 @@ public class Settings
///
/// List of method names to be ignored during the auto-match process.
///
- public required List MethodsToIgnore { get; set; }
+ public required List MethodNamesToIgnore { get; set; }
+
+ ///
+ /// List of method names to be ignored during the auto-match process.
+ ///
+ public required List FieldNamesToIgnore { get; set; }
}
\ No newline at end of file
diff --git a/RecodeItLib/Remapper/AutoMatcher.cs b/RecodeItLib/Remapper/AutoMatcher.cs
index 97cb28c..b230c11 100644
--- a/RecodeItLib/Remapper/AutoMatcher.cs
+++ b/RecodeItLib/Remapper/AutoMatcher.cs
@@ -11,7 +11,8 @@ public class AutoMatcher(List mappings, string mappingPath)
private List? CandidateTypes { get; set; }
private static readonly List TypesToMatch = DataProvider.Settings.TypeNamesToMatch;
- private static readonly List MethodsToIgnore = DataProvider.Settings.MethodsToIgnore;
+ private static readonly List MethodsToIgnore = DataProvider.Settings.MethodNamesToIgnore;
+ private static readonly List FieldsToIgnore = DataProvider.Settings.FieldNamesToIgnore;
public void AutoMatch(string assemblyPath, string oldTypeName, string newTypeName)
{
@@ -37,6 +38,7 @@ public class AutoMatcher(List 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 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 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 mappings, string mappingPath)
return;
}
- remapModel.AutoGenerated = true;
-
mappings.Add(remapModel);
DataProvider.UpdateMapping(mappingPath, mappings);
}
diff --git a/RecodeItLib/Remapper/Statistics.cs b/RecodeItLib/Remapper/Statistics.cs
index 819c211..e2ad56e 100644
--- a/RecodeItLib/Remapper/Statistics.cs
+++ b/RecodeItLib/Remapper/Statistics.cs
@@ -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;
}
diff --git a/RecodeItLib/Utils/Logger.cs b/RecodeItLib/Utils/Logger.cs
index 61be1e0..6fd4764 100644
--- a/RecodeItLib/Utils/Logger.cs
+++ b/RecodeItLib/Utils/Logger.cs
@@ -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);
}