我試圖解壓縮另一個zip內的zip文件。當我嘗試獲得第二個zip的FileStream
時,它給我一個錯誤。我如何查看內容? 這是我的代碼:使用SharpZipLib解壓縮另一個zip內的zip文件
try
{
FileStream fs = File.OpenRead(location);
ZipFile zipArchive = new ZipFile(fs);
foreach (ZipEntry elementInsideZip in zipArchive)
{
String ZipArchiveName = elementInsideZip.Name;
if (ZipArchiveName.Equals("MyZMLFile.xml"))
{
// I NEED XML FILES
Stream zipStream = zipArchive.GetInputStream(elementInsideZip);
doc.Load(zipStream);
break;
}
// HERE!! I FOUND ZIP FILE
else if (ZipArchiveName.Contains(".zip"))
{
// I NEED XML FILES INSIDE THIS ZIP
string filePath2 = System.IO.Path.GetFullPath(ZipArchiveName);
ZipFile zipArchive2 = null;
FileStream fs2 = File.OpenRead(filePath2);// HERE I GET ERROR: Could not find a part of the path
zipArchive2 = new ZipFile(fs2);
}
}
}