This project is read-only.

zipEntry.Extract : Cannot read that as a zipfile

Mar 25, 2014 at 11:12 AM
This is my code:
using (var zipFile = String.IsNullOrEmpty(FileName) ? ZipFile.Read((mStream)) : ZipFile.Read(FileName))
                ePubActions eas = new ePubActions(zipFile);

                foreach (EpubContentItem item in eas.epubContentItems)
                    //Every zipEntry needs te be extracted to a stream:
                    using (MemoryStream stream = new MemoryStream())
                        ZipEntry ze = zipFile[contentItem];

... Do some stuff with the extracted file

                        zipFile.AddEntry(contentItem, newStream);
                        MemoryStream tempStream = new MemoryStream();
Now, when I reach the Extract method for the second time, a System.ServiceModel.FaultException`1' was thrown with the message "Cannot read that as a zipfile"

This only occurs when the zipfile is read from a stream and when I read the zipfile from an actual file.
Mar 25, 2014 at 11:46 AM
Found the solution myself...

I grabbed the save-part for the zipfile and took it out of the for-each loop