/// <summary> /// Deflate (compress) an archive /// </summary> /// /// <param name="DirectoryPath">The directory path to the files to be processed</param> /// <param name="OutStream">The stream receiving the compressed and encrypted archive</param> public void Deflate(string DirectoryPath, Stream OutStream) { if (!m_isInitialized) { throw new CryptoProcessingException("CompressionCipher:Compress", "The class is not be Initialized!", new ArgumentException()); } if (!DirectoryTools.Exists(DirectoryPath)) { throw new CryptoProcessingException("CompressionCipher:Deflate", "The directory does not exist!", new ArgumentException()); } if (DirectoryTools.FileCount(DirectoryPath) < 1) { throw new CryptoProcessingException("CompressionCipher:Deflate", "There are no files in this directory!", new ArgumentException()); } // compress MemoryStream inStream = m_cmpEngine.CompressArchive(DirectoryPath); inStream.Seek(0, SeekOrigin.Begin); // encrypt output base.Write(inStream, OutStream); OutStream.Seek(0, SeekOrigin.Begin); }