1. 大家可以到http://www.icsharpcode.net/opensource/sharpziplib/ 下载SharpZiplib的最新版本,支持Zip, GZip, BZip2 和Tar格式,本作者的项目代码如下

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ICSharpCode.SharpZipLib.Zip;//来自项目icsharpcode-SharpZipLib-e012155生成的ICSharpCode.SharpZipLib.dll

namespace TestZIP
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
try
{
using (FolderBrowserDialog dlg = new FolderBrowserDialog())
{
//dlg.CheckFileExists = true;
//dlg.CheckPathExists = true;
if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
{
if (dlg.SelectedPath != null)
{
FastZip fz = new FastZip();
fz.CreateZip("123.zip", dlg.SelectedPath, true, "");
MessageBox.Show("压缩完成!", "信息提示:", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
//throw;
}
}

private void button2_Click(object sender, EventArgs e)
{
try
{
using (OpenFileDialog dlg = new OpenFileDialog())
{
//dlg.CheckFileExists = true;
//dlg.CheckPathExists = true;
if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
{
if (dlg.FileName != null)
{
FastZip fz = new FastZip();
fz.ExtractZip(dlg.FileName, Application.StartupPath + "\\新建文件夹", "");
//fz.CreateZip("123.zip", dlg.SelectedPath, true, "");
MessageBox.Show("解压完成!", "信息提示:", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
//throw;
}
}
}
}

项目

zip压缩解压缩 项目icsharpcode-SharpZipLib-e012155的更多相关文章

  1. Qt之QuaZIP(zip压缩/解压缩)

    简述 QuaZIP是使用Qt/C++对ZLIB进行简单封装的用于压缩及解压缩ZIP的开源库.适用于多种平台,利用它可以很方便的将单个或多个文件打包为zip文件,且打包后的zip文件可以通过其它工具打开 ...

  2. Qt之zip压缩/解压缩(QuaZIP)

    摘要: 简述 QuaZIP是使用Qt/C++对ZLIB进行简单封装的用于压缩及解压缩ZIP的开源库.适用于多种平台,利用它可以很方便的将单个或多个文件打包为zip文件,且打包后的zip文件可以通过其它 ...

  3. AntZipUtils【基于Ant的Zip压缩解压缩工具类】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 Android 压缩解压zip文件一般分为两种方式: 基于JDK的Zip压缩工具类 该版本存在问题:压缩时如果目录或文件名含有中文, ...

  4. zip:命令行下zip压缩/解压缩

    在Ubuntu 18.04下验证,造冰箱的大熊猫@cnblogs 2019/6/6 序号 功能 命令行输入的命令 1 压缩单个文件 zip package.zip file 2 压缩多个文件 zip ...

  5. Zip压缩/解压缩(文件夹)

    #PS2.0压缩为.zip文件: $zip = "D:\audit_log\test.zip"New-Item $zip -ItemType file$shellApplicati ...

  6. centos8下gz,bz2,zip压缩解压缩

    for gz 1.制作压缩包 [root@192 mnt]# tar czf mydir.tar.gz mydir1/ 2.解压gz 压缩包 [root@192 mnt]# tar xvf mydir ...

  7. 基于ICSharpCode.SharpZipLib.Zip的压缩解压缩

    原文:基于ICSharpCode.SharpZipLib.Zip的压缩解压缩 今天记压缩解压缩的使用,是基于开源项目ICSharpCode.SharpZipLib.Zip的使用. 一.压缩: /// ...

  8. C#调用 ICSharpCode.SharpZipLib.Zip 实现解压缩功能公用类

    最近想用个解压缩功能 从网上找了找 加自己修改,个人感觉还是比较好用的,直接上代码如下 using System; using System.Linq; using System.IO; using ...

  9. 利用ICSharpCode.SharpZipLib.Zip进行文件压缩

    官网http://www.icsharpcode.net/ 支持文件和字符压缩. 创建全新的压缩包 第一步,创建压缩包 using ICSharpCode.SharpZipLib.Zip; ZipOu ...

随机推荐

  1. nyoj89 汉诺塔(二)

    题目网址 :http://acm.nyist.net/JudgeOnline/problem.php?pid=89 汉诺塔问题的经典结论: 把i个盘子从一个柱子整体移到另一个柱子最少需要步数是 2的i ...

  2. .net开发---自定义页面打印区域

    自定义页面打印区域 有3种办法: 办法一:将不需要打印的部位隐藏掉 Examp: <%-- (1)使用css样式,定义一个.noprint的class,将不打印的内容放入这个class内. -- ...

  3. C#常用正则验证

    #region Protected Property protected Regex rLetters { get { return new Regex("[a-zA-Z]{1,}" ...

  4. WebSocket使用教程 - 带完整实例

    http://my.oschina.net/u/1266171/blog/357488 什么是WebSocket?看过html5的同学都知道,WebSocket protocol 是HTML5一种新的 ...

  5. 动态加载js、css 代码

    一.原生js: /** * 加载js和css文件 * @param jsonData.path 前缀路径 * @param jsonData.url 需要加载的js路径或css路径 * @param ...

  6. 这样写JS的方式对吗?

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. 【失败】制作CentOS镜像

    1.在vmware上安装centos虚拟机,安装过程中设置CPU时,点选 虚拟化Intel VT-x~ 和 虚拟化CPU性能计数器,网络使用NAT模式 2.#mkdir /opt/iso,上传镜像(用 ...

  8. Leetcode Count Prime

    Description: Count the number of prime numbers less than a non-negative number, n Hint: The number n ...

  9. linux下用户以及用户组管理

    /etc/passwd ‘/etc/passwd’ 由 ‘:’ 分割成7个字段,每个字段的具体含义是: 1)用户名.用户名字符可以是大小写字母.数字.减号(不能出现在首位).点以及下划线,其他字符不合 ...

  10. jquery tab mouseover 特效

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...