文件名称:C#压缩解压缩文件、文件夹
文件大小:24KB
文件格式:CS
更新时间:2012-04-29 03:14:11
压缩,解压缩,C#
public static GZipResult Compress(string lpSourceFolder, string lpDestFolder, string zipFileName) { return Compress(lpSourceFolder, "*.*", SearchOption.AllDirectories, lpDestFolder, zipFileName, true); } public static GZipResult Compress(string lpSourceFolder, string searchPattern, SearchOption searchOption, string lpDestFolder, string zipFileName, bool deleteTempFile) { DirectoryInfo di = new DirectoryInfo(lpSourceFolder); FileInfo[] files = di.GetFiles("*.*", searchOption); return Compress(files, lpSourceFolder, lpDestFolder, zipFileName, deleteTempFile); } public static GZipResult Decompress(string lpSourceFolder, string lpDestFolder, string zipFileName) { return Decompress(lpSourceFolder, lpDestFolder, zipFileName, true, true, null, null, 4096); } public static GZipResult Decompress(string lpSourceFolder, string lpDestFolder, string zipFileName, bool writeFiles, string addExtension) { return Decompress(lpSourceFolder, lpDestFolder, zipFileName, true, writeFiles, addExtension, null, 4096); }