• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Metadata.MetadataReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: AssemblyCatalogInfo

        //private bool hasInheritedExports = false;
        //private readonly Dictionary<Handle, bool> inheritedExportTypes = new Dictionary<Handle, bool>();
        //private readonly HashSet<string> inheritedExportTypesByName = new HashSet<string>();

        public AssemblyCatalogInfo(Discovery discovery, MetadataReader metadataReader, string assemblyFilePath)
        {
            Debug.WriteLine("AssemblyCatalogInfo: " + assemblyFilePath);
            this.discovery = discovery;
            this.metadataReader = metadataReader;
            this.assemblyFilePath = assemblyFilePath;
        }
开发者ID:szKarlen,项目名称:MEFMetadata,代码行数:11,代码来源:AssemblyCatalogInfo.cs


示例2: PdbToXmlConverter

 private PdbToXmlConverter(XmlWriter writer, TempPdbReader pdbReader, MetadataReader metadataReader, PdbToXmlOptions options)
 {
     this.pdbReader = pdbReader;
     this.metadataReader = metadataReader;
     this.writer = writer;
     this.options = options;
 }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:7,代码来源:PdbToXml.cs


示例3: DocumentMap

        public DocumentMap(MetadataReader reader)
        {
            _reader = reader;

            // group ignoring case, we will match the case within the group
            _map = GetDocumentsByFileName(reader).GroupBy(StringComparer.OrdinalIgnoreCase);
        }
开发者ID:RoryVL,项目名称:roslyn,代码行数:7,代码来源:DocumentMap.cs


