Exemple #1
0
        /// <summary>
        /// Compress (TAR/BZip2) an unencrypted FAES File.
        /// </summary>
        /// <param name="unencryptedFile">Unencrypted FAES File</param>
        /// <returns>Path of the unencrypted, TAR/BZip2 compressed file</returns>
        public string CompressFAESFile(FAES_File unencryptedFile)
        {
            FileAES_IntUtilities.CreateEncryptionFilePath(unencryptedFile, "TAR", out string tempRawPath, out _, out string tempOutputPath);

            TarWriterOptions wo = new TarWriterOptions(CompressionType.BZip2, true);

            using (Stream stream = File.OpenWrite(tempOutputPath))
                using (var writer = new TarWriter(stream, wo))
                {
                    writer.WriteAll(tempRawPath, "*", SearchOption.AllDirectories);
                }
            return(tempOutputPath);
        }