博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
.Net文件压缩
阅读量:4648 次
发布时间:2019-06-09

本文共 1206 字,大约阅读时间需要 4 分钟。

NuGet中下载Ionic.Zip:

public static class ZipHelper    {        ///         /// 压缩文件        ///         /// 要压缩的文件夹地址        /// 压缩后的新文件        /// 
true成功,false失败
public static bool Zip(string FileFolder, string File) { try { using (ZipFile zip = new ZipFile()) { zip.CompressionLevel = Ionic.Zlib.CompressionLevel.Default; zip.AddDirectory(FileFolder); zip.Save(File); } return true; } catch (Exception) { return false; } } /// /// 解压文件 /// /// 要解压的文件 /// 压缩后的文件夹地址 ///
true成功,false失败
public static bool UnZip(string File, string FileFolder) { try { using (ZipFile zip = new ZipFile(File)) { zip.ExtractAll(FileFolder); } return true; } catch (Exception) { return false; } } }

 

转载于:https://www.cnblogs.com/MrZheng/p/8968166.html

你可能感兴趣的文章
sprintf 和strcpy 的差别
查看>>
JS中window.event事件使用详解
查看>>
ES6深入学习记录(一)class方法相关
查看>>
C语言对mysql数据库的操作
查看>>
INNO SETUP 获得命令行参数
查看>>
clientcontainerThrift Types
查看>>
链接全局变量再说BSS段的清理
查看>>
HTML5与CSS3权威指南之CSS3学习记录
查看>>
docker安装部署
查看>>
AVL树、splay树(伸展树)和红黑树比较
查看>>
多媒体音量条显示异常跳动
查看>>
运算符及题目(2017.1.8)
查看>>
React接入Sentry.js
查看>>
ssh自动分发密匙脚本样板
查看>>
转 小辉_Ray CORS(跨域资源共享)
查看>>
Linux安装postgresql
查看>>
MyBatis启动:MapperStatement创建
查看>>
【 全干货 】5 分钟带你看懂 Docker !
查看>>
[转]优化Flash性能
查看>>
popStar手机游戏机机对战程序
查看>>