mirror of
https://github.com/Perfare/Il2CppDumper.git
synced 2025-01-09 19:27:17 -03:00
添加泛型约束
This commit is contained in:
parent
b9fc241260
commit
0378425267
2 changed files with 8 additions and 0 deletions
|
@ -615,8 +615,14 @@ namespace Il2CppDumper
|
|||
var param = metadata.genericParameters[genericParameterIndex];
|
||||
var genericName = metadata.GetStringFromIndex(param.nameIndex);
|
||||
var genericParameter = new GenericParameter(genericName, iGenericParameterProvider);
|
||||
genericParameter.Attributes = (GenericParameterAttributes)param.flags;
|
||||
iGenericParameterProvider.GenericParameters.Add(genericParameter);
|
||||
genericParameterDic.Add(genericParameterIndex, genericParameter);
|
||||
for (int i = 0; i < param.constraintsCount; ++i)
|
||||
{
|
||||
var il2CppType = il2cpp.types[metadata.constraintIndices[param.constraintsStart + i]];
|
||||
genericParameter.Constraints.Add(new GenericParameterConstraint(GetTypeReference((MemberReference)iGenericParameterProvider, il2CppType)));
|
||||
}
|
||||
return genericParameter;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace Il2CppDumper
|
|||
public Il2CppGenericContainer[] genericContainers;
|
||||
public Il2CppFieldRef[] fieldRefs;
|
||||
public Il2CppGenericParameter[] genericParameters;
|
||||
public int[] constraintIndices;
|
||||
|
||||
public Metadata(Stream stream, float version) : base(stream)
|
||||
{
|
||||
|
@ -65,6 +66,7 @@ namespace Il2CppDumper
|
|||
eventDefs = ReadMetadataClassArray<Il2CppEventDefinition>(metadataHeader.eventsOffset, metadataHeader.eventsCount);
|
||||
genericContainers = ReadMetadataClassArray<Il2CppGenericContainer>(metadataHeader.genericContainersOffset, metadataHeader.genericContainersCount);
|
||||
genericParameters = ReadMetadataClassArray<Il2CppGenericParameter>(metadataHeader.genericParametersOffset, metadataHeader.genericParametersCount);
|
||||
constraintIndices = ReadClassArray<int>(metadataHeader.genericParameterConstraintsOffset, metadataHeader.genericParameterConstraintsCount / 4);
|
||||
if (version > 16)
|
||||
{
|
||||
stringLiterals = ReadMetadataClassArray<Il2CppStringLiteral>(metadataHeader.stringLiteralOffset, metadataHeader.stringLiteralCount);
|
||||
|
|
Loading…
Reference in a new issue