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


C# ModuleDefinition.ReadSymbols方法代码示例

本文整理汇总了C#中Mono.Cecil.ModuleDefinition.ReadSymbols方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleDefinition.ReadSymbols方法的具体用法?C# ModuleDefinition.ReadSymbols怎么用?C# ModuleDefinition.ReadSymbols使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.Cecil.ModuleDefinition的用法示例。


在下文中一共展示了ModuleDefinition.ReadSymbols方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Add

        private void Add (ModuleDefinition module)
        {
            try {
                module.ReadSymbols();
            } catch (FileNotFoundException) {
            } catch (InvalidOperationException) {
            }

            foreach (var resource in from res in module.Resources
                where res.ResourceType == ResourceType.Embedded
                select res as EmbeddedResource) {
                AddResource (resource);
            }

            modules.Add (module);
            LocateLocalizationMethods (module);
        }
开发者ID:lothrop,项目名称:vernacular,代码行数:17,代码来源:AssemblyParser.cs

示例2: LoadSymbols

		private void LoadSymbols(ModuleDefinition module)
		{
			// search for pdb in same directory as dll
			string pdbName = Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileNameWithoutExtension(fileName) + ".pdb");
			if (File.Exists(pdbName)) {
				using (Stream s = File.OpenRead(pdbName)) {
					module.ReadSymbols(new Mono.Cecil.Pdb.PdbReaderProvider().GetSymbolReader(module, s));
				}
				return;
			}
			
			// TODO: use symbol cache, get symbols from microsoft
		}
开发者ID:linquize,项目名称:ILSpy,代码行数:13,代码来源:LoadedAssembly.cs

示例3: Analysis

        static void Analysis(XmlTextWriter writer, ModuleDefinition module, string fullPath, bool withTypes)
        {
            try
            {
                module.ReadSymbols();

                var provider = new PdbReaderProvider();
                var reader = provider.GetSymbolReader(module, fullPath);
            }
            catch (FileNotFoundException)
            {

            }

            Console.WriteLine("Parsing {0}", module.Name);
            writer.WriteStartElement("Assembly");
            writer.WriteAttributeString("name", module.Assembly.Name.Name);
            writer.WriteAttributeString("version", module.Assembly.Name.Version.ToString());
            writer.WriteStartElement("References");
            foreach (var item in module.AssemblyReferences)
            {
                writer.WriteStartElement("Reference");
                writer.WriteAttributeString("name", item.Name);
                writer.WriteAttributeString("fullName", item.FullName);
                writer.WriteAttributeString("version", item.Version.ToString());
                writer.WriteEndElement();

                if (!Parsed.Contains(item.FullName) && !ToParse.Contains(item.FullName))
                {
                    ToParse.Add(item.FullName);
                }
            }
            writer.WriteEndElement();

            if (withTypes)
            {
                writer.WriteStartElement("TypeReferences");
                foreach (var t in module.Types)
                {
                    ParseType(writer, t);
                }

                writer.WriteEndElement();

                if (designAnalysis)
                {
                    GenerateTypeDesignMeasures(writer, module);
                }
            }

            writer.WriteEndElement();

            if (ToParse.Contains(module.Assembly.Name.FullName))
            {
                ToParse.Remove(module.Assembly.Name.FullName);
            }

            Parsed.Add(module.Assembly.Name.FullName);
        }
开发者ID:elias551,项目名称:DependencyParser,代码行数:59,代码来源:Program.cs

示例4: Analysis

        private static void Analysis(XmlTextWriter writer, ModuleDefinition module, string fullPath, bool withTypes)
        {
            try
            {
                module.ReadSymbols();

                var provider = new PdbReaderProvider();
                var reader = provider.GetSymbolReader(module, fullPath);
            }
            catch (FileNotFoundException fex)
            {
                // we don't want to fail on a missing pdb.
                // though we may place a breakpoint below.
                var debugException = fex;
            }

            Console.WriteLine("Parsing {0}", module.Name);
            writer.WriteStartElement("Assembly");
            writer.WriteAttributeString("name", module.Assembly.Name.Name);
            writer.WriteAttributeString("version", module.Assembly.Name.Version.ToString());
            writer.WriteStartElement("References");
            foreach (var item in module.AssemblyReferences)
            {
                writer.WriteStartElement("Reference");
                writer.WriteAttributeString("name", item.Name);
                writer.WriteAttributeString("fullName", item.FullName);
                writer.WriteAttributeString("version", item.Version.ToString());
                writer.WriteEndElement();

                if (!parsedAssemblies.Contains(item.FullName) && !assembliesToParse.Contains(item.FullName))
                {
                    assembliesToParse.Add(item.FullName);
                }
            }
            writer.WriteEndElement();

            if (withTypes)
            {
                writer.WriteStartElement("TypeReferences");
                foreach (var t in module.Types)
                {
                    ParseType(writer, t);
                }

                writer.WriteEndElement();
            }

            writer.WriteEndElement();

            if (assembliesToParse.Contains(module.Assembly.Name.FullName))
            {
                assembliesToParse.Remove(module.Assembly.Name.FullName);
            }

            parsedAssemblies.Add(module.Assembly.Name.FullName);
        }
开发者ID:odalet,项目名称:DependencyParser,代码行数:56,代码来源:Program.cs

示例5: LoadSymbols

        private void LoadSymbols(ModuleDefinition module)
        {
            if (!module.HasDebugHeader) {
                return;
            }
            byte[] headerBytes;
            var debugHeader = module.GetDebugHeader(out headerBytes);
            if (debugHeader.Type != 2) {
                // the debug type is not IMAGE_DEBUG_TYPE_CODEVIEW
                return;
            }
            if (debugHeader.MajorVersion != 0 || debugHeader.MinorVersion != 0) {
                // the PDB type is not compatible with PdbReaderProvider. It is probably a Portable PDB
                return;
            }

            // search for pdb in same directory as dll
            string pdbName = Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileNameWithoutExtension(fileName) + ".pdb");
            if (File.Exists(pdbName)) {
                using (Stream s = File.OpenRead(pdbName)) {
                    module.ReadSymbols(new Mono.Cecil.Pdb.PdbReaderProvider().GetSymbolReader(module, s));
                }
                return;
            }

            // TODO: use symbol cache, get symbols from microsoft
        }
开发者ID:Zvirja,项目名称:ILSpy,代码行数:27,代码来源:LoadedAssembly.cs


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