SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

ZipException: Version required to extract this entry not supported (788) and proposed fix

Last post 08-09-2016 7:30 PM by jwichlen. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-22-2014 3:27 AM

    ZipException: Version required to extract this entry not supported (788) and proposed fix

    When using SharpZipLib to unzip some apk files like Facebook, it throws an exception "Version required to extract this entry not supported (788)". It is the same problem as described in a previous article "Library cannot extract this entry. Version required is XXX. Possible Fix", but issued by a different function ZipFile.TestLocalHeader.

    I have checked the latest release of SharpZipLib, which fixed the issue raised in that article but not this one. So I fixed it by replacing line "short extractVersion = ( short )ReadLEUshort();" with "short extractVersion = ( short )ReadLEUshort() & 0x00ff;" in function TestLocalHeader of ZipFile.cs.

    Would you take a look at this issue and see if you will fix it in the next release? Thanks.

  • 07-23-2014 2:42 AM In reply to

    Re: ZipException: Version required to extract this entry not supported (788) and proposed fix

    I think we have a bug tracker entry for that; will check. Thanks for the report.

  • 08-09-2016 7:30 PM In reply to

    Re: ZipException: Version required to extract this entry not supported (788) and proposed fix

    I recently started getting this error when I download a zip file from a vendor.  The process had been working flawlessly for months prior to this week.  The zip file only contains 1 file.  The version of ICSharpCode.SharpZipLib.dll is 0.86.0.518.  And the following function is what I use (below).  I have read most of the posts related to this error, but the posts are @ 2-6 yrs old and I don't know if there are any more recent solutions and/or versions of the dll that address this error.  Please advise.  Thank you.

        public void Unzip(string filePath, string zipFile, string dataFiles, ProcessXML procXml)
        {
            FileStream fileStreamIn = new FileStream (filePath + zipFile, FileMode.Open, FileAccess.Read);

            ZipInputStream s = new ZipInputStream(fileStreamIn);

            ZipEntry theEntry;
            string fileName = string.Empty;
            string fileExtension = string.Empty;
            string fileSize = string.Empty;

            FileStream streamWriter = null;
            try
            {
                theEntry = s.GetNextEntry();
                while (theEntry != null)
                {
                    fileName = Path.GetFileName(theEntry.Name);

                    if (!string.IsNullOrEmpty(fileName) && dataFiles.IndexOf(fileName) >= 0)
                    {
                        //Common.log.RecordMessage(AppLogging.MessageCode.MessageOnly, "Unzipping " + fileName);
                        streamWriter = File.Create(filePath + "\\" + fileName);
                        int size = 2048;
                        byte[ data = new byte[2048];

                        do
                        {
                            size = s.Read(data, 0, data.Length);
                            streamWriter.Write(data, 0, size);
                        } while (size > 0);

                        fileSize = Convert.ToDecimal(streamWriter.Length / 1024).ToString() + " KB";

                        streamWriter.Close();
                        //Add custom code here to add each file to the DB, etc.
                    }
                    theEntry = theEntry = s.GetNextEntry();
                }
            }
            catch (Exception ex)
            {
                EDSCommon.WriteException(_procName, ex);
                if (File.Exists(filePath + "\\" + dataFiles)) {
                    streamWriter.Close();
                    File.Delete(filePath + "\\" + dataFiles);
                }
                //EDSCommon.SendError(procXml, _procName, ex);
            }

            s.Close();
        }

Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.