当前位置: 首页>>代码示例>>C#>>正文


C# NativeFormat.MetadataReader类代码示例

本文整理汇总了C#中Internal.Metadata.NativeFormat.MetadataReader的典型用法代码示例。如果您正苦于以下问题:C# MetadataReader类的具体用法?C# MetadataReader怎么用?C# MetadataReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MetadataReader类属于Internal.Metadata.NativeFormat命名空间,在下文中一共展示了MetadataReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RuntimeGenericParameterTypeInfo

 protected RuntimeGenericParameterTypeInfo(MetadataReader reader, GenericParameterHandle genericParameterHandle)
 {
     Reader = reader;
     GenericParameterHandle = genericParameterHandle;
     _genericParameter = genericParameterHandle.GetGenericParameter(reader);
     _position = _genericParameter.Number;
 }
开发者ID:BruceForstall,项目名称:corert,代码行数:7,代码来源:RuntimeGenericParameterTypeInfo.cs

示例2: RuntimeMethodParameterInfo

 protected RuntimeMethodParameterInfo(MethodBase member, int position, MetadataReader reader, Handle typeHandle, TypeContext typeContext)
     : base(member, position)
 {
     Reader = reader;
     _typeHandle = typeHandle;
     _typeContext = typeContext;
 }
开发者ID:krytarowski,项目名称:corert,代码行数:7,代码来源:RuntimeMethodParameterInfo.cs

示例3: RuntimeFatMethodParameterInfo

 private RuntimeFatMethodParameterInfo(MethodBase member, MethodHandle methodHandle, int position, ParameterHandle parameterHandle, MetadataReader reader, Handle typeHandle, TypeContext typeContext)
     : base(member, position, reader, typeHandle, typeContext)
 {
     _methodHandle = methodHandle;
     _parameterHandle = parameterHandle;
     _parameter = parameterHandle.GetParameter(reader);
 }
开发者ID:tijoytom,项目名称:corert,代码行数:7,代码来源:RuntimeFatMethodParameterInfo.cs

示例4: NativeFormatRuntimeGenericParameterTypeInfo

 protected NativeFormatRuntimeGenericParameterTypeInfo(MetadataReader reader, GenericParameterHandle genericParameterHandle, GenericParameter genericParameter)
     : base(genericParameter.Number)
 {
     Reader = reader;
     GenericParameterHandle = genericParameterHandle;
     _genericParameter = genericParameter;
 }
开发者ID:justinvp,项目名称:corert,代码行数:7,代码来源:NativeFormatRuntimeGenericParameterTypeInfo.cs

示例5: TryResolveNamespaceDefinitionCaseSensitive

        private bool TryResolveNamespaceDefinitionCaseSensitive(MetadataReader reader, string[] namespaceParts, ScopeDefinitionHandle scopeDefinitionHandle, out NamespaceDefinition namespaceDefinition)
        {
            namespaceDefinition = scopeDefinitionHandle.GetScopeDefinition(reader).RootNamespaceDefinition.GetNamespaceDefinition(reader);
            IEnumerable<NamespaceDefinitionHandle> candidates = namespaceDefinition.NamespaceDefinitions;
            int idx = namespaceParts.Length;
            while (idx-- != 0)
            {
                // Each iteration finds a match for one segment of the namespace chain.
                String expected = namespaceParts[idx];
                bool foundMatch = false;
                foreach (NamespaceDefinitionHandle candidate in candidates)
                {
                    namespaceDefinition = candidate.GetNamespaceDefinition(reader);
                    if (namespaceDefinition.Name.StringOrNullEquals(expected, reader))
                    {
                        // Found a match for this segment of the namespace chain. Move on to the next level.
                        foundMatch = true;
                        candidates = namespaceDefinition.NamespaceDefinitions;
                        break;
                    }
                }

                if (!foundMatch)
                {
                    return false;
                }
            }

            return true;
        }
开发者ID:nattress,项目名称:corert,代码行数:30,代码来源:NativeFormatRuntimeAssembly.GetTypeCore.CaseSensitive.cs

示例6: NativeFormatSignatureParser

        // TODO
        // bool _hasModifiers;

        public NativeFormatSignatureParser(NativeFormatMetadataUnit metadataUnit, Handle signatureHandle, MetadataReader metadataReader)
        {
            _metadataUnit = metadataUnit;
            _signatureHandle = signatureHandle;
            _metadataReader = metadataReader;
            // _hasModifiers = false;
        }
