示例#1
0
        /// <summary>
        /// Sets the length of the stream.
        /// </summary>
        /// <param name="value">The new length</param>
        public override void SetLength(long value)
        {
            CheckFrozen();

            if (_diffStream != null)
            {
                _diffStream.SetLength(value);
            }
            else
            {
                _baseStream.SetLength(value);
            }
        }
示例#2
0
        /// <summary>
        /// Takes a snapshot of the current stream contents.
        /// </summary>
        public void Snapshot()
        {
            if (_diffStream != null)
            {
                throw new InvalidOperationException("Already have a snapshot");
            }

            _savedPosition = _position;

            _diffExtents = new List <StreamExtent>();
            _diffStream  = new SparseMemoryStream();
            _diffStream.SetLength(_baseStream.Length);
        }