Contents - Index - Previous - Next


OnSkippingFile Event 

 

Applies to

TVCLUnZip component

 

Declaration

property OnSkippingFile: TSkippingFile = procedure(Sender: TObject; Reason: TSkipReason; FName: string; FileIndex: Integer; var Retry: Boolean); of object;

 

Description

The OnSkippingFile event handler is Triggered when a file that would have otherwise been processed is being skipped. 

 

The reason for the file being skipped is in the Reason argument. 

 

FName is name of the file being skipped.  

 

FileIndex is the index into the indexed properties of the archive for the file being skipped (if unzipping), for instance Filename[FileIndex] or CompressedSize[FileIndex].

  

If this event is called during a zipping process and the reason for skipping is srFileOpenError, setting Retry to True will cause VCLZip to re-attempt to open the file.  This gives you a chance to close the file if it is open by another application and continue zipping, rather than having to start the zipping all over again.  Setting the Retry parameter will be ignored if it is not a zipping situation and if the reason is not srFileOpenError.  See the FileOpenMode property which determines the mode used to open files about to be zipped.  

 

IMPORTANT:   If FileIndex is -1, this means that this event has been called during a zipping operation. In this case, use the FName parameter only as this reflects a file that is not in the archive, instead FName reflects the name of a file that would have been zipped.  Do not try to use the FileIndex property or an error will occur.  

 

Definition of each reason (TSkipReason) and why OnSkippingFile would be called:  

 

srBadPassword When unzipping, If an attempt is made to process an encryped file and the Password property does not match the file's password.  

srNoOverwrite When unzipping, If an existing file would be overwritten and the OverWriteMode property is set to either Never, or Prompt and the OnPromptForOverwrite event returned False for the OverWriteIt parameter. 

  When zipping, if about to insert a duplicate entry into the archive. (This should happen rarely as conflicts should be taken care of by VCLZip before it reaches this point. Please contact me if this happens)  

srFileOpenError (Version 2.16 or later only) When zipping, if an error occurs opening a file about to be zipped. This will probably mean that the file is locked by another application.  You can set the FileOpenMode property to determine the mode to use to open the file about to be zipped.