本文整理汇总了C#中dnlib.DotNet.MD.TableInfo类的典型用法代码示例。如果您正苦于以下问题:C# TableInfo类的具体用法?C# TableInfo怎么用?C# TableInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableInfo类属于dnlib.DotNet.MD命名空间,在下文中一共展示了TableInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MetaDataTableNode
public MetaDataTableNode(HexDocument doc, MDTable mdTable, IMetaData md)
: base((ulong)mdTable.StartOffset, (ulong)mdTable.EndOffset - 1) {
this.doc = doc;
this.tableInfo = mdTable.TableInfo;
this.tablesStreamVM = MetaDataTableVM.Create(this, doc, StartOffset, mdTable);
this.tablesStreamVM.FindMetaDataTable = FindMetaDataTable;
this.tablesStreamVM.InitializeHeapOffsets((ulong)md.StringsStream.StartOffset, (ulong)md.StringsStream.EndOffset - 1);
}
示例2: GetInfoTuple
Tuple<int[], Action<ITextColorWriter>> GetInfoTuple(TableInfo tableInfo) {
switch (tableInfo.Table) {
case Table.Module: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 1 }, WriteModuleInfo);
case Table.TypeRef: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 1, 2 }, WriteTypeRefInfo);
case Table.TypeDef: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 1, 2 }, WriteTypeDefInfo);
case Table.FieldPtr: return null;
case Table.Field: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 1 }, WriteFieldInfo);
case Table.MethodPtr: return null;
case Table.Method: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 3 }, WriteMethodInfo);
case Table.ParamPtr: return null;
case Table.Param: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 2 }, WriteParamInfo);
case Table.InterfaceImpl: return null;
case Table.MemberRef: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 1 }, WriteMemberRefInfo);
case Table.Constant: return null;
case Table.CustomAttribute: return null;
case Table.FieldMarshal: return null;
case Table.DeclSecurity: return null;
case Table.ClassLayout: return null;
case Table.FieldLayout: return null;
case Table.StandAloneSig: return null;
case Table.EventMap: return null;
case Table.EventPtr: return null;
case Table.Event: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 1 }, WriteEventInfo);
case Table.PropertyMap: return null;
case Table.PropertyPtr: return null;
case Table.Property: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 1 }, WritePropertyInfo);
case Table.MethodSemantics: return null;
case Table.MethodImpl: return null;
case Table.ModuleRef: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 0 }, WriteModuleRefInfo);
case Table.TypeSpec: return null;
case Table.ImplMap: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 2 }, WriteImplMapInfo);
case Table.FieldRVA: return null;
case Table.ENCLog: return null;
case Table.ENCMap: return null;
case Table.Assembly: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 7 }, WriteAssemblyInfo);
case Table.AssemblyProcessor: return null;
case Table.AssemblyOS: return null;
case Table.AssemblyRef: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 6 }, WriteAssemblyRefInfo);
case Table.AssemblyRefProcessor: return null;
case Table.AssemblyRefOS: return null;
case Table.File: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 1 }, WriteFileInfo);
case Table.ExportedType: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 2, 3 }, WriteExportedTypeInfo);
case Table.ManifestResource: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 2 }, WriteManifestResourceInfo);
case Table.NestedClass: return null;
case Table.GenericParam: return new Tuple<int[], Action<ITextColorWriter>>(new int[] { 3 }, WriteGenericParamInfo);
case Table.MethodSpec: return null;
case Table.GenericParamConstraint: return null;
case Table.Document: return null;
case Table.MethodDebugInformation: return null;
case Table.LocalScope: return null;
case Table.LocalVariable: return null;
case Table.LocalConstant: return null;
case Table.ImportScope: return null;
case Table.StateMachineMethod: return null;
case Table.CustomDebugInformation: return null;
default: throw new InvalidOperationException();
}
}
示例3: CanSort
public static bool CanSort(TableInfo table) {
switch (table.Table) {
case Table.InterfaceImpl:
case Table.Constant:
case Table.CustomAttribute:
case Table.FieldMarshal:
case Table.DeclSecurity:
case Table.ClassLayout:
case Table.FieldLayout:
case Table.EventMap:
case Table.PropertyMap:
case Table.MethodSemantics:
case Table.MethodImpl:
case Table.ImplMap:
case Table.FieldRVA:
case Table.NestedClass:
case Table.GenericParam:
case Table.GenericParamConstraint:
return true;
case Table.Module:
case Table.TypeRef:
case Table.TypeDef:
case Table.FieldPtr:
case Table.Field:
case Table.MethodPtr:
case Table.Method:
case Table.ParamPtr:
case Table.Param:
case Table.MemberRef:
case Table.StandAloneSig:
case Table.EventPtr:
case Table.Event:
case Table.PropertyPtr:
case Table.Property:
case Table.ModuleRef:
case Table.TypeSpec:
case Table.ENCLog:
case Table.ENCMap:
case Table.Assembly:
case Table.AssemblyProcessor:
case Table.AssemblyOS:
case Table.AssemblyRef:
case Table.AssemblyRefProcessor:
case Table.AssemblyRefOS:
case Table.File:
case Table.ExportedType:
case Table.ManifestResource:
case Table.MethodSpec:
default:
return false;
}
}
示例4: CreateTableInfo
static TableInfo CreateTableInfo(TableInfo info) {
var newCols = new List<ColumnInfo>(info.Columns.Count + 1);
int offs = 0;
for (int i = 0, coli = 0; i < info.Columns.Count; i++, coli++) {
var col = info.Columns[i];
newCols.Add(new ColumnInfo((byte)coli, col.Name, col.ColumnSize, (byte)offs, (byte)col.Size));
offs += col.Size;
int nextOffs = i + 1 >= info.Columns.Count ? info.RowSize : info.Columns[i + 1].Offset;
int padding = nextOffs - (col.Offset + col.Size);
for (int j = 0; j < padding; j++) {
newCols.Add(new ColumnInfo((byte)(coli++ + 1), dnSpy_AsmEditor_Resources.Padding, ColumnSize.Byte, (byte)offs, 1));
offs++;
}
}
return new TableInfo(info.Table, info.Name, newCols.ToArray(), offs);
}
示例5: MetaDataTableVM
protected MetaDataTableVM(object owner, HexDocument doc, ulong startOffset, MDTable mdTable)
: base(owner) {
this.doc = doc;
this.startOffset = startOffset;
this.endOffset = startOffset + (mdTable.Rows == 0 ? 0 : (ulong)mdTable.Rows * mdTable.RowSize - 1);
this.numRows = mdTable.Rows;
this.tableInfo = CreateTableInfo(mdTable.TableInfo);
this.virtList = new VirtualizedList<MetaDataTableRecordVM>((int)numRows, CreateItem);
}
示例6: MetaDataTableRecordVM
protected MetaDataTableRecordVM(MetaDataTableVM mdVM, HexDocument doc, ulong startOffset, MDToken mdToken, TableInfo tableInfo)
{
this.mdVM = mdVM;
this.name = string.Format("{0}[{1:X6}]", mdToken.Table, mdToken.Rid);
this.doc = doc;
this.startOffset = startOffset;
this.endOffset = startOffset + (uint)tableInfo.RowSize - 1;
this.mdToken = mdToken;
this.tableInfo = tableInfo;
this.hexFields = new HexField[tableInfo.Columns.Count];
for (int i = 0; i < this.hexFields.Length; i++)
this.hexFields[i] = CreateField(tableInfo.Columns[i]);
}
示例7: MemberRefMetaDataTableRecordVM
public MemberRefMetaDataTableRecordVM(MetaDataTableVM mdVM, HexDocument doc, ulong startOffset, MDToken mdToken, TableInfo tableInfo)
: base(mdVM, doc, startOffset, mdToken, tableInfo)
{
}
示例8: ManifestResourceMetaDataTableRecordVM
public ManifestResourceMetaDataTableRecordVM(MetaDataTableVM mdVM, HexDocument doc, ulong startOffset, MDToken mdToken, TableInfo tableInfo)
: base(mdVM, doc, startOffset, mdToken, tableInfo)
{
}
示例9: MDTable
/// <summary>
/// Constructor
/// </summary>
/// <param name="table">The table</param>
/// <param name="numRows">Number of rows in this table</param>
/// <param name="tableInfo">Info about this table</param>
internal MDTable(Table table, uint numRows, TableInfo tableInfo) {
this.table = table;
this.numRows = numRows;
this.tableInfo = tableInfo;
}
示例10: AssemblyRefProcessorMetaDataTableRecordVM
public AssemblyRefProcessorMetaDataTableRecordVM(MetaDataTableVM mdVM, HexDocument doc, ulong startOffset, MDToken mdToken, TableInfo tableInfo)
: base(mdVM, doc, startOffset, mdToken, tableInfo)
{
}
示例11: Sort
public static void Sort(TableInfo table, byte[] data) {
Debug.Assert(data.Length % table.RowSize == 0);
var recs = new Record[data.Length / table.RowSize];
for (int i = 0, offs = 0; i < recs.Length; i++, offs += table.RowSize) {
var d = new byte[table.RowSize];
recs[i] = new Record(i, d);
Array.Copy(data, offs, d, 0, d.Length);
}
switch (table.Table) {
case Table.CustomAttribute:
case Table.FieldMarshal:
case Table.EventMap:
case Table.PropertyMap:
case Table.MethodImpl:
case Table.NestedClass:
case Table.GenericParamConstraint:
Array.Sort(recs, (a, b) => {
uint ac = Read(table, a.Data, 0);
uint bc = Read(table, b.Data, 0);
if (ac != bc)
return ac.CompareTo(bc);
return a.OrigIndex.CompareTo(b.OrigIndex);
});
break;
case Table.DeclSecurity:
case Table.FieldLayout:
case Table.ImplMap:
case Table.FieldRVA:
Array.Sort(recs, (a, b) => {
uint ac = Read(table, a.Data, 1);
uint bc = Read(table, b.Data, 1);
if (ac != bc)
return ac.CompareTo(bc);
return a.OrigIndex.CompareTo(b.OrigIndex);
});
break;
case Table.Constant:
case Table.ClassLayout:
case Table.MethodSemantics:
Array.Sort(recs, (a, b) => {
// Constant: Parent column is 2 and not 1 because a 'pad' column has been inserted
uint ac = Read(table, a.Data, 2);
uint bc = Read(table, b.Data, 2);
if (ac != bc)
return ac.CompareTo(bc);
return a.OrigIndex.CompareTo(b.OrigIndex);
});
break;
case Table.InterfaceImpl:
Array.Sort(recs, (a, b) => {
uint ac = Read(table, a.Data, 0);
uint bc = Read(table, b.Data, 0);
if (ac != bc)
return ac.CompareTo(bc);
ac = Read(table, a.Data, 1);
bc = Read(table, b.Data, 1);
if (ac != bc)
return ac.CompareTo(bc);
return a.OrigIndex.CompareTo(b.OrigIndex);
});
break;
case Table.GenericParam:
Array.Sort(recs, (a, b) => {
uint ac = Read(table, a.Data, 2);
uint bc = Read(table, b.Data, 2);
if (ac != bc)
return ac.CompareTo(bc);
ac = Read(table, a.Data, 0);
bc = Read(table, b.Data, 0);
if (ac != bc)
return ac.CompareTo(bc);
return a.OrigIndex.CompareTo(b.OrigIndex);
});
break;
default:
Debug.Fail("Can't sort it. Call CanSort() first");
return;
}
for (int i = 0, offs = 0; i < recs.Length; i++, offs += table.RowSize) {
var d = recs[i].Data;
Array.Copy(d, 0, data, offs, d.Length);
}
}
示例12: Read
static uint Read(TableInfo table, byte[] rec, int colIndex) {
var col = table.Columns[colIndex];
if (col.Size == 2)
return BitConverter.ToUInt16(rec, col.Offset);
if (col.Size == 4)
return BitConverter.ToUInt32(rec, col.Offset);
throw new InvalidOperationException();
}
示例13: MetaDataTableRecordTreeNode
public MetaDataTableRecordTreeNode(TableInfo tableInfo, int index, ulong startOffset, ulong endOffset)
: base(startOffset, endOffset) {
this.index = index;
this.infoTuple = GetInfoTuple(tableInfo);
}
示例14: CustomAttributeMetaDataTableRecordVM
public CustomAttributeMetaDataTableRecordVM(MetaDataTableVM mdVM, HexDocument doc, ulong startOffset, MDToken mdToken, TableInfo tableInfo)
: base(mdVM, doc, startOffset, mdToken, tableInfo)
{
}
示例15: MetaDataTableRecordNode
public MetaDataTableRecordNode(TableInfo tableInfo, int index, HexPosition startOffset, HexPosition endOffset)
: base(HexSpan.FromBounds(startOffset, endOffset)) {
this.index = index;
infoTuple = GetInfoTuple(tableInfo);
}