I am attempting to recursively parse through a zip folder and any zip folders inside it to collect files using the following code:
private IList<IFile> _getFilesFromZip(ZipArchive zipArchive)
{
var returnFiles = new List<IFile>();
foreach (var zippedFile in zipArchive.Entries)
{
var name = zippedFile.Name;
var type = Path.GetExtension(zippedFile.Name).Replace(".", "");
if (type == "zip")
{
var innerZipArchive = new ZipArchive(zippedFile.Open(), ZipArchiveMode.Read);
returnFiles.AddRange(_getConversionFilesFromZip(zipArchive));
}
else
{ ...
var innerZipArchive = new ZipArchive(zippedFile.Open(), ZipArchiveMode.Read);
Throws a StackOverflow exception no matter how small the files.
How can I create a zipArchive from the ZipArchiveEntry of the first ZipArchive?