using ICSharpCode.SharpZipLib.Core;
using ICSharpCode.SharpZipLib.Zip;
ZipOutputStream s = new ZipOutputStream(File.Create(@"c:\test.zip"));
byte[] buf = new byte[4096];
s.SetLevel(5);
ZipEntry e;
foreach (string fn in filenames)
{
e = new ZipEntry(fn);
s.PutNextEntry(e);
FileStream fs = File.OpenRead(fn);
StreamUtils.Copy(fs, s, buf);
fs.Close();
fs.Dispose();
Console.WriteLine("Adding " + fn);
}
s.Close();
s.Dispose();
No comments:
Post a Comment