Exemple #1
0
        /// <summary>
        /// http://social.msdn.microsoft.com/Forums/en-US/os_binaryfile/thread/a5f9c653-40f5-4638-85d3-00c54607d984/
        /// Outlook 2003 MUST have a valid rgbFillLevel for write operations
        /// </summary>
        private void UpdateFillLevelMap()
        {
            int blocksToProcess     = Math.Min(m_dataTree.DataBlockCount, 8);
            HeapOnNodeHeader header = this.HeapHeader;

            for (int blockIndex = 0; blockIndex < blocksToProcess; blockIndex++)
            {
                if (m_blocksToUpdate.Contains(blockIndex))
                {
                    HeapOnNodeBlockData blockData = GetBlockData(blockIndex);
                    byte fillLevel = HeapOnNodeHelper.GetBlockFillLevel(blockData);
                    header.rgbFillLevel[blockIndex] = fillLevel;
                }
            }
            UpdateHeapHeader(header);

            for (int blockIndex = 8; blockIndex < m_dataTree.DataBlockCount; blockIndex += 128)
            {
                int blocksLeft = m_dataTree.DataBlockCount - blockIndex;
                blocksToProcess = Math.Min(blocksLeft, 128);
                HeapOnNodeBitmapHeader bitmapHeader = GetBitmapHeader(blockIndex);
                for (int blockOffset = 0; blockOffset < blocksToProcess; blockOffset++)
                {
                    if (m_blocksToUpdate.Contains(blockIndex + blockOffset))
                    {
                        HeapOnNodeBlockData blockData = GetBlockData(blockIndex + blockOffset);
                        byte fillLevel = HeapOnNodeHelper.GetBlockFillLevel(blockData);
                        bitmapHeader.rgbFillLevel[blockOffset] = fillLevel;
                    }
                }
                UpdateBitmapHeader(blockIndex, bitmapHeader);

                blocksLeft -= blocksToProcess;
            }
        }
 public void WriteBytes(byte[] buffer, int offset)
 {
     LittleEndianWriter.WriteUInt16(buffer, offset + 0, ibHnpm);
     ByteWriter.WriteByte(buffer, offset + 2, bSig);
     ByteWriter.WriteByte(buffer, offset + 3, (byte)bClientSig);
     LittleEndianWriter.WriteUInt32(buffer, offset + 4, hidUserRoot.Value);
     HeapOnNodeHelper.WriteFillLevelMap(buffer, offset + 8, rgbFillLevel);
 }
 public HeapOnNodeHeader(byte[] buffer, int offset)
 {
     ibHnpm       = LittleEndianConverter.ToUInt16(buffer, offset + 0);
     bSig         = ByteReader.ReadByte(buffer, offset + 2);
     bClientSig   = (OnHeapTypeName)ByteReader.ReadByte(buffer, offset + 3);
     hidUserRoot  = new HeapID(buffer, offset + 4);
     rgbFillLevel = HeapOnNodeHelper.ReadFillLevelMap(buffer, offset + 8, 8);
 }
 public void WriteBytes(byte[] buffer, int offset)
 {
     LittleEndianWriter.WriteUInt16(buffer, offset + 0, ibHnpm);
     HeapOnNodeHelper.WriteFillLevelMap(buffer, offset + 2, rgbFillLevel);
 }
 public HeapOnNodeBitmapHeader(byte[] buffer, int offset)
 {
     ibHnpm       = LittleEndianConverter.ToUInt16(buffer, offset + 0);
     rgbFillLevel = HeapOnNodeHelper.ReadFillLevelMap(buffer, offset + 2, 128);
 }