NSObject(MPQArchiveDelegate)


Discussion

The MPQArchiveDelegate delegate is used to report on the activity and status of an MPQ archive and provide access management features to clients pertaining to all the framework operations, such as adding, deleting, opening, etc.

Methods

-archive:didAddFile:
This method is called immediately after the framework compressed a file into an archive.
-archive:didDeleteFile:
This method is called immediately after the framework deleted a file from an archive.
-archive:didOpenFile:
This method is called immediately after the framework opened a file from an archive.
-archive:didRenameFile:as:
This method is called immediately after the framework renamed a file of an archive.
-archive:shouldAddFile:
This method is called immediately before adding a file to an archive.
-archive:shouldDeleteFile:
This method is called immediately before deleting a file from an archive.
-archive:shouldOpenFile:
This method is called immediately before opening a file of the archive.
-archive:shouldRenameFile:as:
This method is called immediately before renaming a file of an archive.
-archive:willAddFile:
This method is called immediately before the framework starts compressing a file into an archive.
-archive:willDeleteFile:
This method is called immediately before the framework deletes a file from an archive.
-archive:willOpenFile:
This method is called immediately before opening a file of the archive.
-archive:willRenameFile:as:
This method is called immediately before the framework starts renaming a file of an archive.
-archiveDidSave:
This method is called immediately after saving an archive.
-archiveShouldSave:
This method is called immediately before saving an archive.
-archiveWillSave:
This method is called immediately before saving an archive but after archiveShouldSave: if it is implemented by the delegate.

archive:didAddFile:


This method is called immediately after the framework compressed a file into an archive.

- (void)archive:(MPQArchive *)archive didAddFile:(NSString *)file;
Parameter Descriptions
archive
The archive in which the file was added.
file
The MPQ path of the file that was added.
Discussion

This message is sent regardless if the file was compressed or not, encrypted or not.


archive:didDeleteFile:


This method is called immediately after the framework deleted a file from an archive.

- (void)archive:(MPQArchive *)archive didDeleteFile:(NSString *)file;
Parameter Descriptions
archive
The archive from which file was deleted.
file
The MPQ path of the file that was deleted.
Discussion

Note that unlike file addition and renaming, archive:willDeleteFile: and archive:didDeleteFile: are not invoked when the archive is saved, but rather immediately before and after the delete file method is invoked respectively. This is because no extra operation is performed at save time for deletion, unlike addition and renaming. Note however that deletion is undoable until the archive is saved.


archive:didOpenFile:


This method is called immediately after the framework opened a file from an archive.

- (void)archive:(MPQArchive *)archive didOpenFile:(NSString *)file;
Parameter Descriptions
archive
The archive from which file was deleted.
file
The MPQ path of the file that was deleted.
Discussion

Will not be called if file opening is cancelled or failed.


archive:didRenameFile:as:


This method is called immediately after the framework renamed a file of an archive.

- (void)archive:(MPQArchive *)archive didRenameFile:(NSString *)file 
        as:(NSString *)newFile;
Parameter Descriptions
archive
The archive in which the renamed file is stored.
file
The MPQ path of the file that was renamed.
newFile
The new MPQ path of the file that was renamed.
Discussion

It is safe to use the new name as soon as this message is sent.


archive:shouldAddFile:


This method is called immediately before adding a file to an archive.

- (BOOL)archive:(MPQArchive *)archive shouldAddFile:(NSString *)file;
Parameter Descriptions
archive
The archive in which the file will be added.
file
The MPQ path of the file that is about to be added.
method result
A response from the delegate.
Discussion

This method is invoked when adding a file to the archive but prior to that file being actually compressed and written in the MPQ archive file. Return YES to permit the addition or NO to cancel it. Note that the new file will be accessible right after the addition method returns (if it was sucessfull). However, the data of the file will be read from the original file on disk until the archive is saved, at which time the delegate will be notified that the file is being compressed (if compression was specified) and added to the MPQ archive file.


archive:shouldDeleteFile:


This method is called immediately before deleting a file from an archive.

- (BOOL)archive:(MPQArchive *)archive shouldDeleteFile:(NSString *)file;
Parameter Descriptions
archive
The archive in which file will be deleted.
file
The MPQ path of the file that is about to be deleted.
method result
A response from the delegate.
Discussion

