Contents - Index - Previous - Next


FileIsOK property

 

Applies to

TVCLUnZip component

 

Declaration

property FileIsOK[Index]: Integer: Boolean;

 

Description

This property tests for the integrity of individual files within an archive.  

 

If FileIsOK[Index] is False then that particular file within the archive is probably corrupted.  When this property is first checked, the compressed file is run through a test unzip procedure, exactly as if it was being unzipped except that nothing is actually written out to any file.  If there are any exceptions or errors during the unzip process, the result for this property will be False. Any time you test this property after the first time, while you still have the archive open, it will return the same result, without having to go through the unzipping process (the result is remembered).  However, there is a method called ResetFileIsOK(Index) which you may use to reset this property for a particular compressed file.  

 

If you use this property for a password protected file, be sure to set the password property first, or those password protected files will be reported as being possibly corrupt.  

 

IMPORTANT:  Be sure the DoAll Property is set to False when using this property.  If DoAll is set to True then VCLZip will try to process all of the files in the archive and  

 

NOTE: If you run the FixZip Method on an archive that contains any files that test as being corrupted, those files will not be included in the fixed version of the archive.  

 

If you wish to test the integrity of an entire archive, and the archive has MANY files in it, you should use the CheckArchive procedure. If you have many files in the archive you will find that it will be much faster than using the FileIsOK property.  

 

However, if you wish to test the integrity of an entire archive that does not have MANY files in it, an easy way that would not require an OnBadCRC event would be:  

 

procedure TVCLZipForm.TestZipFilesClick(Sender: TObject); 

var 

i: Integer; 

begin 

InfoWin.Lines.Add('Beginning integrity test for ' + IntToStr(Zipper.Count) + ' files for ' + Zipper.ZipName); 

For i := 0 to Zipper.Count-1 do 

begin 

if (Zipper.FileIsOK[i]) then 

InfoWin.Lines.Add( Zipper.FullName[i] + ' is OK.' ) 

else 

InfoWin.Lines.Add( Zipper.FullName[i] + ' may be corrupt.' ); 

end; 

Gauge1.Progress := 0; 

Gauge2.Progress := 0; 

end; 

 

See Also: 

 

CheckArchive 

FixZip 

 

Run-time only

Read-only