Model: Treat System.Decimal as a primitive type

This commit is contained in:
Katy Coe
2019-10-29 21:58:06 +01:00
parent 035a663484
commit d381b2ddda
2 changed files with 8 additions and 1 deletions

View File

@@ -195,6 +195,9 @@ namespace Il2CppInspector
"CMOD_REQD",
"CMOD_OPT",
"INTERNAL",
// Added in for convenience
"decimal"
};
public static List<string> FullNameTypeString = new List<string>
@@ -233,6 +236,9 @@ namespace Il2CppInspector
"CMOD_REQD",
"CMOD_OPT",
"INTERNAL",
// Added in for convenience
"System.Decimal"
};
}
}

View File

@@ -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;