コード例 #1
0
        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());
            }
        }
コード例 #2
0
        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
        }
コード例 #3
0
ファイル: DbParams.cs プロジェクト: ktaranov/LiteDB
 public void Read(ByteReader reader)
 {
     this.DbVersion = reader.ReadUInt16();
     reader.Skip(198);
 }
コード例 #4
0
ファイル: HeaderPage.cs プロジェクト: shahid-pk/LiteDB
        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());
            }
        }
コード例 #5
0
ファイル: DbParams.cs プロジェクト: ktaranov/LiteDB
 public void Read(ByteReader reader)
 {
     this.DbVersion = reader.ReadUInt16();
     reader.Skip(198);
 }