CopyFromZip()
|
Previous Top Next |
:CopyFromZip(<oZipCentralDirectoryRecord>) --> lSuccess
|
<oZipCentralDirectoryRecord>
|
<oZipCentralDirectoryRecord> must be a valid Central Directory Record object from a different Zip File, which contains the (File) Entry that should be added to this Zip File.
|
This method returns .T. (TRUE) if the (File) Entry could be copied, or .F. (FALSE) if it could not.
|
This method copies a specific (File) Entry of a given oZipCentralDirectoryRecord from a different XbZLibZip object to the current Zip File. If a (File) Entry with the same File Name already exists in the current Zip File, it will be replaced, otherwise it will be added. If the (File) Entry could not be successfully copied from the other Zip File, the method will return .F. (FALSE), otherwise .T. (TRUE) is returned.
|
|
The oZipCentralDirectoryRecord must be a valid Central Directory Record object of a separate Zip File and can not be simply a File Name or Index Number, as this method requires the :Cargo value of the given oZipCentralDirectoryRecord, which contains a reference to the other XbZLibZip object!
|
|
This method simply calls the :CopyToZip() method of the other XbZLibZip object!
|
Create and open a new Zip File named "NewArchive.zip" and open an existing Zip File named "OldArchive.zip" in Read-Only mode. Then copy the File Entry "File2Copy.xxx" from the "OldArchive.zip" to the "NewArchive.zip", save the changes, and close both Zip Files. This is basically a slightly simpler version of the :AddEntry() example code:
|
oNewZip := XbZLibZip():New('NewArchive.zip', XBZ_OPEN_CREATE)
|
oOldZip := XbZLibZip():New('OldArchive.zip', XBZ_OPEN_READ)
|
oCDRec := oOldZip:FindEntry('File2Copy.xxx')
|
oNewZip:CopyFromZip(oCDRec)
|
oOldZip:Close()
|
oNewZip:Close()
|