Contents - Index - Previous - Next


OnInCompleteZip Event 

 

Applies to

TVCLUnZip component

 

Declaration

property OnInCompleteZip: TInCompleteZip = procedure(Sender: TObject; var IncompleteMode: TIncompleteZipMode); of object;

 

 

Description

The OnInCompleteZip event handler is triggered whenever the component cannot find an END CENTRAL DIRECTORY which means one of the following:  

 

1. This is part of a multi-file zipfile and it is not the last file/disk in the set. 

2. It is a bad zip file - corrupted or truncated 

3. The file is not a zip file 

 

If VCLZip encounters a file for which it cannot find an end central directory, the behavior depends upon two things:  

 

1. How the IncompleteZipMode Property is set. 

2. How you define what happens in the OnIncompleteZip event (if you have one defined that is).  

 

You can set the value for the IncompleteZipMode property in the Object Inspector, anywhere in your code, or inside the OnIncompleteZip event, through the IncompleteMode paratmeter. 

 

>If no OnIncompleteZip event is defined:  

If you do not have an OnIncompleteZip event defined, the following happens when VCLZip is presented with a file for which it can't find an end central directory: 

 

IncompleteZipMode Value Action  

izAssumeMulti An EIncompleteZip exception is thrown. 

izAssumeBad An attempt is made to read as much of the zip file as possible using the local headers.  The results of this can be unpredictable.  If it still can't detect any files in the archive, then an EBadZipFile exception is thrown. 

izAssumeNotAZip An ENotAZipFile exception is thrown. 

  

It is up to your program to trap these exceptions and handle them as you see fit. 

 

>If there IS an OnIncompleteZip event defined:  

When no end of central directory is found:  

1) The OnIncompleteZip event is called. 

2) You have the opportunity to set the IncompleteZipMode property here through the IncompleteMode parameter.  

 

VCLZip's behavior depends on how you set the IncompleteZipMode property.  

 

IncompleteZipMode Value Action  

izAssumeMulti Another attempt will be made to read the zip file.  It is assumed in this case that you prompted the user for the last disk in a spanned disk set. 

izAssumeBad An attempt is made to read as much of the zip file as possible using the local headers.  The results of this can be unpredictable.  If it still can't read it, then an EBadZipFile exception is thrown. 

izAssumeNotAZip An ENotAZipFile exception exception is thrown. 

  

Again, it is up to your program to trap these exceptions.