/// <summary> /// Compress al inputFiles to destination sevenZip archive /// </summary> /// <param name="inputPath">Full path of a folder to be compressed</param> /// <param name="destinationFile">Path of where to create 7z archive</param> public static void Compress(string inputPath, string destinationFile) { SevenZipWorking wrk = new SevenZipWorking(); try { if (Directory.Exists(inputPath)) { wrk.CompressDirectory(inputPath, destinationFile); } if (File.Exists(inputPath)) { var file = new string[1] { inputPath }; wrk.CompressFiles(file, destinationFile); } } catch (Exception e) { log.Error(e.Message, e); throw; } finally { wrk = null; GC.Collect(); } }
/// <summary> /// Compress al inputFiles to destination sevenZip archive /// </summary> /// <param name="inputFiles">Array of full path of input files</param> /// <param name="destinationFile">Path of where to create 7z archive</param> public static void Compress(string[] inputFiles, string destinationFile) { SevenZipWorking wrk = new SevenZipWorking(); try { wrk.CompressFiles(inputFiles, destinationFile); } catch (Exception e) { log.Error(e.Message, e); throw; } finally { wrk = null; GC.Collect(); } }