I want to write a function that will explore a ZIP file and will find if it contains a .png file. Problem is, it should also explore contained zip files that might be within the parent zip (also from other zip files and folders).
as if it is not painful enough, the task must be done without extracting any of the zip files, parent or children.
I would like to write something like this (semi pseudo):
public bool findPng(zipPath) {
bool flag = false;
using (ZipArchive archive = ZipFile.OpenRead(zipPath))
{
foreach (ZipArchiveEntry entry in archive.Entries)
{
string s = entry.FullName;
if (s.EndsWith(".zip"))
{
/* recoursively calling findPng */
flag = findPng(s);
if (flag == true)
return true;
}
/* same as above with folders within the zip */
if((s.EndsWith(".png")
return true;
}
return false
}
}
Problem is, I can't find a way to explore inner zip files without extracting the file, which is a must prerequisite (to not extract the file).
Thanks in advance!