Output struct declarations correctly
This commit is contained in:
@@ -30,15 +30,17 @@ namespace Il2CppInspector
|
|||||||
writer.Write("public ");
|
writer.Write("public ");
|
||||||
if (type.IsAbstract)
|
if (type.IsAbstract)
|
||||||
writer.Write("abstract ");
|
writer.Write("abstract ");
|
||||||
if (type.IsSealed)
|
if (type.IsSealed && !type.IsValueType)
|
||||||
writer.Write("sealed ");
|
writer.Write("sealed ");
|
||||||
if (type.IsInterface)
|
if (type.IsInterface)
|
||||||
writer.Write("interface ");
|
writer.Write("interface ");
|
||||||
|
else if (type.IsValueType)
|
||||||
|
writer.Write("struct ");
|
||||||
else
|
else
|
||||||
writer.Write("class ");
|
writer.Write("class ");
|
||||||
|
|
||||||
var baseText = type.BaseType?.CSharpName ?? "object";
|
var baseText = type.BaseType?.CSharpName ?? string.Empty;
|
||||||
baseText = baseText == "object" ? string.Empty : " : " + baseText;
|
baseText = (baseText == "object" || baseText == "ValueType" || baseText == string.Empty)? string.Empty : " : " + baseText;
|
||||||
|
|
||||||
writer.Write($"{type.Name}{baseText} // TypeDefIndex: {type.Index}\n{{\n");
|
writer.Write($"{type.Name}{baseText} // TypeDefIndex: {type.Index}\n{{\n");
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace Il2CppInspector.Reflection {
|
|||||||
public bool IsPublic => (Attributes & TypeAttributes.Public) == TypeAttributes.Public;
|
public bool IsPublic => (Attributes & TypeAttributes.Public) == TypeAttributes.Public;
|
||||||
public bool IsSealed => (Attributes & TypeAttributes.Sealed) == TypeAttributes.Sealed;
|
public bool IsSealed => (Attributes & TypeAttributes.Sealed) == TypeAttributes.Sealed;
|
||||||
public bool IsSerializable => (Attributes & TypeAttributes.Serializable) == TypeAttributes.Serializable;
|
public bool IsSerializable => (Attributes & TypeAttributes.Serializable) == TypeAttributes.Serializable;
|
||||||
public bool IsValueType => throw new NotImplementedException();
|
public bool IsValueType => BaseType?.FullName == "System.ValueType";
|
||||||
|
|
||||||
public override MemberTypes MemberType { get; }
|
public override MemberTypes MemberType { get; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user