开发者ID:nattress,项目名称:corert,代码行数:10,代码来源:NativeFormatSignatureParser.cs

示例7: TryGetMetadataForNamedType

        public unsafe bool TryGetMetadataForNamedType(RuntimeTypeHandle runtimeTypeHandle, out MetadataReader metadataReader, out TypeDefinitionHandle typeDefHandle)
        {
            // Iterate over all modules, starting with the module that defines the EEType
            foreach (IntPtr moduleHandle in ModuleList.Enumerate(RuntimeAugments.GetModuleFromTypeHandle(runtimeTypeHandle)))
            {
                MetadataTable mapTable = MetadataTable.CreateTypeMapTable(moduleHandle);
                foreach (var ptrEntry in mapTable)
                {
                    var pCurrentEntry = (TypeMapEntry*)ptrEntry;
                    RuntimeTypeHandle entryTypeHandle = RuntimeAugments.CreateRuntimeTypeHandle(pCurrentEntry->EEType);
                    Handle entryMetadataHandle = pCurrentEntry->TypeDefinitionHandle.AsHandle();
                    if (entryTypeHandle.Equals(runtimeTypeHandle) &&
                        entryMetadataHandle.HandleType == HandleType.TypeDefinition)
                    {
                        metadataReader = ModuleList.Instance.GetMetadataReaderForModule(moduleHandle);
                        typeDefHandle = entryMetadataHandle.ToTypeDefinitionHandle(metadataReader);
                        return true;
                    }
                }
            }

            metadataReader = null;
            typeDefHandle = default(TypeDefinitionHandle);

            return false;
        }
开发者ID:kyulee1,项目名称:corert,代码行数:26,代码来源:TypeLoaderEnvironment.Fakes.cs

示例8: NativeFormatRuntimeNamedTypeInfo

 private NativeFormatRuntimeNamedTypeInfo(MetadataReader reader, TypeDefinitionHandle typeDefinitionHandle, RuntimeTypeHandle typeHandle) :
     base(typeHandle)
 {
     _reader = reader;
     _typeDefinitionHandle = typeDefinitionHandle;
     _typeDefinition = _typeDefinitionHandle.GetTypeDefinition(reader);
 }
开发者ID:nattress,项目名称:corert,代码行数:7,代码来源:NativeFormatRuntimeNamedTypeInfo.cs

示例9: Resolve

 //
 // Main routine to resolve a typeDef/Ref/Spec.
 //
 internal static RuntimeTypeInfo Resolve(this Handle typeDefRefOrSpec, MetadataReader reader, TypeContext typeContext)
 {
     Exception exception = null;
     RuntimeTypeInfo runtimeType = typeDefRefOrSpec.TryResolve(reader, typeContext, ref exception);
     if (runtimeType == null)
         throw exception;
     return runtimeType;
 }
开发者ID:nattress,项目名称:corert,代码行数:11,代码来源:TypeResolver.NativeFormat.cs

示例10: StringOrNullEquals

 public static bool StringOrNullEquals(this ConstantStringValueHandle handle, String valueOrNull, MetadataReader reader)
 {
     if (valueOrNull == null)
         return handle.IsNull(reader);
     if (handle.IsNull(reader))
         return false;
     return handle.StringEquals(valueOrNull, reader);
 }
开发者ID:krytarowski,项目名称:corert,代码行数:8,代码来源:MetadataReaderExtensions.cs

示例11: NamespaceChain

        internal NamespaceChain(MetadataReader reader, NamespaceDefinitionHandle innerMostNamespaceHandle)
        {
            NamespaceDefinition currentNamespaceDefinition = innerMostNamespaceHandle.GetNamespaceDefinition(reader);
            ConstantStringValueHandle currentNameHandle = currentNamespaceDefinition.Name;
            Handle currentNamespaceHandle = innerMostNamespaceHandle.ToHandle(reader);
            LowLevelList<String> names = new LowLevelList<String>();
            for (;;)
            {
                String name = currentNameHandle.GetStringOrNull(reader);
                names.Add(name);
                currentNamespaceHandle = currentNamespaceDefinition.ParentScopeOrNamespace;
                HandleType handleType = currentNamespaceHandle.HandleType;
                if (handleType == HandleType.ScopeDefinition)
                    break;
                if (handleType == HandleType.NamespaceDefinition)
                {
                    NamespaceDefinitionHandle nsHandle = currentNamespaceHandle.ToNamespaceDefinitionHandle(reader);
                    currentNamespaceDefinition = nsHandle.GetNamespaceDefinition(reader);
                    currentNameHandle = currentNamespaceDefinition.Name;
                    continue;
                }

                throw new BadImageFormatException(SR.Bif_InvalidMetadata);
            }

            DefiningScope = currentNamespaceHandle.ToScopeDefinitionHandle(reader);

            int count = names.Count;
            if (count == 0)
            {
                // Every namespace chain has to start with the root namespace.
                throw new BadImageFormatException();
            }
            else if (count == 1)
            {
                // The root namespace. For compat with the desktop, TypeInfo.NameSpaces returns null in this case.
                NameSpace = null;
            }
            else
            {
                // Namespace has at least one non-root component.
                StringBuilder sb = new StringBuilder();
                int idx = count - 1;
                while (idx-- != 0)
                {
                    String name = names[idx];
                    if (name == null)
                        throw new BadImageFormatException(); // null namespace fragment found in middle.
                    sb.Append(name);
                    if (idx != 0)
                        sb.Append('.');
                }
                NameSpace = sb.ToString();
            }
        }
