How to read zip entries of a zip file inside another zip file, ad nauseam for c# or vb.net
<p>While there is a response to this question using the java libraries (<a href="https://stackoverflow.com/questions/11287486/read-a-zip-file-inside-zip-file">Read a zip file inside zip file</a>), I cannot find an example of this anywhere in c# or vb.net.</p>

<p>What I have to do for a client is use the .NET 4.5 ZipArchive library to traverse zip files for specific entries.  Before anyone asks, the client refuses to allow me to use dotnetzip, because his chief architect has experience with that library and says it is too buggy to be used in a real application.  He's pointed out a couple to me, and it doesn't matter what I think anyway!</p>

<p>If I have a zip file, that itself contains other zip files, I need a way of opening the inner zip files, and read the entries for that zip file.  Eventually I will also have to actually open the zip entry for the zip in a zip, but for now I just have to be able to get at the zipentries of an inner zip file.</p>

<p>Here's what I have so far:</p>

<pre><code>public string PassThruZipFilter(string[] sfilters, string sfile, bool buseregexp, bool bignorecase, List&lt;ZipArchiveZipFile&gt; alzips)
{
  bool bpassed = true;
  bool bfound = false;
  bool berror = false;
  string spassed = "";
  int ifile = 0;
  try
  {
    ZipArchive oarchive = null; ;
    int izipfiles = 0;
    if (alzips.Count == 0)
    {
      oarchive = ZipFile.OpenRead(sfile);
      izipfiles = oarchive.Entries.Count;
    }
    else
    {
      //need to dig into zipfile n times in alzips[i] where n = alzips.Count
      oarchive = GetNthZipFileEntries(alzips, sfile); &lt;------ NEED TO CREATE THIS FUNCTION!
      izipfiles = oarchive.Entries.Count;
    }
    while (((ifile &lt; izipfiles) &amp; (bfound == false)))
    {
      string sfilename = "";
      sfilename = oarchive.Entries[ifile].Name;
      //need to take into account zip files that contain zip files...
      bfound = PassThruFilter(sfilters, sfilename, buseregexp, bignorecase);
      if ((bfound == false) &amp;&amp; (IsZipFile(sfilename)))
      {
        //add this to the zip stack
        ZipArchiveZipFile ozazp = new ZipArchiveZipFile(alzips.Count, sfile, sfilename);
        alzips.Add(ozazp);
        spassed = PassThruZipFilter(sfilters, sfilename, buseregexp, bignorecase, alzips);
        if (spassed.Equals(sISTRUE))
        {
          bfound = true;
        }
        else
        {
          if (spassed.Equals(sISFALSE))
          {
            bfound = false;
          }
          else
          {
            bfound = false;
            berror = true;
          }
        }
      }
      ifile += 1;
    }
  }
  catch (Exception oziperror)
  {
    berror = true;
    spassed = oziperror.Message;
  }
  if ((bfound == false))
  {
    bpassed = false;
  }
  else
  {
    bpassed = true;
  }
  if (berror == false)
  {
    spassed = bpassed.ToString();
  }
  return (spassed);
}
</code></pre>

<p>So the function I have to create is 'GetNthZipFileEntries(List, sfile)', where the ZipFileZipEntry is just a structure that contains an int index, string szipfile, string szipentry.</p>

<p>I cannot figure out how read a zip file inside a zip file (or G-d forbid, a zip file inside a zip file inside a zip file...the 'PassThruZipFilter is a function <strong>inside</strong> a recursive function) using .NET 4.5.  Obviously microsoft does it, because you can open up a zip file inside a zip file in explorer.  Many thanks for anyone that can help.</p>

<p><strong>So, I truly need your help on how to open zip files inside of zip files in .NET 4.5 without writing to the disk</strong>.  There are NO examples on the web I can find for this specific purpose.  I can find tons of examples for reading zip file entries, but that doesn't help. <strong>To be clear, I cannot use a hard disk to write anything</strong>.  I can use a memory stream, but that is the extent of what I can do.  <strong>I cannot use the dotnetzip library</strong>, so any comments using that won't help, but of course I'm thankful for any help at all.  I could use another library like the Sharp zip libs, but I'd have to convince the client that it is impossible with .NET 4.5.</p>