Add name mangling to Methods/MethodInfo/TypeInfo/TypeRef, remove Boxing from ValueTypes when used as the this parameter, fix crashes when a module has no attributes

This commit is contained in:
LukeFZ
2023-12-06 20:09:35 +01:00
parent e9434f4cad
commit 5b1d9c67d1
11 changed files with 335 additions and 119 deletions

View File

@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -68,7 +69,9 @@ namespace Il2CppInspector.Reflection {
public bool IsLiteral => (Attributes & FieldAttributes.Literal) == FieldAttributes.Literal;
// True if the field has the NonSerialized attribute
#pragma warning disable SYSLIB0050
public bool IsNotSerialized => (Attributes & FieldAttributes.NotSerialized) == FieldAttributes.NotSerialized;
#pragma warning restore SYSLIB0050
// True if the field is extern
public bool IsPinvokeImpl => (Attributes & FieldAttributes.PinvokeImpl) == FieldAttributes.PinvokeImpl;

View File

@@ -702,7 +702,9 @@ namespace Il2CppInspector.Reflection
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;
#pragma warning disable SYSLIB0050
public bool IsSerializable => (Attributes & TypeAttributes.Serializable) == TypeAttributes.Serializable;
#pragma warning restore SYSLIB0050
public bool IsSpecialName => (Attributes & TypeAttributes.SpecialName) == TypeAttributes.SpecialName;
public bool IsValueType => BaseType?.FullName == "System.ValueType";