The UnzipPreprocessingFile event provides the opportunity to view and change a file's information before it is unzipped, to redirect a file so that it is unzipped to memory, and to make the final decision about whether the file should be unzipped or excluded from being unzipped. This event is triggered right before the output file is opened for unzipping.
Not all file information provided by the UnzipPreprocessingFile event's parameters is modifiable. The table below provides a list of parameters provided by UnzipPreprocessingFile and shows you which ones can be modified.
Declaration | |
---|---|
Event UnzipPreprocessingFile(sFilename As String, sComment As String, sDestFilename As String, lSize As Long, |
Declaration (DLL API) | |
---|---|
xcdUnzipPreprocessingFileParams * pParams = ( xcdUnzipPreprocessingFileParams * ) lParam; |
Parameter | Modifiable | Description |
---|---|---|
sFilename | NO | The file's path and filename, exactly as it is currently stored in the zip file. |
sComment | NO | The file's comment. |
sDestFilename | YES | The real path and filename of the destination file about to be unzipped to. |
lSize | NO | The file's original uncompressed size, in bytes. |
lSizeLow lSizeHigh (64) |
NO | The 32 low-order and high-order bits representing the file's original uncompressed size, in bytes. |
lCompressedSize | NO | The file's compressed size, in bytes. |
lCompressedSizeLow lCompressedSizeHigh (64) |
NO | The 32 low-order and high-order bits representing the file's compressed size, in bytes. |
xAttributes | YES | The file's attributes. |
lCRC | NO | The file's uncompressed data CRC checksum. |
dtLastModified | YES | The last modification date and time stamp. |
dtLastAccessed | YES | The last accessed date and time stamp. |
dtCreated | YES | The creation date and time stamp. |
xMethod | NO | The compression method. |
bEncrypted | NO | Is this file encrypted? |
sPassword | YES | If so, it will be decrypted with this password. |
lDiskNumber | NO | When dealing with spanned zip files, the disk this file is located on. |
bExcluded | YES | Will this file be unzipped or excluded? |
xReason | NO | If the bExcluded flag (above) was True when the UnzipPreprocessingFile was triggered, this parameter contains the reason that the file was marked for excluding. |
bExisting | NO | Indicates whether the destination file about to be unzipped to already exists. |
xDestination | YES | Determines whether a file is unzipped to disk or to memory. Setting this parameter to xudDisk (0) will cause the file to be unzipped to disk with the path and filename specified by the sDestFilename parameter (described above). Setting this parameter to xudMemory (1) will cause the file to be unzipped to memory via the UnzippingMemoryFile event. The entire file's uncompressed data will be provided through a single occurrence of the UnzipPreprocessingFile event in this case. Setting xDestination to xudMemoryStream will cause the UnzippingMemoryFile event to be triggered many times: once each 32K block of uncompressed data as it becomes available. |
Version 6.0 of Xceed Zip Compression Library introduces AES encryption support. Because of export restrictions in some countries, a new license validation had to be implemented. License keys that begin with "ZIP" enable AES encryption support while "ZIL" license keys, either trial or registered, do not activate AES encryption support.
When zipping in trial mode with a "ZIP" (ZIP60 or more recent) license key, if the EncryptionMethod property is set to xemWinZipAES, the EncryptionPassword property will be changed to "This is a trial password" only if it had been modified prior to setting the EncryptionMethod property. If a password other than "This is a trial password" is specified in the EncryptionPassword property after the EncryptionMethod property has been set, a "Set not permitted" error will be thrown. The password can also be specified via the ZipPreprocessingFile event however if a password other than "This is a trial password" is specified, the SkippingFile event will be raised with a xsrNotLicenced skipping reason.
When unzipping an AES-encrypted zip file in trial mode with a "ZIP" license key, the only password that can be used is "This is a trial password" and it must be specified via the EncryptionPassword property, InvalidPassword event, or UnzipPreprocessingFile event. If a password other than "This is a trial password" is specified, the SkippingFile event will be raised with a xsrNotLicenced skipping reason. When unzipping, the EncryptionMethod property does not need to be set.
For both registered and trial "ZIP" and "ZIL" license keys, if the EncryptionPassword property is an empty string, the files will not be encrypted regardless of the value of the EncryptionMethod.