Exemplo n.º 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();
            this.DbVersion       = reader.ReadUInt16();
            this.Password        = reader.ReadBytes(this.Password.Length);

            // 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());
            }
        }