Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET How to solve Incompatibility with other compression methods?

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

    Hi,

    We get an exception when using Xceed Zip RT .Net to open zips created by IP*Works! Zip ver. 6.

    See the full error message and code below.

     Our questions:

    1) How to know which compression method corresponds to each number in the error message?

    What compression methods correspond to the 12336 and 22796 codes in the error message (see below) ?

    2) How to make the Xceed ZipReader class use a custom or external reader when it finds an unknown compression method?

    Code and the full exception message:

            public void UnzipFiles(string zipFileName, string destDir, out string log)
            {
                log = string.Empty;

                //The source Zip archive
                using (FileStream fileStream1 = new FileStream(zipFileName,
                   FileMode.Open, FileAccess.Read))
                {
                    //Must seek to the beginning of the stream before reading.
                    fileStream1.Seek(0, SeekOrigin.Begin);

                    //Create the ZipReader around the stream.
                    Xceed.Zip.ReaderWriter.ZipReader zipReader1 = new
                      Xceed.Zip.ReaderWriter.ZipReader(fileStream1);

                    zipReader1.InvalidPassword += new EventHandler<ZipReaderInvalidPasswordEventArgs>(zipReader_InvalidPassword);               

                    ZipItemLocalHeader zipItemLocalHeader = null;
                    //Read the local headers until no more are found

                    /////////// next line throws the exception!
      //               ZipReader exception
      //               first :            CompressionMethod 12336 not supported by ZipReader.
      //               and other times:   CompressionMethod 22796 not supported by ZipReader.

                    while ((zipItemLocalHeader = zipReader1.ReadItemLocalHeader()) != null)
                    {
                        // sometimes this loop iterates once too often with an “\0\0\0\0” file name
                        // that doesn’t exist in the zip archive –
                        // ignore this fake file name
                        if (zipItemLocalHeader.FileName.StartsWith((string)(new string(‘\0’, 1))) &&
                            ! zipItemLocalHeader.IsFolder)
                            continue;
                        log += “\n\r\n file in zip: ” + zipItemLocalHeader.FileName;
                        string extratedFileFullName = destDir + @”\\” + zipItemLocalHeader.FileName;
                        FileStream extractedFileStream = new FileStream(extratedFileFullName,
                            FileMode.Create);

                        byte[] buffer = new byte[8192];
                        int read = 0;

                        //Read the item’s data until no more is left
                        while ((read = zipReader1.ReadItemData(buffer, 0, buffer.Length)) > 0)
                        {
                            //Do something with the data in ‘buffer’
                            extractedFileStream.Write(buffer, 0, buffer.Length);
                        }
                        extractedFileStream.Flush();
                        extractedFileStream.Close();
                    }
                }
            }

    Thanks,

    Ofer

    Imported from legacy forums. Posted by O (had 2038 views)

    User (Old forums)
    Member
    Post count: 23064

    1) This means the zip file format of this file is different than the PKWare standard. Can you send us a sample zip file and mention this forum post? This will help us identify what can be wrong with the component.

     

    2) You cannot use an external reader with our component.

     

    Imported from legacy forums. Posted by André (had 1418 views)

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