Beispiel #1
0
        private HeapOnNodeBlockData GetBlockDataUnbuffered(int blockIndex)
        {
            DataBlock block = DataTree.GetDataBlock(blockIndex);

            if (blockIndex == 0)
            {
                HeapOnNodeFirstBlockData heapFirstBlock = new HeapOnNodeFirstBlockData(block.Data);
                return(heapFirstBlock);
            }
            else
            {
                // HNBITMAPHDR appears at data block 8 (zero-based) and thereafter every 128 blocks.
                // (that is, data block 8, data block 136, data block 264, and so on).
                if (blockIndex % 128 == 8)
                {
                    HeapOnNodeBitmapBlockData bitmapBlock = new HeapOnNodeBitmapBlockData(block.Data);
                    return(bitmapBlock);
                }
                else
                {
                    HeapOnNodePageBlockData pageBlock = new HeapOnNodePageBlockData(block.Data);
                    return(pageBlock);
                }
            }
        }
Beispiel #2
0
        public void UpdateHeapHeader(HeapOnNodeHeader header)
        {
            HeapOnNodeFirstBlockData blockData = (HeapOnNodeFirstBlockData)GetBlockData(0);

            blockData.HeapHeader = header;
            UpdateBuffer(0, blockData);
        }
Beispiel #3
0
        public static HeapOnNode CreateNewHeap(PSTFile file)
        {
            DataTree dataTree = new DataTree(file);
            HeapOnNodeFirstBlockData blockData = new HeapOnNodeFirstBlockData();

            dataTree.UpdateDataBlock(0, blockData.GetBytes());
            // now the data tree contains a valid HN
            HeapOnNode heap = new HeapOnNode(dataTree);

            return(heap);
        }