在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
利用7z.dll进行压缩和解压代码如下: using System; using SevenZip.Sdk; using SevenZip.Sdk.Compression; using SevenZip; using System.IO; namespace DCRM.Common { public class CompressorHelper { public static void Compressor(string p_7zdllPath,string compressDicrectoryName) { SevenZipCompressor.SetLibraryPath(p_7zdllPath); SevenZipCompressor tmp = new SevenZipCompressor(); string fileName=Path.GetDirectoryName(compressDicrectoryName)+".7z"; tmp.CompressDirectory(compressDicrectoryName,fileName); } public static void UnCompressor(string p_7zdllPath,string compressFilesFullName,string des) { SevenZipExtractor.SetLibraryPath(p_7zdllPath); using (SevenZipExtractor tmp = new SevenZipExtractor(compressFilesFullName)) { for (int i = 0; i < tmp.ArchiveFileData.Count; i++) { tmp.ExtractFiles(des, tmp.ArchiveFileData[i].Index); } } } } }
|
请发表评论