一切工作正常..我可以解压缩文件,从一个Zip/RAR ..档案。 问题是,如何解压文件,那在目录?从目录中解压一个文件
解压缩文件直接我使用(SharpZipLib):
FastZip fastZip = new FastZip();
fastZip.ExtractZip(source, targetDirectory, null);
using (var fs = new FileStream(source, FileMode.Open, FileAccess.Read))
using (var zf = new ZipFile(fs))
{
var ze = zf.GetEntry("toc.out");
if (ze == null)
{
throw new ArgumentException("toc.out", "not found in Zip");
}
using (var s = zf.GetInputStream(ze))
{
// do something with ZipInputStream
}
}
}
或用DotNetZip/ZipDotNet:
using (ZipFile zip = ZipFile.Read(source))
{
ZipEntry e = zip["toc.out"];
e.Extract();
}
那不是工作,导致HES搜索在根文件.. 而且我也不会这样做:DirectoryName/toc.out
我该如何做到这一点?没有参数,我可以在其中包含所有子文件夹 - 用于搜索或类似的东西? :(
[?使用SharpZipLib解压缩特定文件]中可能重复(http://stackoverflow.com/questions/328343/using-sharpziplib-to-unzip-specific-files) – samjudson
不。我看到这个,他们直接解压缩文件,像我一样没有目录..... – eMi