not a valid zip file ??

Jun 9, 2009 at 2:45 PM

Hi everyone,

I'm trying to unzip a zip file which is created by an external application using the xceed zip library. I can succesfully unzip this zip file using winzip, windows own zip or using Delphi VCLZip component library, but I get a "not a valid zip file" when I want to unzip it using the following code :

using (ZipFile zip = ZipFile.Read(@"c:\\lvsM.zip")){

                foreach (ZipEntry file in zip)

                {

                    file.Extract(@"c:\\temp");

                }

            }

the zip file has a comment in it, I've used version 1.7.2.21. You can download the zip file from :

http://www.snapit.nl/lvsM.zip

thanks,

Rob

 

 

 

 

 

Coordinator
Jun 12, 2009 at 12:55 AM
Edited Jun 12, 2009 at 10:01 AM

Hi Rob,

that's the first time I ever saw a zip file formatted that way. I've updated DotNetZip so that it should be able to read it.  Download v1.7.2.23 to see if it works for you.

It's available now.

 

Jun 12, 2009 at 7:38 AM

Hi Cheeso,

thanks! It works now for a zip file without a password, but not for one with has a password set, I use the following code :

ZipFile zip = new ZipFile(@"c:\\lvs.zip");

            zip.Password = "password";

                foreach (ZipEntry file in zip)

{

         file.Extract(@"c:\\temp");

}

You can download the zip file with password from : http://www.snapit.nl/lvsp.zip

thanks,

Rob

 

 

 

 

Coordinator
Jun 12, 2009 at 10:43 AM

Boy, you just keep finding the problems.

You can use v1.7.2.23, if you set the password on each entry before extracting, like this:

    using (ZipFile zip = new ZipFile(zipToExtract))
    {
        foreach (ZipEntry file in zip)
        {
            file.Password = password;
            file.Extract(extractDir);
        }
    }

If you download v1.7.2.24, you can also use the code you had.

    using (ZipFile zip = new ZipFile(zipToExtract))
    {
        zip.Password = password;
        foreach (ZipEntry file in zip)
        {
            file.Extract(extractDir);
        }
    }

In this case, the extraction of the entry will use the password that you had set on the containing ZipFile.

Thanks for reporting the problem.

Jun 12, 2009 at 11:03 AM

Thanks Cheeso,

works perfect now! Sorry to be such a pain in the arse, but to ease the pain a bid, I have made a little donation.

Keep up the good work!

Regards,

Rob Segerink

 

Coordinator
Jun 12, 2009 at 11:06 AM

Hey Rob, thanks for the donation, and thanks for reporting the problems to make DotNetZip better!