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(); } }
private static void AddFileToZip(ZipFile zip, string contents, string fileName) { var bytes = Encoding.ASCII.GetBytes(contents); zip.AddBytes(bytes, fileName); }