一切工作正常..我可以解壓縮文件,從一個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