Xceed Zip Compression Library Documentation
PreviewFiles method
Xceed Zip control reference > Xceed Zip control methods > PreviewFiles method

Description

The PreviewFiles method provides the complete list of files that will end up being processed if a call is made to the Zip method with the current property settings. The PreviewFiles method also calculates and reports statistics on the entire group of files listed.

The files listed by the PreviewFiles method are determined by the same properties that affect the Zip method, except the Skip* properties. In other words, PreviewFiles uses the FilesToProcess, FilesToExclude, and the filtering properties in order to determine which files will be previewed. The minimum requirement for the PreviewFiles method to work is at least one entry in the FilesToProcess property.

The PreviewingFile event is triggered for each file being listed and   provides detailed file information.

The ProcessCompleted event provides the statistics for the entire group of files listed.

Declaration (ActiveX)  

Method PreviewFiles(bCalcCompSize As Boolean) As xcdError

Declaration (DLL API)  
int XzPreviewFiles( HXCEEDZIP hZip, BOOL bCalcCompSize )

Parameters

Parameter Description
bCalcCompSize The bCalcCompSize parameter determines whether the PreviewFiles method should calculate and report the total compressed size of all the listed files. If the bCalcCompSize parameter is set to True, the calculation is performed and the result is provided by the ProcessCompleted event. This allows you to make accurate estimates of the number of floppy or other removable media disks required in order to zip these files in a spanned zip file . The calculation involves completely reading each file's data and compressing it to memory.

Return values

A return value of type xcdError is returned. Only the return value of xerSuccess indicates that the method has been completed successfully. See the error codes topic for a list of possible return values.

Remarks

The PreviewFiles method works by creating a copy of the contents of the FilesToProcess property, expanding all wildcards, removing all the files that aren't currently accessible on the local machine or network, removing files that match entries in the FilesToExclude property and removing any files excluded by the filtering properties . The resulting list of files ends up being the same as the list of files that will be processed by the Zip method when it is called.

If any method that supports filtering is called immediately after the PreviewFiles method, the FilesToProcess and FilesToExclude properties will not be rescanned. Instead, the "cached list" created by the PreviewFiles method will be used.

Applicable properties

Abort, BasePath, FilesToProcess and the filtering properties, PreservePaths and ProcessSubfolders.

Events triggered

PreviewingFile, ProcessCompleted

Related topics

The ListZipContents method is the equivalent of the PreviewFiles method, but for files already inside a zip file.