Move default excluded namespaces to Constants

This commit is contained in:
Katy Coe
2020-02-09 11:05:22 +01:00
parent 0dd66b0b21
commit e6c8be5e2b
2 changed files with 14 additions and 15 deletions

View File

@@ -36,5 +36,18 @@ namespace Il2CppInspector.Reflection
"using", /* "using static", */ "virtual", "void", "using", /* "using static", */ "virtual", "void",
"volatile", "while" "volatile", "while"
}; };
// Default namespaces to exclude
public static readonly List<string> DefaultExcludedNamespaces = new List<string> {
"System",
"Mono",
"Microsoft.Win32",
"Unity",
"UnityEditor",
"UnityEngine",
"UnityEngineInternal",
"AOT",
"JetBrains.Annotations"
};
} }
} }

View File

@@ -41,25 +41,11 @@ namespace Il2CppInspector
if (inspectors.Count == 0) if (inspectors.Count == 0)
throw new Exception("Could not find any images in the IL2CPP binary"); throw new Exception("Could not find any images in the IL2CPP binary");
// Exclusions
var excludedNamespaces = new List<string> {
"System",
"Mono",
"Microsoft.Win32",
"Unity",
"UnityEditor",
"UnityEngine",
"UnityEngineInternal",
"AOT",
"JetBrains.Annotations"
};
// Dump each image in the binary separately // Dump each image in the binary separately
int i = 0; int i = 0;
foreach (var il2cpp in inspectors) foreach (var il2cpp in inspectors)
new CSharpCodeStubs(new Il2CppModel(il2cpp)) { new CSharpCodeStubs(new Il2CppModel(il2cpp)) {
ExcludedNamespaces = excludedNamespaces, ExcludedNamespaces = Constants.DefaultExcludedNamespaces,
SuppressMetadata = false, SuppressMetadata = false,
MustCompile = true MustCompile = true
}.WriteSingleFile(testPath + @"\test-result" + (i++ > 0 ? "-" + (i - 1) : "") + ".cs"); }.WriteSingleFile(testPath + @"\test-result" + (i++ > 0 ? "-" + (i - 1) : "") + ".cs");