private void ArchiverSample01() { #region "Archiver 01" Archiver _archiver = new Archiver(Application.StartupPath + "\\my folder to archive", ArchivingToolEnum.SevenZip, ProcessWindowStyle.Hidden); System.IO.FileInfo _archivefile = _archiver.Archive(); #endregion }
/// <summary> /// Performs file extraction from a compressed file into the specified destination folder using the selected archiving tool. /// </summary> /// <param name="filename">Compressed file's filename</param> /// <param name="destination">Destination path for the extracted file(s)</param> /// <param name="archivingtool">Archiving tool to use</param> /// <returns>A boolean value that determines whether file extraction was successful or not.</returns> public static bool Decompress(string filename, string destination, ArchivingToolEnum archivingtool) { bool _decompressed = false; Archiver _archiver = new Archiver(filename, archivingtool); _decompressed = _archiver.Extract(destination); _archiver.Dispose(); return _decompressed; }
/// <summary> /// Performs file compression using selected archiving tool, file(s) will be inserted directly to the archive file. /// </summary> /// <param name="path">File / directory path to archive</param> /// <param name="archivingtool">Archiving tool to use</param> /// <returns>A System.IO.FileInfo object that contains the archived output file information. Returns nothing if error has been encountered during archive routines.</returns> /// <example> /// <code source="..\Development.Materia\Examples\Example.cs" region="Archiver 05" language="cs" /> /// <code source="..\Development.Materia\Development.Materia.VBExamples\Development.Materia.VBExamples\Example.vb" region="Archiver 05" language="vbnet" /> /// </example> public static FileInfo CompressInsert(string path, ArchivingToolEnum archivingtool) { FileInfo _file = null; Archiver _archiver = new Archiver(path, archivingtool); _archiver.ArchivingMethod = ArchivingMethodEnum.Insert; _file = _archiver.Archive(); _archiver.Dispose(); return _file; }