im using ionic library to read zip file in c#
i have many zip files in one zip file,i read the zip file but i can't read the subZip files
i have made this portion of code here:
foreach (var sessionEntry in subjectSessions.Entries)
{
using (MemoryStream entryStream = new MemoryStream())
{
sessionEntry.OpenReader().CopyTo(entryStream);
ZipFile sessionZIPFile = ZipFile.Read(entryStream);
}
}
but it's not working,it always gives me the same exception
Cannot read that as a ZipFile,Ionic.Zip.BadReadException: Could not read block - no data! (position 0x00000000)
i have tried calling extract on sessionEntry object,didn't work too
how can i read the subZip files?
thanks in advance
After you copied the extracted content to the stream and before you read it, you need to manually reset the stream position, like so
stream.Seek(0, SeekOrigin.Begin);