ARCed.Helpers.Compressor.CompressDirectory C# (CSharp) Method

CompressDirectory() public static method

Compresses a directory into a single archive
public static CompressDirectory ( string inDir, string outFile, bool notify = false ) : void
inDir string The path to the directory to compress
outFile string The archive name to create
notify bool Flag to notify user when finished
return void
        public static void CompressDirectory(string inDir, string outFile, bool notify = false)
        {
            SevenZipBase.SetLibraryPath(PathHelper.SevenZipLibrary);
            if (_compressor == null)
            {
                _compressor = new SevenZipCompressor
                {
                    ArchiveFormat = OutArchiveFormat.SevenZip,
                    CompressionLevel = CompressionLevel.Ultra,
                    CompressionMode = CompressionMode.Create
                };
            }
            _notify = notify;
            _compressor.TempFolderPath = Path.GetTempPath();
            _compressor.CompressDirectory(inDir, outFile);
            File.SetCreationTime(outFile, DateTime.Now);
        }