Ejemplo n.º 1
0
        public override int GetTypeRefProps(
            int typeRef,
            [Out] int *resolutionScope, // ModuleRef or AssemblyRef
            [Out] char *qualifiedName,
            int qualifiedNameBufferLength,
            [Out] int *qualifiedNameLength)
        {
            if (!_metadataProvider.TryGetTypeReferenceInfo(typeRef, out var namespaceName, out var typeName))
            {
                return(HResult.E_INVALIDARG);
            }

            if (qualifiedNameLength != null || qualifiedName != null)
            {
                InteropUtilities.CopyQualifiedTypeName(
                    qualifiedName,
                    qualifiedNameBufferLength,
                    qualifiedNameLength,
                    namespaceName,
                    typeName);
            }

            if (resolutionScope != null)
            {
                // unused
                *resolutionScope = 0;
            }

            return(HResult.S_OK);
        }
Ejemplo n.º 2
0
        int IMetadataImport.GetTypeRefProps(
            int typeRef,
            [Out] int *resolutionScope, // ModuleRef or AssemblyRef
            [Out] char *qualifiedName,
            int qualifiedNameBufferLength,
            [Out] int *qualifiedNameLength)
        {
            MetadataRequired();

            var handle        = (TypeReferenceHandle)MetadataTokens.Handle(typeRef);
            var typeReference = _metadataReaderOpt.GetTypeReference(handle);

            if (qualifiedNameLength != null || qualifiedName != null)
            {
                InteropUtilities.CopyQualifiedTypeName(
                    qualifiedName,
                    qualifiedNameLength,
                    _metadataReaderOpt.GetString(typeReference.Namespace),
                    _metadataReaderOpt.GetString(typeReference.Name));
            }

            if (resolutionScope != null)
            {
                *resolutionScope = MetadataTokens.GetToken(typeReference.ResolutionScope);
            }

            return(HResult.S_OK);
        }
Ejemplo n.º 3
0
        public override int GetTypeDefProps(
            int typeDef,
            [Out] char *qualifiedName,
            int qualifiedNameBufferLength,
            [Out] int *qualifiedNameLength,
            [Out] TypeAttributes *attributes,
            [Out] int *baseType)
        {
            Debug.Assert(baseType == null);

            if (!_metadataProvider.TryGetTypeDefinitionInfo(typeDef, out var namespaceName, out var typeName, out var attrib))
            {
                return(HResult.E_INVALIDARG);
            }

            if (qualifiedNameLength != null || qualifiedName != null)
            {
                InteropUtilities.CopyQualifiedTypeName(
                    qualifiedName,
                    qualifiedNameBufferLength,
                    qualifiedNameLength,
                    namespaceName,
                    typeName);
            }

            if (attributes != null)
            {
                *attributes = attrib;
            }

            return(HResult.S_OK);
        }
Ejemplo n.º 4
0
        int IMetadataImport.GetTypeDefProps(
            int typeDef,
            [Out] char *qualifiedName,
            int qualifiedNameBufferLength,
            [Out] int *qualifiedNameLength,
            [Out] TypeAttributes *attributes,
            [Out] int *baseType)
        {
            MetadataRequired();

            var handle         = (TypeDefinitionHandle)MetadataTokens.Handle(typeDef);
            var typeDefinition = _metadataReaderOpt.GetTypeDefinition(handle);

            if (qualifiedNameLength != null || qualifiedName != null)
            {
                InteropUtilities.CopyQualifiedTypeName(
                    qualifiedName,
                    qualifiedNameLength,
                    _metadataReaderOpt.GetString(typeDefinition.Namespace),
                    _metadataReaderOpt.GetString(typeDefinition.Name));
            }

            if (attributes != null)
            {
                *attributes = typeDefinition.Attributes;
            }

            if (baseType != null)
            {
                *baseType = MetadataTokens.GetToken(typeDefinition.BaseType);
            }

            return(HResult.S_OK);
        }