zoukankan      html  css  js  c++  java
  • zip压缩解压缩 项目icsharpcode-SharpZipLib-e012155

    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;
    }
    }
    }
    }

    项目

  • 相关阅读:
    《全职高手》的全部职业和职业技能(最新版)
    博客园样式美化
    科幻电影免费百度云分享(Scince-fiction cloud share)
    阅读须知
    Website's Game source code
    #P2010 回文日期 的题解
    #P1909 买铅笔 的题解
    #P4770 [NOI2018]你的名字 的题解
    #1074 骑士问题 的题解
    [C++基本语法:从菜鸟变成大佬系列,就像1,2,3那么简单](七):C++的修饰符
  • 原文地址:https://www.cnblogs.com/1175429393wljblog/p/5347316.html
Copyright © 2011-2022 走看看