Exemplo n.º 1
0
        public void RollbackTransaction()
        {
            if (!inTransaction)
            {
                throw new InvalidOperationException("Stream is not in transaction");
            }

            WriteBufferedStream bufferedStream = stream as WriteBufferedStream;

            if (bufferedStream != null)
            {
                bufferedStream.DiscardBufferedData();
            }

            inTransaction = false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the stream
        /// </summary>
        /// <param name="stream">Stream to wrap</param>
        public MasterStream(Stream stream, bool bufferData)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            if (bufferData)
            {
                bufferStream = new WriteBufferedStream(stream, 512);
                this.stream  = bufferStream;
            }
            else
            {
                this.stream = stream;
            }
        }