private void PopulateTableRows(AssemblyBuffer buffer) { for (int idx = 0; idx < this.TableLengths.Length; idx++) { MetaDataTableType tableType = (MetaDataTableType)idx; // These weren't valid in the present DWORD. if (this.TableLengths[idx] == 0) { continue; } if (!this.TableRowTypes.ContainsKey(tableType)) { Console.WriteLine($"WARNING: NO TYPE HANDLER FOR: {tableType.ToString()}"); continue; } Type rowType = this.TableRowTypes[tableType]; List <TableRow> tableRows = new List <TableRow>(); for (int tableIdx = 0; tableIdx < this.TableLengths[idx]; tableIdx++) { TableRow row = (TableRow)Activator.CreateInstance(rowType, buffer); if (row == null) { Console.WriteLine($"WARNING: No Row type for :{tableType.ToString()}"); continue; } row.SetStreamHeaderState(this._metaDataHeader.Streams); row.Read(buffer); tableRows.Add(row); } this.TableRows.Add(tableType, tableRows); } }
/// <summary> /// Returns a string representation of the Metadata Table. /// </summary> /// <returns></returns> public override string ToString() { return("Type: " + type.ToString() + ", Rows: " + rowAmount.ToString()); }