Exemple #1
0
 private static void AddFileToZip(ZipFile zip, FileInfo fileInfo, string fileName)
 {
     using (var stream = fileInfo.OpenRead())
     {
         var bytes = new byte[fileInfo.Length];
         stream.Read(bytes, 0, (int)fileInfo.Length);
         zip.AddBytes(bytes, fileName);
         stream.Close();
     }
 }
Exemple #2
0
        private static void AddFileToZip(ZipFile zip, string contents, string fileName)
        {
            var bytes = Encoding.ASCII.GetBytes(contents);

            zip.AddBytes(bytes, fileName);
        }
Exemple #3
0
 private static void AddFileToZip(ZipFile zip, string contents, string fileName)
 {
     var bytes = Encoding.ASCII.GetBytes(contents);
     zip.AddBytes(bytes, fileName);
 }
Exemple #4
0
 private static void AddFileToZip(ZipFile zip, FileInfo fileInfo, string fileName)
 {
     using (var stream = fileInfo.OpenRead())
     {
         var bytes = new byte[fileInfo.Length];
         stream.Read(bytes, 0, (int)fileInfo.Length);
         zip.AddBytes(bytes, fileName);
         stream.Close();
     }
 }