/// <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="archivingtool">Archiving tool to use</param> /// <returns></returns> public static bool Decompress(string filename, ArchivingToolEnum archivingtool) { string _directory = System.IO.Path.GetDirectoryName(filename); _directory += (_directory.RLTrim().EndsWith("\\") ? "" : "\\") + System.IO.Path.GetFileNameWithoutExtension(filename); return(Decompress(filename, _directory, archivingtool)); }
/// <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></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></returns> 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); }
/// <summary> /// Creates a new instance of Archiver. /// </summary> /// <param name="path">Path of the file or directory to compress</param> /// <param name="archivingtool">Archiving tool use</param> /// <param name="processwindowstyle">Command prompt window visibility upon compression</param> /// <param name="archivingmethod">Archiving method to use</param> public Archiver(string path, ArchivingToolEnum archivingtool, ProcessWindowStyle processwindowstyle, ArchivingMethodEnum archivingmethod) { _path = path; _archivingtool = archivingtool; _processwindowstyle = processwindowstyle; _archivingmethod = archivingmethod; _archivedpath = ""; }
/// <summary> /// Creates a new instance of Archiver. /// </summary> /// <param name="path">Path of the file or directory to compress</param> /// <param name="archivingtool">Archiving tool use</param> /// <param name="processwindowstyle">Command prompt window visibility upon compression</param> public Archiver(string path, ArchivingToolEnum archivingtool, ProcessWindowStyle processwindowstyle) : this(path, archivingtool, processwindowstyle, ArchivingMethodEnum.Insert) { }
/// <summary> /// Creates a new instance of Archiver. /// </summary> /// <param name="path">Path of the file or directory to compress</param> /// <param name="archivingtool">Archiving tool use</param> public Archiver(string path, ArchivingToolEnum archivingtool) : this(path, archivingtool, ProcessWindowStyle.Hidden) { }
/// <summary> /// Creates a new instance of Archiver. /// </summary> /// <param name="path">Path of the file or directory to compress</param> /// <param name="archivingtool">Archiving tool use</param> /// <param name="processwindowstyle">Command prompt window visibility upon compression</param> public Archiver(string path, ArchivingToolEnum archivingtool, ProcessWindowStyle processwindowstyle) : this(path,archivingtool,processwindowstyle, ArchivingMethodEnum.Insert) { }
/// <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 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="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, ArchivingToolEnum archivingtool) { string _directory = System.IO.Path.GetDirectoryName(filename); _directory += (_directory.RLTrim().EndsWith("\\") ? "" : "\\") + System.IO.Path.GetFileNameWithoutExtension(filename); return Decompress(filename, _directory, archivingtool); }
/// <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; }