示例4: PdbToXmlConverter

 private PdbToXmlConverter(XmlWriter writer, ISymUnmanagedReader symReader, MetadataReader metadataReader, PdbToXmlOptions options)
 {
     _symReader = symReader;
     _metadataReader = metadataReader;
     _writer = writer;
     _options = options;
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:7,代码来源:PdbToXml.cs


示例5: ToXml

        public unsafe static void ToXml(TextWriter xmlWriter, Stream pdbStream, Stream peStream, PdbToXmlOptions options = PdbToXmlOptions.Default, string methodName = null)
        {
            IEnumerable<MethodHandle> methodHandles;
            var headers = new PEHeaders(peStream);
            byte[] metadata = new byte[headers.MetadataSize];
            peStream.Seek(headers.MetadataStartOffset, SeekOrigin.Begin);
            peStream.Read(metadata, 0, headers.MetadataSize);

            fixed (byte* metadataPtr = metadata)
            {
                var metadataReader = new MetadataReader((IntPtr)metadataPtr, metadata.Length);

                if (string.IsNullOrEmpty(methodName))
                {
                    methodHandles = metadataReader.MethodDefinitions;
                }
                else
                {
                    methodHandles = metadataReader.MethodDefinitions.
                        Where(methodHandle => GetQualifiedMethodName(metadataReader, methodHandle) == methodName);
                }

                ToXml(xmlWriter, pdbStream, metadataReader, options, methodHandles);
            }
        }
开发者ID:riversky,项目名称:roslyn,代码行数:25,代码来源:PdbToXml.cs


示例6: GetAnonymousTypeMap

 private static IReadOnlyDictionary<AnonymousTypeKey, AnonymousTypeValue> GetAnonymousTypeMap(
     MetadataReader reader,
     Symbols.Metadata.PE.MetadataDecoder metadataDecoder)
 {
     var result = new Dictionary<AnonymousTypeKey, AnonymousTypeValue>();
     foreach (var handle in reader.TypeDefinitions)
     {
         var def = reader.GetTypeDefinition(handle);
         if (!def.Namespace.IsNil)
         {
             continue;
         }
         if (!reader.StringStartsWith(def.Name, GeneratedNames.AnonymousNamePrefix))
         {
             continue;
         }
         var metadataName = reader.GetString(def.Name);
         short arity;
         var name = MetadataHelpers.InferTypeArityAndUnmangleMetadataName(metadataName, out arity);
         int index;
         if (GeneratedNames.TryParseAnonymousTypeTemplateName(name, out index))
         {
             var builder = ArrayBuilder<string>.GetInstance();
             if (TryGetAnonymousTypeKey(reader, def, builder))
             {
                 var type = (NamedTypeSymbol)metadataDecoder.GetTypeOfToken(handle);
                 var key = new AnonymousTypeKey(builder.ToImmutable());
                 var value = new AnonymousTypeValue(name, index, type);
                 result.Add(key, value);
             }
             builder.Free();
         }
     }
     return result;
 }
开发者ID:pheede,项目名称:roslyn,代码行数:35,代码来源:PEDeltaAssemblyBuilder.cs


示例7: PE

        public PE(string fileName)
        {
            FileName = Path.GetFullPath(fileName);
            Uri = new Uri(FileName);
            IsPEFile = false;
            try
            {
                _fs = File.OpenRead(FileName);

                byte byteRead = (byte)_fs.ReadByte();
                if (byteRead != 'M') { return; }

                byteRead = (byte)_fs.ReadByte();
                if (byteRead != 'Z') { return; }
                _fs.Seek(0, SeekOrigin.Begin);

                _peReader = new PEReader(_fs);
                PEHeaders = _peReader.PEHeaders;
                IsPEFile = true;
            }
            catch (IOException e) { LoadException = e; }
            catch (BadImageFormatException e) { LoadException = e; }
            catch (UnauthorizedAccessException e) { LoadException = e; }

            if (IsPEFile)
            {
                m_pImage = new SafePointer(_peReader.GetEntireImage().GetContent().ToBuilder().ToArray());

                if (IsManaged)
                {
                    _metadataReader = _peReader.GetMetadataReader();
                }
            }
        }
开发者ID:blinds52,项目名称:binskim,代码行数:34,代码来源:PE.cs


示例8: VerifyModuleMvid

        internal static void VerifyModuleMvid(int generation, MetadataReader previousReader, MetadataReader currentReader)
        {
            var previousModule = previousReader.GetModuleDefinition();
            var currentModule = currentReader.GetModuleDefinition();

            Assert.Equal(previousReader.GetGuid(previousModule.Mvid), currentReader.GetGuid(currentModule.Mvid));

            Assert.Equal(generation - 1, previousModule.Generation);
            Assert.Equal(generation, currentModule.Generation);

            if (generation == 1)
            {
                Assert.True(previousModule.GenerationId.IsNil);
                Assert.True(previousModule.BaseGenerationId.IsNil);

                Assert.False(currentModule.GenerationId.IsNil);
                Assert.True(currentModule.BaseGenerationId.IsNil);
            }
            else
            {
                Assert.False(currentModule.GenerationId.IsNil);
                Assert.False(currentModule.BaseGenerationId.IsNil);

                Assert.Equal(previousReader.GetGuid(previousModule.GenerationId), currentReader.GetGuid(currentModule.BaseGenerationId));
            }

            Assert.NotEqual(default(Guid), currentReader.GetGuid(currentModule.GenerationId));
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:28,代码来源:EncValidation.cs


示例9: PinnedMetadata

 public unsafe PinnedMetadata(ImmutableArray<byte> metadata)
 {
     _bytes = GCHandle.Alloc(metadata.DangerousGetUnderlyingArray(), GCHandleType.Pinned);
     this.Pointer = _bytes.AddrOfPinnedObject();
     this.Size = metadata.Length;
     this.Reader = new MetadataReader((byte*)this.Pointer, this.Size, MetadataReaderOptions.None, null);
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:7,代码来源:PinnedMetadata.cs


示例10: DeclarativeSecurityAttribute

        internal DeclarativeSecurityAttribute(MetadataReader reader, uint rowId)
        {
            DebugCorlib.Assert(reader != null);
            DebugCorlib.Assert(rowId != 0);

            this.reader = reader;
            this.rowId = rowId;
        }
开发者ID:RainsSoft,项目名称:SharpLang,代码行数:8,代码来源:DeclarativeSecurityAttribute.cs


示例11: ExportedType

        internal ExportedType(MetadataReader reader, uint rowId)
        {
            DebugCorlib.Assert(reader != null);
            DebugCorlib.Assert(rowId != 0);

            this.reader = reader;
            this.rowId = rowId;
        }
开发者ID:RainsSoft,项目名称:SharpLang,代码行数:8,代码来源:ExportedType.cs


示例12: Document

        internal Document(MetadataReader reader, DocumentHandle handle)
        {
            Debug.Assert(reader != null);
            Debug.Assert(!handle.IsNil);

            _reader = reader;
            _rowId = handle.RowId;
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:8,代码来源:Document.cs


示例13: LocalVariable

        internal LocalVariable(MetadataReader reader, LocalVariableHandle handle)
        {
            Debug.Assert(reader != null);
            Debug.Assert(!handle.IsNil);

            _reader = reader;
            _rowId = handle.RowId;
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:8,代码来源:LocalVariable.cs


示例14: ManifestResource

        internal ManifestResource(MetadataReader reader, ManifestResourceHandle handle)
        {
            DebugCorlib.Assert(reader != null);
            DebugCorlib.Assert(!handle.IsNil);

            this.reader = reader;
            this.rowId = handle.RowId;
        }
开发者ID:RainsSoft,项目名称:SharpLang,代码行数:8,代码来源:ManifestResource.cs


示例15: EventDefinition

        internal EventDefinition(MetadataReader reader, EventDefinitionHandle handle)
        {
            DebugCorlib.Assert(reader != null);
            DebugCorlib.Assert(!handle.IsNil);

            this.reader = reader;
            this.rowId = handle.RowId;
        }
开发者ID:RainsSoft,项目名称:SharpLang,代码行数:8,代码来源:EventDefinition.cs


示例16: OpenedReader

            public OpenedReader(MetadataReaderProvider provider, MetadataReader reader)
            {
                Debug.Assert(provider != null);
                Debug.Assert(reader != null);

                Provider = provider;
                Reader = reader;
            }
开发者ID:bartdesmet,项目名称:coreclr,代码行数:8,代码来源:SymbolReader.cs


示例17: CustomAttribute

        internal CustomAttribute(MetadataReader reader, uint treatmentAndRowId)
        {
            DebugCorlib.Assert(reader != null);
            DebugCorlib.Assert(treatmentAndRowId != 0);

            this.reader = reader;
            this.treatmentAndRowId = treatmentAndRowId;
        }
开发者ID:RainsSoft,项目名称:SharpLang,代码行数:8,代码来源:CustomAttribute.cs


示例18: TypeReference

        internal TypeReference(MetadataReader reader, uint treatmentAndRowId)
        {
            DebugCorlib.Assert(reader != null);
            DebugCorlib.Assert(treatmentAndRowId != 0);

            this.reader = reader;
            this.treatmentAndRowId = treatmentAndRowId;
        }
开发者ID:RainsSoft,项目名称:SharpLang,代码行数:8,代码来源:TypeReference.cs


示例19: LocalConstant

        internal LocalConstant(MetadataReader reader, LocalConstantHandle handle)
        {
            Debug.Assert(reader != null);
            Debug.Assert(!handle.IsNil);

            _reader = reader;
            _rowId = handle.RowId;
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:8,代码来源:LocalConstant.cs


示例20: StandaloneSignature

        internal StandaloneSignature(MetadataReader reader, StandaloneSignatureHandle handle)
        {
            DebugCorlib.Assert(reader != null);
            DebugCorlib.Assert(!handle.IsNil);

            this.reader = reader;
            this.rowId = handle.RowId;
        }
开发者ID:RainsSoft,项目名称:SharpLang,代码行数:8,代码来源:StandaloneSignature.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Ecma335.MetadataBuilder类代码示例发布时间:2022-05-26
下一篇:
C# Metadata.BlobReader类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap