diff --git a/Il2CppInterop.Generator/Passes/Pass10CreateTypedefs.cs b/Il2CppInterop.Generator/Passes/Pass10CreateTypedefs.cs index 9181729d..a2124525 100644 --- a/Il2CppInterop.Generator/Passes/Pass10CreateTypedefs.cs +++ b/Il2CppInterop.Generator/Passes/Pass10CreateTypedefs.cs @@ -13,8 +13,10 @@ public static void DoPass(RewriteGlobalContext context) { foreach (var assemblyContext in context.Assemblies) foreach (var type in assemblyContext.OriginalAssembly.MainModule.Types) - if (type.Namespace != "Cpp2ILInjected" && type.Name != "") + if (!IsCpp2ILInjectedType(type) && type.Name != "") ProcessType(type, assemblyContext, null); + + static bool IsCpp2ILInjectedType(TypeDefinition type) => type.Namespace?.StartsWith("Cpp2ILInjected", StringComparison.Ordinal) ?? false; } private static void ProcessType(TypeDefinition type, AssemblyRewriteContext assemblyContext, @@ -47,7 +49,7 @@ private static void ProcessType(TypeDefinition type, AssemblyRewriteContext asse static string GetNamespace(TypeDefinition type, AssemblyRewriteContext assemblyContext) { - if (type.Name is "" or "" || type.DeclaringType is not null) + if (type.Name is "" || type.DeclaringType is not null) return type.Namespace; else return type.Namespace.UnSystemify(assemblyContext.GlobalContext.Options);