From d381b2ddda730c112f83b3cd110d6ef23a373582 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Tue, 29 Oct 2019 21:58:06 +0100 Subject: [PATCH] Model: Treat System.Decimal as a primitive type --- Il2CppInspector/Il2CppConstants.cs | 6 ++++++ Il2CppInspector/Reflection/TypeInfo.cs | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Il2CppInspector/Il2CppConstants.cs b/Il2CppInspector/Il2CppConstants.cs index 98797b7..722f43a 100644 --- a/Il2CppInspector/Il2CppConstants.cs +++ b/Il2CppInspector/Il2CppConstants.cs @@ -195,6 +195,9 @@ namespace Il2CppInspector "CMOD_REQD", "CMOD_OPT", "INTERNAL", + + // Added in for convenience + "decimal" }; public static List FullNameTypeString = new List @@ -233,6 +236,9 @@ namespace Il2CppInspector "CMOD_REQD", "CMOD_OPT", "INTERNAL", + + // Added in for convenience + "System.Decimal" }; } } \ No newline at end of file diff --git a/Il2CppInspector/Reflection/TypeInfo.cs b/Il2CppInspector/Reflection/TypeInfo.cs index be48b73..f6796ad 100644 --- a/Il2CppInspector/Reflection/TypeInfo.cs +++ b/Il2CppInspector/Reflection/TypeInfo.cs @@ -100,7 +100,8 @@ namespace Il2CppInspector.Reflection { public bool IsNestedPublic => (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPublic; public bool IsNotPublic => (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NotPublic; public bool IsPointer { get; } - public bool IsPrimitive => Namespace == "System" && new[] { "Boolean", "Byte", "SByte", "Int16", "UInt16", "Int32", "UInt32", "Int64", "UInt64", "IntPtr", "UIntPtr", "Char", "Double", "Single" }.Contains(Name); + // Prinitive types table: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/built-in-types-table (we exclude Object and String) + public bool IsPrimitive => Namespace == "System" && new[] { "Boolean", "Byte", "SByte", "Int16", "UInt16", "Int32", "UInt32", "Int64", "UInt64", "IntPtr", "UIntPtr", "Char", "Decimal", "Double", "Single" }.Contains(Name); public bool IsPublic => (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.Public; public bool IsSealed => (Attributes & TypeAttributes.Sealed) == TypeAttributes.Sealed; public bool IsSerializable => (Attributes & TypeAttributes.Serializable) == TypeAttributes.Serializable;