Return YES to permit the addition or NO to cancel it.


archive:shouldOpenFile:


This method is called immediately before opening a file of the archive.

- (BOOL)archive:(MPQArchive *)archive shouldOpenFile:(NSString *)file;
Parameter Descriptions
archive
The archive containing the file that is about to be opened.
file
The MPQ path of the file that is about to be opened.
method result
A response from the delegate.
Discussion

Return YES to permit the file to be opened or NO to prevent it.


archive:shouldRenameFile:as:


This method is called immediately before renaming a file of an archive.

- (BOOL)archive:(MPQArchive *)archive shouldRenameFile:(NSString *)file 
        as:(NSString *)newFile;
Parameter Descriptions
archive
The archive in which the file to be renamed is stored.
file
The MPQ path of the file that is about to be renamed.
newFile
The new MPQ path of the file that is about to be renamed.
method result
A response from the delegate.
Discussion

This method is invoked when renaming a file of the archive but prior to that file being actually re-encrypted and re-written in the MPQ archive file. Return YES to permit the rename or NO to cancel it. Note that the file will be accessible right after the rename method returns (if it was sucessfull) as the new name. The delegate will be notified that the file is being re-processed at save time.


archive:willAddFile:


This method is called immediately before the framework starts compressing a file into an archive.

- (void)archive:(MPQArchive *)archive willAddFile:(NSString *)file;
Parameter Descriptions
archive
The archive in which the file will be added.
file
The MPQ path of the file that is about to be added.
Discussion

This method is called for each file pending for addition in the archive being saved. This method is invoked after archiveWillSave: but prior to archiveDidSave:.


archive:willDeleteFile:


This method is called immediately before the framework deletes a file from an archive.

- (void)archive:(MPQArchive *)archive willDeleteFile:(NSString *)file;
Parameter Descriptions
archive
The archive from which file will be deleted.
file
The MPQ path of the file that is about to be deleted.
Discussion

This method is invoked after archive:shouldDeleteFile:. Note that unlike file addition and renaming, archive:willDeleteFile: and archive:didDeleteFile: are not invoked when the archive is saved, but rather immediately before and after the delete file method is invoked respectively. This is because no extra operation is performed at save time for deletion, unlike addition and renaming. Note however that deletion is undoable until the archive is saved.


archive:willOpenFile:


This method is called immediately before opening a file of the archive.

- (void)archive:(MPQArchive *)archive willOpenFile:(NSString *)file;
Parameter Descriptions
archive
The archive containing the file that is about to be opened.
file
The MPQ path of the file that is about to be opened.
Discussion

This method is invoked after archive:shouldOpenFile:.


archive:willRenameFile:as:


This method is called immediately before the framework starts renaming a file of an archive.

- (void)archive:(MPQArchive *)archive willRenameFile:(NSString *)file 
        as:(NSString *)newFile;
Parameter Descriptions
archive
The archive in which the file to be renamed is stored.
file
The MPQ path of the file that is about to be renamed.
newFile
The new MPQ path of the file that is about to be renamed.
Discussion

This method is called for each file pending for renaming in the archive being saved. This method is invoked after archiveWillSave: but prior to archiveDidSave:.


archiveDidSave:


This method is called immediately after saving an archive.

- (void)archiveDidSave:(MPQArchive *)archive;
Parameter Descriptions
archive
The archive that did save.
Discussion

archiveDidSave: will not be sent to the delegate if the save operation failed.


archiveShouldSave:


This method is called immediately before saving an archive.

- (BOOL)archiveShouldSave:(MPQArchive *)archive;
Parameter Descriptions
archive
The archive that is about to be saved.
method result
A response from the delegate.
Discussion

Return YES in this delegate to perform the save operation, or NO to cancel the save operation.


archiveWillSave:


This method is called immediately before saving an archive but after archiveShouldSave: if it is implemented by the delegate.

- (void)archiveWillSave:(MPQArchive *)archive;
Parameter Descriptions
archive
The archive that is about to be saved.
Discussion

This message is always sent if the delegate implements it.

(Last Updated April 02, 2007)