本文整理汇总了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);
}
示例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
}
示例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);
}
示例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);
}
示例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
}