Archived Forum Post

Index of archived forum posts

Question:

Asynchronous Open Zip claims password to be incorrect?

Nov 03 '15 at 19:32

I have tried to use the VerifyPassword and Unzip methods of Chilkat_9_5_0.ZIP in our Visual FoxPro 9 application.

After opening the file via OpenZip everything works perfect.

Using OpenZipAsync both methods claim the correct password to be incorrect.

Exists a scenario where it is necessary to use the asynchronous method?

I have tried to open several big files with OpenZip and did not notice any delay…


Answer

Chilkat will always contains a corresponding Async method for any method that could possibly have event callbacks. (Some languages don't support event callbacks, but the deciding factor as to whether a method existing in Async form is determined by whether callbacks existing (in general) for that method.) In some cases, callbacks might exist even for methods that don't usually take a lot of time. OpenZip is one such case.

However, there are cases where OpenZip could take some time. Specifically, for zips that contain a huge number of entries. The OpenZip method "walks" the central directory and does some quick sanity checking. The size of the .zip does not cause a slowdown in OpenZip -- its the number of entries. Opening an 8GB zip that contains 20 entries would be very quick, whereas opening an 80MB zip with 50,000 entries might be a bit slower.

The Async form of the method takes the input arguments and packs them into the Task object that is returned. When Task.Run is called, the intended method is called with the input args saved from the original Async call. If something was wrong with this mechanism, one would expect the problem to appear across-the-board in all Async method calls. Therefore, unless other Async calls have similar problems (and I think this is unlikely since I haven't heard of any problems regarding it), then it must be something else. If the OpenZipAsync fails (after the task is run), then examine the contents of the Task.ResultErrorText property.