12345678910111213141516171819202122232425262728293031323334353637 |
- using System;
- using System.IO;
- using System.IO.Compression;
- namespace Vinno.FIS.Sonopost.Helpers
- {
- public class CompressHelper
- {
-
-
-
-
-
- public static void CompressFolder(string sourceFolderPath, string saveFilePath)
- {
- FileHelper.DeleteFile(saveFilePath);
- var directoryPath = Path.GetDirectoryName(saveFilePath);
- DirectoryHelper.CreateDirectory(directoryPath);
- ZipFile.CreateFromDirectory(sourceFolderPath, saveFilePath);
- }
-
-
-
-
-
- public static void DeCompressAll(string sourcePath, string destinionPath)
- {
- if (!File.Exists(sourcePath))
- {
- throw new ArgumentException($"Can't find decompress source path {sourcePath}");
- }
- DirectoryHelper.DeleteDirectory(destinionPath);
- ZipFile.ExtractToDirectory(sourcePath, destinionPath);
- }
- }
- }
|