本文整理汇总了C#中PEReader.GetElement方法的典型用法代码示例。如果您正苦于以下问题:C# PEReader.GetElement方法的具体用法?C# PEReader.GetElement怎么用?C# PEReader.GetElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEReader
的用法示例。
在下文中一共展示了PEReader.GetElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Resolve
internal override void Resolve(PEReader buff)
{
theClass = (ClassDef)buff.GetElement(MDTable.TypeDef, classIx);
if (tabIx == MDTable.EventMap)
{
for (uint i = elemIx; i < endIx; i++)
theClass.AddEvent((Event)buff.GetElement(MDTable.Event, i));
}
else if (tabIx == MDTable.PropertyMap)
{
for (uint i = elemIx; i < endIx; i++)
theClass.AddProperty((Property)buff.GetElement(MDTable.Property, i));
}
else
{ // must be nested class -- already done
//ClassDef parent = (ClassDef)buff.GetElement(MDTable.TypeDef,elemIx);
//parent.MakeNested(theClass);
}
}
示例2: Read
internal static void Read(PEReader buff, TableRow[] maps, MDTable tab)
{
Contract.Requires(maps != null);
Contract.Requires(buff != null);
if (tab == MDTable.NestedClass)
{
for (int i = 0; i < maps.Length; i++)
{
//maps[i] = new MapElem(buff,tab);
uint nestClassIx = buff.GetIndex(MDTable.TypeDef);
uint enclClassIx = buff.GetIndex(MDTable.TypeDef);
ClassDef parent = (ClassDef)buff.GetElement(MDTable.TypeDef, enclClassIx);
ClassDef nestClass = ((ClassDef)buff.GetElement(MDTable.TypeDef, nestClassIx)).MakeNestedClass(parent);
buff.InsertInTable(MDTable.TypeDef, nestClass.Row, nestClass);
}
}
else
{ // event or property map
MapElem prev = new MapElem(buff, tab);
maps[0] = prev;
for (int i = 1; i < maps.Length; i++)
{
maps[i] = new MapElem(buff, tab);
prev.endIx = ((MapElem)maps[i]).elemIx;
prev = (MapElem)maps[i];
}
switch (tab)
{
case MDTable.PropertyMap:
prev.endIx = buff.GetTableSize(MDTable.Property) + 1;
break;
case MDTable.EventMap:
prev.endIx = buff.GetTableSize(MDTable.Event) + 1;
break;
default:
prev.endIx = buff.GetTableSize(tab) + 1;
break;
}
}
}