Пример #1
0
 public void Dispose()
 {
     bw?.Close();
     bs?.Dispose();
     ls?.Dispose();
     ms?.Dispose();
 }
Пример #2
0
        // Called by the task when it is done with this writer, launches the async write
        internal void Flush()
        {
            OutputSize += _bufferPos;

            _writeTask = Task <uint> .Factory.StartNew(() => {
                if (Compress)
                {
                    _compressor.Write(_memBuffer, 0, (int)_bufferPos);
                    _compressor.Flush();
                    _compressor.Close();
                    _file.Flush();
                }
                else
                {
                    _file.Write(_memBuffer, 0, (int)_bufferPos);
                    _file.Flush();
                }

                var size = (uint)_file.Position;
                _compressor?.Dispose();
                _file?.Dispose();

                return(Compress ? size : 0);
            });
        }
Пример #3
0
 public void Dispose()
 {
     bw?.Close();
     bs?.Dispose();
     ls?.Dispose();
     ms?.Dispose();
     GC.SuppressFinalize(this);
 }