Zip Compression decompression Project icsharpcode-sharpziplib-e012155

Source: Internet
Author: User

    1. You can download the latest version of SharpZipLib to http://www.icsharpcode.net/opensource/sharpziplib/, support zip, GZip, BZip2 and tar formats, the author's project code is as follows

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;//from the project icsharpcode-sharpziplib-e012155 generated 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 Fo Lderbrowserdialog ())
{
//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 ("Compression done! "," Information Hint: ", 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 + "\ \ New Folder", "");
Fz. Createzip ("123.zip", dlg. SelectedPath, True, "");
MessageBox.Show ("Unzip done! "," Information Hint: ", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
catch (Exception ex)
{
MessageBox.Show (ex. ToString ());
Throw
}
}
}
}

Project

Zip Compression decompression Project icsharpcode-sharpziplib-e012155

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.