public override IList <PdbConstant> GetConstants(ModuleDef module, GenericParamContext gpContext) { if (scope is not ISymUnmanagedScope2 scope2) { return(Array2.Empty <PdbConstant>()); } scope2.GetConstants(0, out uint numCs, null); if (numCs == 0) { return(Array2.Empty <PdbConstant>()); } var unCs = new ISymUnmanagedConstant[numCs]; scope2.GetConstants((uint)unCs.Length, out numCs, unCs); var nss = new PdbConstant[numCs]; for (uint i = 0; i < numCs; i++) { var unc = unCs[i]; var name = GetName(unc); unc.GetValue(out object value); var sigBytes = GetSignatureBytes(unc); TypeSig signature; if (sigBytes.Length == 0) { signature = null; } else { signature = SignatureReader.ReadTypeSig(module, module.CorLibTypes, sigBytes, gpContext); } nss[i] = new PdbConstant(name, signature, value); } return(nss); }
TypeSig ReadTypeSignature(byte[] data, GenericParamContext gpContext, out byte[] extraData) { if (data == null) { extraData = null; return(null); } return(SignatureReader.ReadTypeSig(helper, new CorLibTypes(noOwnerModule), data, gpContext, out extraData)); }
public PdbConstant[] GetConstants(ModuleDefMD module, GenericParamContext gpContext) { var scope2 = scope as ISymUnmanagedScope2; if (scope2 == null) { return(emptySymbolConstants); } uint numCs; scope2.GetConstants(0, out numCs, null); if (numCs == 0) { return(emptySymbolConstants); } var unCs = new ISymUnmanagedConstant[numCs]; scope2.GetConstants((uint)unCs.Length, out numCs, unCs); var nss = new PdbConstant[numCs]; for (uint i = 0; i < numCs; i++) { var unc = unCs[i]; var name = GetName(unc); object value; unc.GetValue(out value); var sigBytes = GetSignatureBytes(unc); TypeSig signature; if (sigBytes.Length == 0) { signature = null; } else { signature = SignatureReader.ReadTypeSig(module, module.CorLibTypes, sigBytes, gpContext); } nss[i] = new PdbConstant(name, signature, value); } return(nss); }
public TypeSig ReadTypeSignature(byte[] data) { return(SignatureReader.ReadTypeSig(SignatureReaderHelper.Instance, corLibTypes, data)); }
public TypeSig ReadTypeSignature(IMetaDataImport mdi, byte[] data) { return(SignatureReader.ReadTypeSig(new SignatureReaderHelper(mdi), corLibTypes, data)); }