Exemplo n.º 1
0
        public DmdExportedTypeCOMD(DmdComMetadataReader reader, uint rid, IList <DmdCustomModifier> customModifiers) : base(reader.Module, rid, customModifiers)
        {
            this.reader = reader ?? throw new ArgumentNullException(nameof(reader));
            reader.Dispatcher.VerifyAccess();

            uint token = 0x27000000 + rid;

            DmdTypeUtilities.SplitFullName(MDAPI.GetExportedTypeName(reader.MetaDataAssemblyImport, token) ?? string.Empty, out var @namespace, out var name);
            MetadataNamespace = @namespace;
            MetadataName      = name;

            MDAPI.GetExportedTypeProps(reader.MetaDataAssemblyImport, token, out var implToken, out _, out _);
            switch (implToken >> 24)
            {
            case 0x23:
                TypeScope = new DmdTypeScope(reader.ReadAssemblyName_COMThread(implToken & 0x00FFFFFF));
                break;

            case 0x26:
                var moduleName = MDAPI.GetFileName(reader.MetaDataAssemblyImport, implToken) ?? string.Empty;
                TypeScope = new DmdTypeScope(reader.GetName(), moduleName);
                break;

            case 0x27:
                TypeScope     = DmdTypeScope.Invalid;
                baseTypeToken = (int)implToken;
                break;

            default:
                TypeScope = DmdTypeScope.Invalid;
                break;
            }
        }
Exemplo n.º 2
0
        void InitNameAndAttrs_NoLock()
        {
            var  mdai  = readerModule.MetaDataAssemblyImport;
            uint token = OriginalToken.Raw;

            Utils.SplitNameAndNamespace(null, MDAPI.GetExportedTypeName(mdai, token), out var ns, out var name);
            TypeName      = name;
            TypeNamespace = ns;

            MDAPI.GetExportedTypeProps(mdai, token, out implementation, out typeDefId, out var attrs);
            attributes = (int)attrs;
        }