/// <inheritdoc /> public int Read(BinaryReader reader) { var byteCount = 0; var header = reader.ReadBytes(TableHead.Length); byteCount += TableHead.Length; if (!CompareBytes(header, GetHashedBytes(TableHead, TableIdx))) { throw new ConfigException("Invalid Table Header"); } byteCount += ConfigStructureUtils.ReadString(reader, out var tableName); TableName = tableName; ColumnCount = reader.ReadUInt16(); byteCount += sizeof(ushort); for (var i = 0; i < ColumnCount; ++i) { byteCount += ConfigStructureUtils.ReadString(reader, out var colName); ColumnName.Add(colName); var colSep = reader.ReadByte(); if (colSep != ColSep) { throw new ConfigException("Invalid Column Separator"); } byteCount += 1; } RowCount = reader.ReadUInt32(); byteCount += sizeof(uint); for (var i = 0; i < RowCount; ++i) { var rowItem = new RowItem(ColumnCount); byteCount += rowItem.Read(reader); RowData.Add(rowItem); var sep = reader.ReadBytes(RowSep.Length); byteCount += RowSep.Length; if (!CompareBytes(sep, GetHashedBytes(RowSep, i))) { throw new ConfigException("Invalid Row Separator"); } } return(byteCount); }
public void AddColumn(string columnName, object[] values) { ColumnName.Add(columnName); Values.Add(values); }