开发者ID:tijoytom,项目名称:corert,代码行数:55,代码来源:NamespaceChain.cs

示例12: GetAttributeTypeHandle

        private static Handle GetAttributeTypeHandle(this CustomAttribute customAttribute, MetadataReader reader)
        {
            HandleType constructorHandleType = customAttribute.Constructor.HandleType;

            if (constructorHandleType == HandleType.QualifiedMethod)
                return customAttribute.Constructor.ToQualifiedMethodHandle(reader).GetQualifiedMethod(reader).EnclosingType;
            else if (constructorHandleType == HandleType.MemberReference)
                return customAttribute.Constructor.ToMemberReferenceHandle(reader).GetMemberReference(reader).Parent;
            else
                throw new BadImageFormatException();
        }
开发者ID:nattress,项目名称:corert,代码行数:11,代码来源:MetadataExtensions.cs

示例13: TryGetMethodInvokeMetadata

 public static bool TryGetMethodInvokeMetadata(
     MetadataReader metadataReader,
     RuntimeTypeHandle declaringTypeHandle,
     MethodHandle methodHandle,
     RuntimeTypeHandle[] genericMethodTypeArgumentHandles,
     ref MethodSignatureComparer methodSignatureComparer,
     CanonicalFormKind canonFormKind,
     out MethodInvokeMetadata methodInvokeMetadata)
 {
     throw new NotImplementedException();
 }
开发者ID:tijoytom,项目名称:corert,代码行数:11,代码来源:TypeLoaderEnvironment.Fakes.cs

示例14: TryResolve

 internal static RuntimeTypeInfo TryResolve(this Handle typeDefRefOrSpec, MetadataReader reader, TypeContext typeContext, ref Exception exception)
 {
     HandleType handleType = typeDefRefOrSpec.HandleType;
     if (handleType == HandleType.TypeDefinition)
         return typeDefRefOrSpec.ToTypeDefinitionHandle(reader).ResolveTypeDefinition(reader);
     else if (handleType == HandleType.TypeReference)
         return typeDefRefOrSpec.ToTypeReferenceHandle(reader).TryResolveTypeReference(reader, ref exception);
     else if (handleType == HandleType.TypeSpecification)
         return typeDefRefOrSpec.ToTypeSpecificationHandle(reader).TryResolveTypeSignature(reader, typeContext, ref exception);
     else
         throw new BadImageFormatException();  // Expected TypeRef, Def or Spec.
 }
开发者ID:nattress,项目名称:corert,代码行数:12,代码来源:TypeResolver.NativeFormat.cs

示例15: ModuleInfo

        /// <summary>
        /// Initialize module info and construct per-module metadata reader.
        /// </summary>
        /// <param name="moduleHandle">Handle (address) of module to initialize</param>
        internal unsafe ModuleInfo(IntPtr moduleHandle, ModuleType moduleType)
        {
            Handle = moduleHandle;
            ModuleType = moduleType;
            DynamicModulePtr = null;

            byte* pBlob;
            uint cbBlob;

            if (RuntimeAugments.FindBlob(moduleHandle, (int)ReflectionMapBlob.EmbeddedMetadata, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
            {
                MetadataReader = new MetadataReader((IntPtr)pBlob, (int)cbBlob);
            }
        }
开发者ID:krytarowski,项目名称:corert,代码行数:18,代码来源:ModuleList.cs


注:本文中的Internal.Metadata.NativeFormat.MetadataReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。