From df8d84b39b9a3c9d4527ce593c52d8f45d060db7 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Mon, 2 Dec 2019 01:53:50 +0100 Subject: [PATCH] Output: Include generic type parameters in class filenames --- Il2CppDumper/Il2CppCSharpDumper.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Il2CppDumper/Il2CppCSharpDumper.cs b/Il2CppDumper/Il2CppCSharpDumper.cs index 67d2ccd..b04e38b 100644 --- a/Il2CppDumper/Il2CppCSharpDumper.cs +++ b/Il2CppDumper/Il2CppCSharpDumper.cs @@ -7,6 +7,7 @@ using System.IO; using System.Linq; using System.Reflection; using System.Text; +using System.Text.RegularExpressions; using Il2CppInspector.Reflection; using CustomAttributeData = Il2CppInspector.Reflection.CustomAttributeData; using MethodInfo = Il2CppInspector.Reflection.MethodInfo; @@ -58,7 +59,8 @@ namespace Il2CppInspector public void WriteFilesByClass(string outPath, bool flattenHierarchy) { var usedAssemblyAttributes = new HashSet(); foreach (var type in model.Assemblies.SelectMany(x => x.DefinedTypes)) { - writeFile($"{outPath}\\{type.FullName.Replace('.', flattenHierarchy ? '.' : '\\')}.cs", + writeFile($"{outPath}\\" + (type.Namespace + (type.Namespace.Length > 0? "." : "") + Regex.Replace(type.Name, "`[0-9]", "")) + .Replace('.', flattenHierarchy ? '.' : '\\') + ".cs", new[] {type}, excludedAssemblyAttributes: usedAssemblyAttributes); usedAssemblyAttributes.UnionWith(type.Assembly.CustomAttributes); }