日期:2014-05-18  浏览次数:21138 次

如何用ZLib .NET 解压缩多个文件
ZLib .NET 的demo中只有单个文件的解压缩,现在一个压缩包中有多个文件。不知道怎样解压缩。
还有这个文件是不能用Zip,Rar打开的。请教各位了!

------解决方案--------------------
DotNetZipLib 比较容易使用
到CodePlex.net 上搜索一下。第一个就是
该项目一个提供 3个DLL,其中有一个就是现成的封装好的文件操作的DLL。

该项目的性能也很不错。
------解决方案--------------------
使用dotnetzip,可以压缩解压缩,压缩完的也能用zip,rar打开。
http://dotnetzip.codeplex.com/
------解决方案--------------------
http://dotnetzip.codeplex.com/


using (ZipFile zip = new ZipFile())
 {
// add this map file into the "images" directory in the zip archive
zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images");
// add the report into a different directory in the archive
zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files");
zip.AddFile("ReadMe.txt");
zip.Save("MyZipFile.zip");
 }

Dim ZipToUnpack As String = "C1P3SML.zip"
Dim TargetDir As String = "C1P3SML"
Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir)
Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
AddHandler zip1.ExtractProgress, AddressOf MyExtractProgress
Dim e As ZipEntry
' here, we extract every entry, but we could extract
' based on entry name, size, date, etc.
For Each e In zip1
e.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently)
Next
End Using

以上是官方的案例,亦可以压缩文件夹,又可以解压缩文件夹

而且 dotnetzip (lib) 是Zip压缩算法的标准实现。

可以解压所有的基于标准zip算法的zip文件,支持多文件多目录文件夹的压缩和解压。

遍历即OK。