Interface IMetadataTable
- Namespace
- AsmResolver.PE.DotNet.Metadata.Tables
- Assembly
- AsmResolver.PE.dll
Represents a metadata table stored in the tables stream of a managed executable.
public interface IMetadataTable : ICollection, IEnumerable, ISegment, IOffsetProvider, IWritable
- Inherited Members
Properties
IsSorted
Gets or sets a value indicating whether the table is considered sorted.
bool IsSorted { get; set; }
Property Value
this[int]
Gets or sets the row at the provided index.
IMetadataRow this[int index] { get; set; }
Parameters
index
intThe index of the row to get.
Property Value
Exceptions
- IndexOutOfRangeException
Occurs when the index is too small or too large for this table.
Layout
Gets the layout of the table.
TableLayout Layout { get; }
Property Value
Methods
GetByRid(uint)
Gets the contents of a row by its row identifier.
IMetadataRow GetByRid(uint rid)
Parameters
rid
uintThe row identifier.
Returns
- IMetadataRow
The row.
GetRowBounds(uint)
Calculates the offset range of a row within the table.
OffsetRange GetRowBounds(uint rid)
Parameters
rid
uintThe identifier of the row to get the bounds of.
Returns
- OffsetRange
The bounds.
Remarks
This method does not do any verification on whether rid
is a valid row in the table.
SetByRid(uint, IMetadataRow)
Sets the contents of a row by its row identifier.
void SetByRid(uint rid, IMetadataRow row)
Parameters
rid
uintThe row identifier.
row
IMetadataRowThe new contents of the row.
TryGetByRid(uint, out IMetadataRow)
Attempts to get the contents of a row by its row identifier.
bool TryGetByRid(uint rid, out IMetadataRow row)
Parameters
rid
uintThe row identifier.
row
IMetadataRowWhen successful, the read row.
Returns
- bool
true
if the RID existed and the row was obtained successfully,false
otherwise.
TryGetCell(uint, int, out uint)
Attempts to get the contents of a cell in the table by its row identifier and column index.
bool TryGetCell(uint rid, int column, out uint value)
Parameters
rid
uintThe row identifier.
column
intThe column index.
value
uintWhen successful, the contents of the cell, converted to an unsigned integer.
Returns
- bool
true
if the cell existed and was obtained successfully,false
otherwise.
TryGetRidByKey(int, uint, out uint)
Attempts to find a row index in a table by a key. This requires the table to be sorted.
bool TryGetRidByKey(int keyColumnIndex, uint key, out uint rid)
Parameters
keyColumnIndex
intThe column number to get the key from.
key
uintThe key to search.
rid
uintWhen this functions returns
true
, this parameter contains the RID of the row that contains the given key.
Returns
- bool
true
if the row was found,false
otherwise.
TryGetRowByKey(int, uint, out IMetadataRow)
Gets a single row in a table by a key. This requires the table to be sorted.
bool TryGetRowByKey(int keyColumnIndex, uint key, out IMetadataRow row)
Parameters
keyColumnIndex
intThe column number to get the key from.
key
uintThe key to search.
row
IMetadataRowWhen this functions returns
true
, this parameter contains the first row that contains the given key.
Returns
- bool
true
if the row was found,false
otherwise.
UpdateTableLayout(TableLayout)
Updates the table layout.
void UpdateTableLayout(TableLayout layout)
Parameters
layout
TableLayoutThe new table layout.
Remarks
This method is used to update the sizes of each column, and therefore requires the new layout to have the same names and column types as the original one.