I'm getting an exception unzipping a file ("Wrong Central Directory signature") from the ZipFile class. The exception occurs in the function ReadEntries. I'm constructing the class using a stream...
FileStream fs = File.OpenRead(Program.CMSZip);
ZipFile zf = new ZipFile(fs);
The code in ReadEntries where it bombs follows:
for (ulong i = 0; i < entriesForThisDisk; i++) {
if (ReadLEUint() != ZipConstants.CentralHeaderSignature) {
throw new ZipException("Wrong Central Directory signature");
}
ReadLEUnit is returning 5033012. The value of ZipConstants.CentralHeaderSignature is 3363928. They don't match and hence the exception is thrown.
I've been using this code to unzip a file we download monthly for quite some time (2 years?) without a problem. And 7Zip unzips the file without a problem, so I have no idea what is causing the issue. The file is large (547,683KB), but these files are always large and the zip library hasn't had problems with them in the past.
Anyone have any clues as to what might be happening?
Thanks in advance,
Bob