示例#1
0
        private void Flush()
        {
            if (m_currentPhysicalBlock < 0)
            {
                return;
            }
            WriteBlockCount++;

            byte *data = (byte *)m_memory.Address + m_blockSize - 32;

            data[0] = (byte)BlockType.DataBlock;
            data[1] = 0;
            *(ushort *)(data + 2) = m_subFile.FileIdNumber;
            *(uint *)(data + 4)   = m_currentBlockIndex;
            *(uint *)(data + 8)   = m_header.SnapshotSequenceNumber;
            data[32 - 4]          = Footer.ChecksumMustBeRecomputed;

            Footer.ComputeChecksumAndClearFooter(m_memory.Address, m_blockSize, m_blockSize);
            Marshal.Copy(m_memory.Address, m_buffer, 0, m_blockSize);
            m_stream.Position = m_currentPhysicalBlock * m_blockSize;
            m_stream.Write(m_buffer, 0, m_blockSize);
            m_currentPhysicalBlock = -1;
        }