public BinaryStreamWriter(Stream stream, string container, string fileName, bool compress) { _stream = stream; _container = container; _fileName = fileName; _storageCounter = new StreamCounter(_stream); if (compress) { _zip = new GZipStream(_storageCounter, CompressionMode.Compress, false); _crypto = new CryptoStream(_zip, _sha1, CryptoStreamMode.Write); } else { _crypto = new CryptoStream(_storageCounter, _sha1, CryptoStreamMode.Write); } _actualCounter = new StreamCounter(_crypto); _compress = compress; }