protected override void ReadContent(ByteReader reader) { var info = reader.ReadString(HEADER_INFO.Length); var ver = reader.ReadByte(); if (info != HEADER_INFO) { throw LiteException.InvalidDatabase(); } if (ver != FILE_VERSION) { throw LiteException.InvalidDatabaseVersion(ver); } this.ChangeID = reader.ReadUInt16(); this.FreeEmptyPageID = reader.ReadUInt32(); this.LastPageID = reader.ReadUInt32(); reader.Skip(200); // read page collections references (position on end of page) var cols = reader.ReadByte(); for (var i = 0; i < cols; i++) { this.CollectionPages.Add(reader.ReadString(), reader.ReadUInt32()); } }
private void ReadHeader(ByteReader reader) { // first 5 bytes (pageID + pageType) was readed before class create // this.PageID // this.PageType PrevPageID = reader.ReadUInt32(); NextPageID = reader.ReadUInt32(); ItemCount = reader.ReadUInt16(); FreeBytes = reader.ReadUInt16(); reader.Skip(8); // reserved 8 bytes }
public void Read(ByteReader reader) { this.DbVersion = reader.ReadUInt16(); reader.Skip(198); }
protected override void ReadContent(ByteReader reader) { var info = reader.ReadString(HEADER_INFO.Length); var ver = reader.ReadByte(); if (info != HEADER_INFO) throw LiteException.InvalidDatabase(); if (ver != FILE_VERSION) throw LiteException.InvalidDatabaseVersion(ver); this.ChangeID = reader.ReadUInt16(); this.FreeEmptyPageID = reader.ReadUInt32(); this.LastPageID = reader.ReadUInt32(); reader.Skip(200); // read page collections references (position on end of page) var cols = reader.ReadByte(); for(var i = 0; i < cols; i++) { this.CollectionPages.Add(reader.ReadString(), reader.ReadUInt32()); } }