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 System.Data.Sql;
using System.Data.SqlClient;
using Compression;
using DeCompression;
namespace TextProcess
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
CompressAllFilesInADirectory();
}
private void CompressAllFilesInADirectory()
{
ZipClass zip = new ZipClass();
string[] args = new string[2];
args[0] = @"G:/Examples/SHAPE2/";//要压缩的目录
args[1] = @"G:/aaaa.zip";//压缩目标路径
zip.ZipFileFromDirectory(args[0], args[1], 6);
}
private void button2_Click(object sender, EventArgs e)
{
string[] FileProperties = new string[2];
FileProperties[0] = @"G:/aaaa.zip";//待解压的文件
FileProperties[1] = @"G:/123";//解压后放置的目标目录
UnZipClass.UnZip(FileProperties[0], FileProperties[1]);
}
}
}
一点说明:本程序已测试通过,存在问题:压缩后文件由winrar解压时,空目录无法解出并报错。
对于单个文件的压缩,在压缩类里面有,但本人并没有测试它。
分享到:
相关推荐
工程引用了“ICSharpCode.SharpZipLib.dll” 此文件在压缩包里,还有ZipHelper 类以及调用方法,放心下载,绝对能用。
C# 调用ICSharpCode.SharpZipLib.dll组件压缩解压zip vs2010开发,低版本的如果打不开项目,请参阅: http://www.cnblogs.com/boyliupan/archive/2010/06/22/1762726.html
程序通过在VS2005环境下,调用ICSharpCode.SharpZipLib组件,使用C#语言开发完成。 主要实现: 1、可无限配置压缩及解压缩任务,系统根据配置间隔时间循环读取任务; 2、压缩和解压过程中,可通过过滤条件分别压缩和...
压缩解压缩ZIP文件。调用时添加ICSharpCode.SharpZipLib.dll的引用。
本文实例讲述了C#实现的文件压缩和解压缩类。分享给大家供大家参考。具体分析如下: 这个C#代码包含了几个类,封装了文件压缩和解压缩常用的方法,包括直接通过代码进行压缩,也有调用winrar对文件进行压缩的 using...
C# zip文件压缩解压源工程库,版本:1.2.0。 若解压后出现中文名称乱码问题,可以在调用里面的方法前先执行: System.Text.Encoding encode = System.Text.Encoding.GetEncoding("gbk"); ZipStrings.CodePage = ...
一共给大家介绍了三段代码,一个是简单的解压缩单个zip文件,后一个可以解压批量的大量的但需要调用ICSharpCode.SharpZipLib.dll类了,最后一个比较实例可压缩也可以解压缩了分享给大家供大家参考。具体如下: 解...
程序通过在VS2005环境下,调用ICSharpCode.SharpZipLib组件,使用C#语言开发完成。 主要实现: 1、可无限配置压缩及解压缩任务,系统根据配置间隔时间循环读取任务; 2、压缩和解压过程中,可通过过滤条件分别压缩...
过程说明都在注释里,我们直接来看代码: 压缩: using System; using System.Collections.Generic; using System.Linq;... #region 压缩文件 /// /// 压缩文件 /// </summary> /// <param name=filesPath>
在C#中使用ICSharpCode.SharpZipLib.dll文件做文件压缩、解压过成功,当添加压缩、解压密码以后,使用老版本的ICSharpCode.SharpZipLib.dll,在调用inputStream.GetNextEntry()时会提示wrong local header signature...