Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Error while unpacking legacy zip files

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #20111 |

    I have a simple zip file with a single tiff image that was compressed in WinZip 12 using the Legacy compression method (deflate).  Using the ZipReader to unpack this zip file results in an error:

    CompressionMethod 2 not supported by ZipReader.

    Stepping into the code shows that the single file contained in the zip file is unpacked correctly.  However when ReadItemLocalHeader() is called next, instead of getting null as expected, the above error is thrown.

     This is the C# code snippet I am using to unpack this file:

     public static List<string> GetAllFiles(this ZipReader zip, string targetPath)
            {
                List<string> returnList = new List<string>(); ;

                ZipItemLocalHeader zipItemLocalHeader = null;

                //Read the local headers until no more are found
                while ((zipItemLocalHeader = zip.ReadItemLocalHeader()) != null)
                {
                    byte[] buffer = new byte[102400];
                    int read = 0;

                    string finalPath = Path.Combine(targetPath, zipItemLocalHeader.FileName);
                    using (FileStream target = new FileStream(finalPath, FileMode.Create, FileAccess.Write))
                    {
                            //Read the item’s data until no more is left
                            while ((read = zip.ReadItemData(buffer, 0, buffer.Length)) > 0)
                            {
                                //Do something with the data in ‘buffer’
                                target.Write(buffer, 0, read);
                            }
                    }
                    returnList.Add(finalPath);
                }

                return returnList;
            }

     

    I have the zip file that shows this issue, however the forum will not allow me to attach it to this message.

     Joseph Johns

    Imported from legacy forums. Posted by Joseph (had 2046 views)

    Xceed Support
    Member
    Post count: 5658

    Hi, 

      it seems that WinZip did not compress the Data, since CompressionMethod 2 refers to Stored, which is not supported by Real-Time Zip. to confirm this, could you send your zip file to support@xceed.com refering this post please? 

    Thanks! 

    Imported from legacy forums. Posted by Chris [Xceed] (had 2645 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.