當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。