Archived Forum Post

Index of archived forum posts

Question:

iOS CkoTarProgress - How to use it correctly for untar?

Jun 20 '13 at 10:22

Hello everybody,

we are using the CkoTar in our iOS app. It works great. Now we want to implement the CkoTarProgress to be able to show progress. Documentation: The application should define a class that derives from CkoTarProgress and should implement member functions that override one or more virtual functions within the CkoTarProgress class.

So we implemented:

- (void)ProgressInfo: (NSString *)name
           value: (NSString *)value
{
 NSLog(@"UNTARCHILKATPROGRESS PROGRESSINFO: %@ VALUE: %@", name, value);
}
- (void)NextTarFile: (NSString *)fileName
       fileSize: (NSNumber *)fileSize
   bIsDirectory: (BOOL)bIsDirectory
           skip: (BOOL *)skip
{
 NSLog(@"UNTARCHILKATPROGRESS NEXTTARFILE: %@ FILESIZE: %@ BISDIRECTORY: %c SKIP: %s", fileName, fileSize, bIsDirectory, skip);
}

Problem now is, that only "NextTarFile" is called, but "ProgressInfo" is never called. Next problem is: How do I get the number of files included in the tar file? How can I display a progress when not knowing, how many files are included. I only get the possibility to react on the next tar file without knowing, how many files are included...

Does anybody know, how to do a progress bar with CkoTarProgress?

Thanks for your help!

Greetings, Klaus.


Accepted Answer

In future versions of Chilkat, event callbacks will be standardized so that each new component does not have it's own special callbacks. For example, the NextTarFile callback could've just as well been a ProgressInfo callback with name = "NextTarFile" and the value equal to the path.

At the moment, there are no ProgressInfo callbacks for the Tar class. It's possible that things may be added in the future on an as-needed basis.

The following three event callbacks will be standard across most classes:

PercentDone(pctDone, abortFlag)
AbortCheck(abortFlag)
ProgressInfo(name,value)

PercentDone is only called in places where it makes sense, such as for a file upload, downloading email, writing a zip, etc.


Answer

Please check to see if this new build resolves the problem:

http://www.chilkatsoft.com/preRelease/Chilkat-9.4.1-IOS-6.1.zip


Answer

Hi Chilkat!

Thanks for the quick response. In the new build, the behavior is the same as in the official build Chilkat-9.4.0-IOS-6.0.zip: The Method "ProgressInfo" is never called. The "NextTarFile" is correctly called, but this was called correctly in the official build too.

What should the method "ProgressInfo" be? Should it be called like "NextTarFile"? Then something is wrong, 'cause "ProgressInfo" is never called... Or has any flag or parameter to be set that "ProgressInfo" would be called?

Workaround I've implemented yesterday: Before calling the "Untar"-Method I save the size of the whole tar file. In each call of "NextTarFile" a second variable summarizes the "fileSize" of "NextTarFile". Then I calculate the percentage done and can give it back.

Greetings disy.


Answer

Hi Chilkat,

thank you for this detailed answer. I look forward to future versions and thank you for your quick replies! Keep it up!

Greetings, disy.