压缩自动压缩(压缩格式*.zip)代码
2008-10-31 17:14
190 查看
要实现自动压缩,需要ICSharpCode.SharpZipLib.dll 文件,连接地址:http://files.cnblogs.com/jiangguanghe/ICSharpCode.SharpZipLib.rar
然后就是操作这个DLL文件
先要导入空间:
Code
/// <summary>
/// Creates a Zip File.
/// </summary>
/// <param name="files">The Files to include in the Zip File.</param>
/// <param name="baseDir">The Base directory of the Files (it will be removed from their full path).</param>
/// <param name="destination">The destination Zip File.</param>
/// <param name="level">The compression level (0 min - 9 max).</param>
public static void Create(string[] files, string baseDir, string destination, int level)
{
Create(files, baseDir, File.Create(destination), level);
}
呵呵,一个压缩的功能就这样实现了
然后就是操作这个DLL文件
先要导入空间:
Code
/// <summary>
/// Creates a Zip File.
/// </summary>
/// <param name="files">The Files to include in the Zip File.</param>
/// <param name="baseDir">The Base directory of the Files (it will be removed from their full path).</param>
/// <param name="destination">The destination Zip File.</param>
/// <param name="level">The compression level (0 min - 9 max).</param>
public static void Create(string[] files, string baseDir, string destination, int level)
{
Create(files, baseDir, File.Create(destination), level);
}
呵呵,一个压缩的功能就这样实现了
相关文章推荐
- TIF转PDF格式以及相关压缩ZIP包(详细内容看代码)
- 把文件压缩成zip包的代码
- java实现zip,gzip,7z,zlib格式的压缩打包
- php实现zip压缩文件解压缩代码分享(简单易懂)
- bat 自动更新代码,编译,压缩asp.net程序
- 自动调整代码缩进格式
- eclipse自动调整代码格式
- java实现单个或多个文件的压缩、解压缩 支持zip、rar等格式
- zip&rar格式压缩包的解压缩
- Linux操作系统中,*.zip、*.tar、*.tar.gz、*.tar.bz2、*.tar.xz、*.jar、*.7z等格式的压缩与解压
- Linux操作系统中,*.zip、*.tar、*.tar.gz、*.tar.bz2、*.tar.xz、*.jar、*.7z等格式的压缩与解压 zip格式(转)
- 把文件压缩成zip包的代码
- MR 代码优化及Hive优化(Hive中的存储格式与压缩格式)
- 正确的 zip 压缩与解压代码
- WinRar 设置默认的压缩格式为zip
- java实现zip,gzip,7z,zlib格式的压缩打包
- "xxxx".zip:这个压缩文件格式未知或者数据已经被损坏,打不开压缩文件,总出现这个提示的解决方法
- unity3d 代码改变贴图压缩格式
- Linux oracle数据库自动备份自动压缩脚本代码