本文整理汇总了C#中dnlib.DotNet.MD.TableInfo类的典型用法代码示例。如果您正苦于以下问题:C# TableInfo类的具体用法?C# TableInfo怎么用?C# TableInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableInfo类属于dnlib.DotNet.MD命名空间,在下文中一共展示了TableInfo类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:8,代码来源:MetaDataTableNode.cs
示例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();
}
}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:58,代码来源:MetaDataTableRecordNode.cs
示例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;
}
}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:53,代码来源:TableSorter.cs
示例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);
}
开发者ID:0xd4d,项目名称:dnSpy,代码行数:18,代码来源:MetaDataTableVM.cs
示例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);
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:9,代码来源:MetaDataTableVM.cs
示例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]);
}
开发者ID:johnjohnsp1,项目名称:dnSpy,代码行数:13,代码来源:MetaDataTableRecordVM.cs
示例7: MemberRefMetaDataTableRecordVM
public MemberRefMetaDataTableRecordVM(MetaDataTableVM mdVM, HexDocument doc, ulong startOffset, MDToken mdToken, TableInfo tableInfo)
: base(mdVM, doc, startOffset, mdToken, tableInfo)
{
}
开发者ID:johnjohnsp1,项目名称:dnSpy,代码行数:4,代码来源:MetaDataTableRecordVM.cs
示例8: ManifestResourceMetaDataTableRecordVM
public ManifestResourceMetaDataTableRecordVM(MetaDataTableVM mdVM, HexDocument doc, ulong startOffset, MDToken mdToken, TableInfo tableInfo)
: base(mdVM, doc, startOffset, mdToken, tableInfo)
{
}
开发者ID:johnjohnsp1,项目名称:dnSpy,代码行数:4,代码来源:MetaDataTableRecordVM.cs
示例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;
}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:11,代码来源:MDTable.cs
示例10: AssemblyRefProcessorMetaDataTableRecordVM
public AssemblyRefProcessorMetaDataTableRecordVM(MetaDataTableVM mdVM, HexDocument doc, ulong startOffset, MDToken mdToken, TableInfo tableInfo)
: base(mdVM, doc, startOffset, mdToken, tableInfo)
{
}
开发者ID:johnjohnsp1,项目名称:dnSpy,代码行数:4,代码来源:MetaDataTableRecordVM.cs
示例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);
}
}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:91,代码来源:TableSorter.cs
示例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();
}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:8,代码来源:TableSorter.cs
示例13: MetaDataTableRecordTreeNode
public MetaDataTableRecordTreeNode(TableInfo tableInfo, int index, ulong startOffset, ulong endOffset)
: base(startOffset, endOffset) {
this.index = index;
this.infoTuple = GetInfoTuple(tableInfo);
}
开发者ID:nakijun,项目名称:dnSpy,代码行数:5,代码来源:MetaDataTableRecordTreeNode.cs
示例14: CustomAttributeMetaDataTableRecordVM
public CustomAttributeMetaDataTableRecordVM(MetaDataTableVM mdVM, HexDocument doc, ulong startOffset, MDToken mdToken, TableInfo tableInfo)
: base(mdVM, doc, startOffset, mdToken, tableInfo)
{
}
开发者ID:johnjohnsp1,项目名称:dnSpy,代码行数:4,代码来源:MetaDataTableRecordVM.cs
示例15: MetaDataTableRecordNode
public MetaDataTableRecordNode(TableInfo tableInfo, int index, HexPosition startOffset, HexPosition endOffset)
: base(HexSpan.FromBounds(startOffset, endOffset)) {
this.index = index;
infoTuple = GetInfoTuple(tableInfo);
}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:5,代码来源:MetaDataTableRecordNode.cs
示例16: GenericParamMetaDataTableRecordV11VM
public GenericParamMetaDataTableRecordV11VM(MetaDataTableVM mdVM, HexDocument doc, ulong startOffset, MDToken mdToken, TableInfo tableInfo)
: base(mdVM, doc, startOffset, mdToken, tableInfo)
{
}
开发者ID:johnjohnsp1,项目名称:dnSpy,代码行数:4,代码来源:MetaDataTableRecordVM.cs
示例17: CreateTables
/// <summary>
/// Creates the table infos
/// </summary>
/// <param name="majorVersion">Major table version</param>
/// <param name="minorVersion">Minor table version</param>
/// <param name="maxPresentTables">Initialized to max present tables (eg. 42 or 45)</param>
/// <returns>All table infos (not completely initialized)</returns>
public TableInfo[] CreateTables(byte majorVersion, byte minorVersion, out int maxPresentTables) {
// The three extra generics tables aren't used by CLR 1.x
maxPresentTables = (majorVersion == 1 && minorVersion == 0) ? (int)Table.NestedClass + 1 : (int)Table.GenericParamConstraint + 1;
var tableInfos = new TableInfo[(int)Table.GenericParamConstraint + 1];
tableInfos[(int)Table.Module] = new TableInfo(Table.Module, "Module", new ColumnInfo[] {
new ColumnInfo(0, "Generation", ColumnSize.UInt16),
new ColumnInfo(1, "Name", ColumnSize.Strings),
new ColumnInfo(2, "Mvid", ColumnSize.GUID),
new ColumnInfo(3, "EncId", ColumnSize.GUID),
new ColumnInfo(4, "EncBaseId", ColumnSize.GUID),
});
tableInfos[(int)Table.TypeRef] = new TableInfo(Table.TypeRef, "TypeRef", new ColumnInfo[] {
new ColumnInfo(0, "ResolutionScope", ColumnSize.ResolutionScope),
new ColumnInfo(1, "Name", ColumnSize.Strings),
new ColumnInfo(2, "Namespace", ColumnSize.Strings),
});
tableInfos[(int)Table.TypeDef] = new TableInfo(Table.TypeDef, "TypeDef", new ColumnInfo[] {
new ColumnInfo(0, "Flags", ColumnSize.UInt32),
new ColumnInfo(1, "Name", ColumnSize.Strings),
new ColumnInfo(2, "Namespace", ColumnSize.Strings),
new ColumnInfo(3, "Extends", ColumnSize.TypeDefOrRef),
new ColumnInfo(4, "FieldList", ColumnSize.Field),
new ColumnInfo(5, "MethodList", ColumnSize.Method),
});
tableInfos[(int)Table.FieldPtr] = new TableInfo(Table.FieldPtr, "FieldPtr", new ColumnInfo[] {
new ColumnInfo(0, "Field", ColumnSize.Field),
});
tableInfos[(int)Table.Field] = new TableInfo(Table.Field, "Field", new ColumnInfo[] {
new ColumnInfo(0, "Flags", ColumnSize.UInt16),
new ColumnInfo(1, "Name", ColumnSize.Strings),
new ColumnInfo(2, "Signature", ColumnSize.Blob),
});
tableInfos[(int)Table.MethodPtr] = new TableInfo(Table.MethodPtr, "MethodPtr", new ColumnInfo[] {
new ColumnInfo(0, "Method", ColumnSize.Method),
});
tableInfos[(int)Table.Method] = new TableInfo(Table.Method, "Method", new ColumnInfo[] {
new ColumnInfo(0, "RVA", ColumnSize.UInt32),
new ColumnInfo(1, "ImplFlags", ColumnSize.UInt16),
new ColumnInfo(2, "Flags", ColumnSize.UInt16),
new ColumnInfo(3, "Name", ColumnSize.Strings),
new ColumnInfo(4, "Signature", ColumnSize.Blob),
new ColumnInfo(5, "ParamList", ColumnSize.Param),
});
tableInfos[(int)Table.ParamPtr] = new TableInfo(Table.ParamPtr, "ParamPtr", new ColumnInfo[] {
new ColumnInfo(0, "Param", ColumnSize.Param),
});
tableInfos[(int)Table.Param] = new TableInfo(Table.Param, "Param", new ColumnInfo[] {
new ColumnInfo(0, "Flags", ColumnSize.UInt16),
new ColumnInfo(1, "Sequence", ColumnSize.UInt16),
new ColumnInfo(2, "Name", ColumnSize.Strings),
});
tableInfos[(int)Table.InterfaceImpl] = new TableInfo(Table.InterfaceImpl, "InterfaceImpl", new ColumnInfo[] {
new ColumnInfo(0, "Class", ColumnSize.TypeDef),
new ColumnInfo(1, "Interface", ColumnSize.TypeDefOrRef),
});
tableInfos[(int)Table.MemberRef] = new TableInfo(Table.MemberRef, "MemberRef", new ColumnInfo[] {
new ColumnInfo(0, "Class", ColumnSize.MemberRefParent),
new ColumnInfo(1, "Name", ColumnSize.Strings),
new ColumnInfo(2, "Signature", ColumnSize.Blob),
});
tableInfos[(int)Table.Constant] = new TableInfo(Table.Constant, "Constant", new ColumnInfo[] {
new ColumnInfo(0, "Type", ColumnSize.Byte),
new ColumnInfo(1, "Parent", ColumnSize.HasConstant),
new ColumnInfo(2, "Value", ColumnSize.Blob),
});
tableInfos[(int)Table.CustomAttribute] = new TableInfo(Table.CustomAttribute, "CustomAttribute", new ColumnInfo[] {
new ColumnInfo(0, "Parent", ColumnSize.HasCustomAttribute),
new ColumnInfo(1, "Type", ColumnSize.CustomAttributeType),
new ColumnInfo(2, "Value", ColumnSize.Blob),
});
tableInfos[(int)Table.FieldMarshal] = new TableInfo(Table.FieldMarshal, "FieldMarshal", new ColumnInfo[] {
new ColumnInfo(0, "Parent", ColumnSize.HasFieldMarshal),
new ColumnInfo(1, "NativeType", ColumnSize.Blob),
});
tableInfos[(int)Table.DeclSecurity] = new TableInfo(Table.DeclSecurity, "DeclSecurity", new ColumnInfo[] {
new ColumnInfo(0, "Action", ColumnSize.Int16),
new ColumnInfo(1, "Parent", ColumnSize.HasDeclSecurity),
new ColumnInfo(2, "PermissionSet", ColumnSize.Blob),
});
tableInfos[(int)Table.ClassLayout] = new TableInfo(Table.ClassLayout, "ClassLayout", new ColumnInfo[] {
new ColumnInfo(0, "PackingSize", ColumnSize.UInt16),
new ColumnInfo(1, "ClassSize", ColumnSize.UInt32),
new ColumnInfo(2, "Parent", ColumnSize.TypeDef),
});
tableInfos[(int)Table.FieldLayout] = new TableInfo(Table.FieldLayout, "FieldLayout", new ColumnInfo[] {
new ColumnInfo(0, "OffSet", ColumnSize.UInt32),
new ColumnInfo(1, "Field", ColumnSize.Field),
});
tableInfos[(int)Table.StandAloneSig] = new TableInfo(Table.StandAloneSig, "StandAloneSig", new ColumnInfo[] {
new ColumnInfo(0, "Signature", ColumnSize.Blob),
});
//.........这里部分代码省略.........
开发者ID:EmilZhou,项目名称:dnlib,代码行数:101,代码来源:DotNetTableSizes.cs
示例18: Dispose
/// <inheritdoc/>
public void Dispose() {
var ims = imageStream;
if (ims != null)
ims.Dispose();
numRows = 0;
tableInfo = null;
imageStream = null;
}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:9,代码来源:MDTable.cs
示例19: Dispose
/// <inheritdoc/>
public void Dispose() {
if (imageStream != null)
imageStream.Dispose();
numRows = 0;
tableInfo = null;
imageStream = null;
}
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:8,代码来源:MDTable.cs
注:本文中的dnlib.DotNet.MD.TableInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论