/* Achtung! Hier fehlt noch jegliches Error-Handling Es wird nicht einmal geprüft ob die Datei mit VADB anfängt! */ public VDB_Table[] ImportTables(string filename) { BinaryReader reader = new BinaryReader(File.Open(filename, FileMode.Open)); string formatID = reader.ReadString(); int formatVersion = reader.ReadInt32(); int tableCount = reader.ReadInt32(); VDB_Table[] tables = new VDB_Table[tableCount]; for (int i = 0; i < tableCount; i++) { string tableName = reader.ReadString(); int columnCount = reader.ReadInt32(); string[] columns = new string[columnCount]; for (int j = 0; j < columnCount; j++) { columns[j] = reader.ReadString(); } int rowCount = reader.ReadInt32(); tables[i] = new VDB_Table(tableName, rowCount, columns); } string valueArea = reader.ReadString(); string[] values = valueArea.Split(VDB_DatabaseExporter.valuesSeperator); for (int i = 0; i < values.Length - 1; i++) { string[] posval = values[i].Split(VDB_DatabaseExporter.positionValueSeperator); string[] pos = posval[0].Split(VDB_DatabaseExporter.positionSeperator); int table = Int32.Parse(pos[0]); int row = Int32.Parse(pos[1]); int column = Int32.Parse(pos[2]); tables[table].GetRowAt(row).values[column] = VDB_Value.FromBase64(posval[1]); } reader.Close(); return tables; }
public void AddTable(string tableName, params string[] columns) { VDB_Table newTable = new VDB_Table(tableName, columns); tables.Add(newTable); }
public VDB_Database(VDB_Table[] newTables) { tables = new List<VDB_Table>(); tables.AddRange(newTables); }