Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

another Compressed size mismatch between central header(nnn) and local header (0) exception

$
0
0

All:

Using v0.86.0.518 in a C# .Net4 project.

Trying to unzip a couple of different files throws the exception in the subject on the line:

Stream zipStream = zf.GetInputStream(entry);

I saw that this was apparently a problem in some cases but appears to have been fixed prior to this version of the lib?  Am I hitting a new case of this?

My code is very, very, very similar to the example code to unzip an existing file.  Relevant part is posted here.

FileStream ifs = File.OpenRead(archiveName);

                zf = new ZipFile(ifs);

                foreach (ZipEntry entry in zf)

                {

                    String entryFileName = entry.Name;

                    if (!entry.IsFile)

                    {

                        log.Debug("Skipping non-file in zip archive: " + entryFileName);

                        continue;

                    }

 

                    //AJW: A note from the dev says NOT to close the input stream?

                    Stream zipStream = zf.GetInputStream(entry);

                    //using (Stream zipStream = zf.GetInputStream(entry))

                    //{

                        String fullPathToEntry = Path.Combine(actualPath, entryFileName);

                        log.Debug("Writing Zipfile Part: " + fullPathToEntry);

                        using (FileStream ofs = File.Create(fullPathToEntry))

                        {

                            zipStream.CopyTo(ofs);

                        }

                    //}

                } //foreach file in the zip archive

What can I do to determine what the underlying issue is and fix?  If there is a debug-zip-reader for me to get additional header info from to help troubleshooting, just let me know where to d/l it.  The file unzips with Windows 8's built-in capability as well as with 7-Zip.  Just this code seems to be having trouble.

Appreciate any help you can provide!

-AJ


Viewing all articles
Browse latest Browse all 1764

Trending Articles