博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Ionic.Zip实现压缩包

Posted on 2010-12-30 09:19  暗夜求真  阅读(3829)  评论(0)    收藏  举报
首先引入程序集:using Ionic.Zip;
直接使用
【例】打包一个文件夹

using (ZipFile zip = new ZipFile())
{
      zip.AddDirectory(folderPath); //folderPath文件夹的物理路径
      zip.Comment = "This zip was created at " + System.DateTime.Now.ToString("G");
      zip.Save(folderPath + ".rar"); //生成包的名称
}