本文整理汇总了C#中TableIndex类的典型用法代码示例。如果您正苦于以下问题:C# TableIndex类的具体用法?C# TableIndex怎么用?C# TableIndex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableIndex类属于命名空间,在下文中一共展示了TableIndex类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTableRowSize
/// <summary>
/// Returns the size of a row in the specified table.
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="tableIndex"/> is not a valid table index.</exception>
public static int GetTableRowSize(this MetadataReader reader, TableIndex tableIndex)
{
if (reader == null)
{
throw new ArgumentNullException("reader");
}
switch (tableIndex)
{
case TableIndex.Module: return reader.ModuleTable.RowSize;
case TableIndex.TypeRef: return reader.TypeRefTable.RowSize;
case TableIndex.TypeDef: return reader.TypeDefTable.RowSize;
case TableIndex.FieldPtr: return reader.FieldPtrTable.RowSize;
case TableIndex.Field: return reader.FieldTable.RowSize;
case TableIndex.MethodPtr: return reader.MethodPtrTable.RowSize;
case TableIndex.MethodDef: return reader.MethodDefTable.RowSize;
case TableIndex.ParamPtr: return reader.ParamPtrTable.RowSize;
case TableIndex.Param: return reader.ParamTable.RowSize;
case TableIndex.InterfaceImpl: return reader.InterfaceImplTable.RowSize;
case TableIndex.MemberRef: return reader.MemberRefTable.RowSize;
case TableIndex.Constant: return reader.ConstantTable.RowSize;
case TableIndex.CustomAttribute: return reader.CustomAttributeTable.RowSize;
case TableIndex.FieldMarshal: return reader.FieldMarshalTable.RowSize;
case TableIndex.DeclSecurity: return reader.DeclSecurityTable.RowSize;
case TableIndex.ClassLayout: return reader.ClassLayoutTable.RowSize;
case TableIndex.FieldLayout: return reader.FieldLayoutTable.RowSize;
case TableIndex.StandAloneSig: return reader.StandAloneSigTable.RowSize;
case TableIndex.EventMap: return reader.EventMapTable.RowSize;
case TableIndex.EventPtr: return reader.EventPtrTable.RowSize;
case TableIndex.Event: return reader.EventTable.RowSize;
case TableIndex.PropertyMap: return reader.PropertyMapTable.RowSize;
case TableIndex.PropertyPtr: return reader.PropertyPtrTable.RowSize;
case TableIndex.Property: return reader.PropertyTable.RowSize;
case TableIndex.MethodSemantics: return reader.MethodSemanticsTable.RowSize;
case TableIndex.MethodImpl: return reader.MethodImplTable.RowSize;
case TableIndex.ModuleRef: return reader.ModuleRefTable.RowSize;
case TableIndex.TypeSpec: return reader.TypeSpecTable.RowSize;
case TableIndex.ImplMap: return reader.ImplMapTable.RowSize;
case TableIndex.FieldRva: return reader.FieldRvaTable.RowSize;
case TableIndex.EncLog: return reader.EncLogTable.RowSize;
case TableIndex.EncMap: return reader.EncMapTable.RowSize;
case TableIndex.Assembly: return reader.AssemblyTable.RowSize;
case TableIndex.AssemblyProcessor: return reader.AssemblyProcessorTable.RowSize;
case TableIndex.AssemblyOS: return reader.AssemblyOSTable.RowSize;
case TableIndex.AssemblyRef: return reader.AssemblyRefTable.RowSize;
case TableIndex.AssemblyRefProcessor: return reader.AssemblyRefProcessorTable.RowSize;
case TableIndex.AssemblyRefOS: return reader.AssemblyRefOSTable.RowSize;
case TableIndex.File: return reader.FileTable.RowSize;
case TableIndex.ExportedType: return reader.ExportedTypeTable.RowSize;
case TableIndex.ManifestResource: return reader.ManifestResourceTable.RowSize;
case TableIndex.NestedClass: return reader.NestedClassTable.RowSize;
case TableIndex.GenericParam: return reader.GenericParamTable.RowSize;
case TableIndex.MethodSpec: return reader.MethodSpecTable.RowSize;
case TableIndex.GenericParamConstraint: return reader.GenericParamConstraintTable.RowSize;
default:
throw new ArgumentOutOfRangeException("tableIndex");
}
}
示例2: GetTableRowCount
/// <summary>
/// Returns the number of rows in the specified table.
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="tableIndex"/> is not a valid table index.</exception>
public static int GetTableRowCount(this MetadataReader reader, TableIndex tableIndex)
{
if (reader == null)
{
throw new ArgumentNullException("reader");
}
if ((int)tableIndex >= TableIndexExtensions.Count)
{
throw new ArgumentOutOfRangeException("tableIndex");
}
return (int)reader.TableRowCounts[(int)tableIndex];
}
示例3: GetTableRowCount
/// <summary>
/// Returns the number of rows in the specified table.
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="tableIndex"/> is not a valid table index.</exception>
public static int GetTableRowCount(this MetadataReader reader, TableIndex tableIndex)
{
if (reader == null)
{
Throw.ArgumentNull(nameof(reader));
}
if ((int)tableIndex >= MetadataTokens.TableCount)
{
Throw.TableIndexOutOfRange();
}
return reader.TableRowCounts[(int)tableIndex];
}
示例4: GetTableRowCount
/// <summary>
/// Returns the number of rows in the specified table.
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="tableIndex"/> is not a valid table index.</exception>
public static int GetTableRowCount(this MetadataReader reader, TableIndex tableIndex)
{
if (reader == null)
{
throw new ArgumentNullException(nameof(reader));
}
if ((int)tableIndex >= TableIndexExtensions.Count)
{
Throw.TableIndexOutOfRange();
}
return reader.TableRowCounts[(int)tableIndex];
}
示例5: lua_getfield
public static void lua_getfield(LuaState luaState, TableIndex index, string k) => lua_getfield(luaState, (int)index, k);
示例6: lua_getfield
public static void lua_getfield(this LuaState luaState, TableIndex index, string k) => Lua.lua_getfield(luaState, index, k);
示例7: GetTableMetadataBlock
private static MemoryBlock GetTableMetadataBlock(this MetadataReader reader, TableIndex tableIndex)
{
Debug.Assert(reader != null);
switch (tableIndex)
{
case TableIndex.Module: return reader.ModuleTable.Block;
case TableIndex.TypeRef: return reader.TypeRefTable.Block;
case TableIndex.TypeDef: return reader.TypeDefTable.Block;
case TableIndex.FieldPtr: return reader.FieldPtrTable.Block;
case TableIndex.Field: return reader.FieldTable.Block;
case TableIndex.MethodPtr: return reader.MethodPtrTable.Block;
case TableIndex.MethodDef: return reader.MethodDefTable.Block;
case TableIndex.ParamPtr: return reader.ParamPtrTable.Block;
case TableIndex.Param: return reader.ParamTable.Block;
case TableIndex.InterfaceImpl: return reader.InterfaceImplTable.Block;
case TableIndex.MemberRef: return reader.MemberRefTable.Block;
case TableIndex.Constant: return reader.ConstantTable.Block;
case TableIndex.CustomAttribute: return reader.CustomAttributeTable.Block;
case TableIndex.FieldMarshal: return reader.FieldMarshalTable.Block;
case TableIndex.DeclSecurity: return reader.DeclSecurityTable.Block;
case TableIndex.ClassLayout: return reader.ClassLayoutTable.Block;
case TableIndex.FieldLayout: return reader.FieldLayoutTable.Block;
case TableIndex.StandAloneSig: return reader.StandAloneSigTable.Block;
case TableIndex.EventMap: return reader.EventMapTable.Block;
case TableIndex.EventPtr: return reader.EventPtrTable.Block;
case TableIndex.Event: return reader.EventTable.Block;
case TableIndex.PropertyMap: return reader.PropertyMapTable.Block;
case TableIndex.PropertyPtr: return reader.PropertyPtrTable.Block;
case TableIndex.Property: return reader.PropertyTable.Block;
case TableIndex.MethodSemantics: return reader.MethodSemanticsTable.Block;
case TableIndex.MethodImpl: return reader.MethodImplTable.Block;
case TableIndex.ModuleRef: return reader.ModuleRefTable.Block;
case TableIndex.TypeSpec: return reader.TypeSpecTable.Block;
case TableIndex.ImplMap: return reader.ImplMapTable.Block;
case TableIndex.FieldRva: return reader.FieldRvaTable.Block;
case TableIndex.EncLog: return reader.EncLogTable.Block;
case TableIndex.EncMap: return reader.EncMapTable.Block;
case TableIndex.Assembly: return reader.AssemblyTable.Block;
case TableIndex.AssemblyProcessor: return reader.AssemblyProcessorTable.Block;
case TableIndex.AssemblyOS: return reader.AssemblyOSTable.Block;
case TableIndex.AssemblyRef: return reader.AssemblyRefTable.Block;
case TableIndex.AssemblyRefProcessor: return reader.AssemblyRefProcessorTable.Block;
case TableIndex.AssemblyRefOS: return reader.AssemblyRefOSTable.Block;
case TableIndex.File: return reader.FileTable.Block;
case TableIndex.ExportedType: return reader.ExportedTypeTable.Block;
case TableIndex.ManifestResource: return reader.ManifestResourceTable.Block;
case TableIndex.NestedClass: return reader.NestedClassTable.Block;
case TableIndex.GenericParam: return reader.GenericParamTable.Block;
case TableIndex.MethodSpec: return reader.MethodSpecTable.Block;
case TableIndex.GenericParamConstraint: return reader.GenericParamConstraintTable.Block;
// debug tables
case TableIndex.Document: return reader.DocumentTable.Block;
case TableIndex.MethodDebugInformation: return reader.MethodDebugInformationTable.Block;
case TableIndex.LocalScope: return reader.LocalScopeTable.Block;
case TableIndex.LocalVariable: return reader.LocalVariableTable.Block;
case TableIndex.LocalConstant: return reader.LocalConstantTable.Block;
case TableIndex.ImportScope: return reader.ImportScopeTable.Block;
case TableIndex.StateMachineMethod: return reader.StateMachineMethodTable.Block;
case TableIndex.CustomDebugInformation: return reader.CustomDebugInformationTable.Block;
default:
throw new ArgumentOutOfRangeException(nameof(tableIndex));
}
}
示例8: IsPresent
public bool IsPresent(TableIndex table) => (PresentTablesMask & (1UL << (int)table)) != 0;
示例9: ReferenceFits
private bool ReferenceFits(int bitCount, TableIndex[] tables)
{
int maxIndex = (1 << bitCount) - 1;
foreach (TableIndex table in tables)
{
if (RowCounts[(int)table] > maxIndex)
{
return false;
}
}
return true;
}
示例10: CombineRowCounts
private static int[] CombineRowCounts(int[] local, int[] external, TableIndex firstLocalTableIndex)
{
Debug.Assert(local.Length == external.Length);
var rowCounts = new int[local.Length];
for (int i = 0; i < (int)firstLocalTableIndex; i++)
{
rowCounts[i] = external[i];
}
for (int i = (int)firstLocalTableIndex; i < rowCounts.Length; i++)
{
rowCounts[i] = local[i];
}
return rowCounts;
}
示例11: GetTableSize
private int GetTableSize(TableIndex index, int rowSize)
{
return RowCounts[(int)index] * rowSize;
}
示例12: TryGetTableIndex
/// <summary>
/// Gets the <see cref="TableIndex"/> of the table corresponding to the specified <see cref="HandleKind"/>.
/// </summary>
/// <param name="type">Handle type.</param>
/// <param name="index">Table index.</param>
/// <returns>True if the handle type corresponds to an Ecma335 or Portable PDB table, false otherwise.</returns>
public static bool TryGetTableIndex(HandleKind type, out TableIndex index)
{
// We don't have a HandleKind for PropertyMap, EventMap, MethodSemantics, *Ptr, AssemblyOS, etc. tables,
// but one can get ahold of one by creating a handle from a token and getting its Kind.
if ((int)type < TableCount && ((1UL << (int)type) & (ulong)TableMask.AllTables) != 0)
{
index = (TableIndex)type;
return true;
}
index = 0;
return false;
}
示例13: Handle
/// <summary>
/// Creates an <see cref="Metadata.EntityHandle"/> from a token value.
/// </summary>
/// <exception cref="ArgumentException">
/// <paramref name="tableIndex"/> is not a valid table index.</exception>
public static EntityHandle Handle(TableIndex tableIndex, int rowNumber)
{
int token = ((int)tableIndex << TokenTypeIds.RowIdBitCount) | rowNumber;
if (!TokenTypeIds.IsEntityOrUserStringToken(unchecked((uint)token)))
{
Throw.TableIndexOutOfRange();
}
return new EntityHandle((uint)token);
}
示例14: ReferenceFits
private bool ReferenceFits(int bitCount, TableIndex[] tables)
{
int maxIndex = (1 << bitCount) - 1;
foreach (TableIndex table in tables)
{
// table can be either local or external, but not both:
Debug.Assert(RowCounts[(int)table] == 0 || ExternalRowCounts[(int)table] == 0);
if (RowCounts[(int)table] + ExternalRowCounts[(int)table] > maxIndex)
{
return false;
}
}
return true;
}
示例15: TryGetTableIndex
/// <summary>
/// Gets the <see cref="TableIndex"/> of the table corresponding to the specified <see cref="HandleKind"/>.
/// </summary>
/// <param name="type">Handle type.</param>
/// <param name="index">Table index.</param>
/// <returns>True if the handle type corresponds to an Ecma335 table, false otherwise.</returns>
public static bool TryGetTableIndex(HandleKind type, out TableIndex index)
{
if ((int)type < TableIndexExtensions.Count)
{
index = (TableIndex)type;
return true;
}
index = 0;
return false;
}