private void ReadOffsets(BlockBuffer buffer, ushort offsetCount)
        {
            int recordOffsetSize = new RecordOffset(0, 0).Size;

            for (int i = 0; i < offsetCount; i++)
            {
                RecordOffset offset = new RecordOffset(buffer.ReadBytes(recordOffsetSize));
                Offsets.Add(offset);
            }
        }
        public BlockHeader(BlockBuffer buffer)
        {
            Buffer = buffer;

            IsFilled    = buffer.ReadByte() == 1;
            RelationId  = BitConverter.ToInt32(buffer.ReadBytes(4));
            NextBlockId = new Pointer(BitConverter.ToUInt16(buffer.ReadBytes(4)));
            ushort offsetCount = BitConverter.ToUInt16(buffer.ReadBytes(2), 0);

            ReadOffsets(buffer, offsetCount);
        }
Esempio n. 3
0
        public FileHeader(StorageFile storageFile)
        {
            _storageFile = storageFile;

            BlockBuffer buffer = Read();

            FirstFreeBlock = BitConverter.ToUInt32(buffer.ReadBytes(4));

            if (FirstFreeBlock == 0)
            {
                FirstFreeBlock = DefaultFirstBlock;
            }
        }