本文整理汇总了C#中Mono.Cecil.ModuleDefinition.Accept方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleDefinition.Accept方法的具体用法?C# ModuleDefinition.Accept怎么用?C# ModuleDefinition.Accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.ModuleDefinition
的用法示例。
在下文中一共展示了ModuleDefinition.Accept方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryGetClass
private bool TryGetClass(ModuleDefinition module, string className, out ClassInfo clazz)
{
var visitor = new ModuleInfoVisitor(this, className);
module.Accept(visitor);
clazz = visitor.GetClassInfo();
return clazz != null;
}
示例2: VisitModuleDefinitionCollection
public override void VisitModuleDefinitionCollection (ModuleDefinitionCollection modules)
{
ModuleTable mt = m_tableReader.GetModuleTable ();
if (mt == null || mt.Rows.Count != 1)
throw new ReflectionException ("Can not read main module");
ModuleRow mr = mt [0];
string name = ReadString (mr.Name);
ModuleDefinition main = new ModuleDefinition (name, m_asmDef, this, true);
main.Mvid = m_streams.GuidHeap [mr.Mvid];
main.MetadataToken = new MetadataToken (TokenType.Module, 1);
modules.Add (main);
m_module = main;
m_module.Accept (this);
FileTable ftable = m_tableReader.GetFileTable ();
if (ftable == null || ftable.Rows.Count == 0)
return;
foreach (FileRow frow in ftable.Rows) {
if (frow.Flags != FileAttributes.ContainsMetaData)
continue;
name = ReadString (frow.Name);
FileInfo location = new FileInfo (
m_img.FileInformation != null ? Path.Combine (m_img.FileInformation.DirectoryName, name) : name);
if (!File.Exists (location.FullName))
throw new FileNotFoundException ("Module not found : " + name);
try {
ImageReader module = ImageReader.Read (location.FullName);
mt = module.Image.MetadataRoot.Streams.TablesHeap [ModuleTable.RId] as ModuleTable;
if (mt == null || mt.Rows.Count != 1)
throw new ReflectionException ("Can not read module : " + name);
mr = mt [0];
ModuleDefinition modext = new ModuleDefinition (name, m_asmDef,
new StructureReader (module, m_manifestOnly), false);
modext.Mvid = module.Image.MetadataRoot.Streams.GuidHeap [mr.Mvid];
modules.Add (modext);
modext.Accept (this);
} catch (ReflectionException) {
throw;
} catch (Exception e) {
throw new ReflectionException ("Can not read module : " + name, e);
}
}
}