Example #1
0
        public static void ZipFile(string fileFrom, string zipTo)
        {
            using (var writer = new Alienlab.Zip.ZipFile(zipTo, Encoding.UTF8))
            {
                string entryName = Path.GetFileName(fileFrom);

                writer.AddItem(fileFrom, Path.GetDirectoryName(entryName));
                writer.Save(zipTo);
            }
        }
Example #2
0
 public static void ZipAll(string pathFrom, string zipTo)
 {
     using (var writer = new Alienlab.Zip.ZipFile(zipTo, Encoding.UTF8))
     {
         var allFiles = Directory.GetFiles(pathFrom, "*", SearchOption.AllDirectories);
         foreach (var file in allFiles)
         {
             string entryName = file.Substring(pathFrom.Length);
             writer.AddItem(file, Path.GetDirectoryName(entryName));
         }
         writer.Save(zipTo);
     }
 }