This section describes methods for creates ZIP archive.
OpenArchive()
Open ZIP archive file.
Syntax:
Code Block |
---|
eqZIP::OpenArchive(m.tcZipName, m.tnAppend) |
Parameters:
m.tcZipName
The ZIP archive file.m.tnAppend
A append flag.Return values
.T. - Archive create/open successfully..F. - Archive do not create/open successfully.
CloseArchive()
Close ZIP archive file.
Syntax:
Code Block |
---|
eqZIP::CloseArchive(m.tcComment) |
Parameters:
m.tcComment
ZIP archive comment.
OpenNewFile()
Open file handle.
Syntax:
Code Block |
---|
eqZIP::OpenNewFile(m.tcFileName, m.ttCreated, m.llIWontUTF8, m.lcPassword, m.liCRC32) |
Parameters:
m.tcFileName
File name in ZIP archive.m.ttCreated
Datetime created.m.llIWontUTF8
A wish uses UTF-8 for encoding file name.
Info |
---|
For UTF-8 encoding or password is needy zlib.dll version 1.25 or higher. |
m.lcPassword
File password.m.liCRC32
File CRC32 checksum. it is mandatory for m.lcPassword. Checksum is for all data.
Return values
0 - File append to ZIP archive.
-102 - ZIP_PARAMERROR
-103 - ZIP_BADZIPFILE
-104 - ZIP_INTERNALERROR
AppendFile()
Add some file to ZIP archive.
Syntax:
Code Block |
---|
eqZIP::AppendFile(m.tcFilename, m.tcNameInArchive, m.llIWontUTF8, m.lcPassword) |
Parameters:
m.tcFileName
The source file name.m.tcNameInArchive
File name in ZIP archive.m.llIWontUTF8
A wish uses UTF-8 for encoding file name.
Info |
---|
For UTF-8 encoding or password is needy zlib.dll version 1.25 or higher. |
m.lcPassword
File password.Return values
-1 - The source file doesn't exists
-2 - The source file cannot open
0 - File append to ZIP archive
-102 - ZIP_PARAMERROR
-103 - ZIP_BADZIPFILE
-104 - ZIP_INTERNALERROR
WriteData()
Write data to opened file handle.
Syntax:
Code Block |
---|
eqZIP::WriteData(m.tcData) |
Parameters:
m.tcData
Data which will be write to file handle.
Return values
-102 - ZIP_PARAMERROR
-103 - ZIP_BADZIPFILE
-104 - ZIP_INTERNALERROR
CloseFile()
Close file handle.
Syntax:
Code Block |
---|
eqZIP::CloseFile() |
SYS2007()
Calculate CRC32 checksum for data.
Syntax:
Code Block |
---|
eqZIP::SYS2007(m.lcData) |
Parameters:
m.lcDataData which calculate CRC32 checksum.
toc
XFRX use this class for creating output for Libre Office, Microsoft Office 2007 and XML Paper Specifications.
Info |
---|
Internal name is eqzip. The synonymum XFRX#ZIP is introduced in XFRX 22.0 |
Remarks
To version XFRX 22.x
XFRX use zlib.dll version 1.2.1 for VFP 5-9 and VFPA 32 bit. This version is old, but need MS VC ++ Runtime 4.0 only.
XFRX use zlib64.dll version 1.2.11 for VFPA 64 bit. This version is compiled from source code and need MS VC ++ Runtime 14.0.
Since version XFRX 24.0
zlib.dll and zlib64.dll are compiled from source code and need MS VC ++ Runtime 10.0.
UTF-8 | ZIP max size | File max size | UTF-8 | ZIP max size | File max size | ||
---|---|---|---|---|---|---|---|
Zlib version <1.2.5 | Zlib version >=1.2.5 | ||||||
< XFRX 22.0 | XFRX 22.0 | ||||||
VFP 5-9 VFP A 10.0 32 bit | No | 2GiB | 2GiB | Yes | >4GiB | 2GiB | >4GiB |
VFP A 10.0 64 bit | - | Yes | >4GiB | 2GiB | >4GiB | ||
VFP A 10.1 32 bit | No | 2GiB | 4GiB | Yes | >4GiB | >4GiB | >4GiB |
VFP A 10.1 64 bit | - | Yes | >4GiB | >4GiB | >4GiB |
Examples
Use XFRX#ZIP before XFRX 22.0
Code Block |
---|
LOCAL m.loZIP, m.lcZIPFile, m.lcFile
m.lcZIPFile=SYS(2023)+"\test.zip"
m.lcFile="xfrx.h"
SET PROCEDURE TO xfrx.prg
m.loZIP = CREATEOBJECT("eqzip")
?"ZLIB version", m.loZIP.nzipVersion
IF m.loZip.openArchive(m.lcZIPFile)
m.loZip.appendFile(m.lcFile, JUSTFNAME(m.lcFile), .T.)
m.loZip.closearchive()
ENDIF
RELE m.loZIP |
Use XFRX#ZIP from XFRX 22.0
Code Block |
---|
LOCAL m.loZIP, m.lcZIPFile, m.lcFile
m.lcZIPFile=SYS(2023)+"\test.zip"
m.lcFile="xfrx.h"
m.loZIP = EVALUATE([xfrx("XFRX#ZIP")])
?"ZLIB version", m.loZIP.nzipVersion
IF m.loZip.openArchive(m.lcZIPFile)
m.loZip.appendFile(m.lcFile, JUSTFNAME(m.lcFile), .T.)
m.loZip.closearchive()
ENDIF
RELE m.loZIP |
Code Block |
---|
LOCAL m.loZIP, m.lcZIPFile, m.lcFile
m.lcZIPFile="c:\temp\_big.zip"
m.loZIP = EVALUATE([xfrx("XFRX#ZIP")])
IF m.loZip.openArchive(m.lcZIPFile)
m.lcData=SYS(0)+" "+TTOC(DATETIME())
m.loZip.OpenNewFile("myFile")
m.loZip.WriteData(m.lcData)
m.loZip.CloseFile()
m.lcData=SYS(0)+" "+TTOC(DATETIME())
m.loZip.OpenNewFile("myFile+Datetime", {^2022-01-01})
m.loZip.WriteData(m.lcData)
m.loZip.CloseFile()
m.lcData=SYS(0)+" "+TTOC(DATETIME())
m.loZip.OpenNewFile("myFile+Datetime+National+Characters - "+"bílý žluťoučký kůň", {^2022-01-01}, .T.)
m.loZip.WriteData(m.lcData)
m.loZip.CloseFile()
m.lcData=SYS(0)+" "+TTOC(DATETIME())
m.loZip.OpenNewFile("myFile+Datetime+ěščřž+password", {^2022-01-01}, .T., "mypwd", loZIP.SYS2007(m.lcData))
m.loZip.WriteData(m.lcData)
m.loZip.CloseFile()
m.lcData=SYS(0)+" "+TTOC(DATETIME())
m.loZip.OpenNewFile("myFile+Datetime+ěščřž+password+file comment", {^2022-01-01}, .T., "mypwd", loZIP.SYS2007(m.lcData), .F., "my file comment")
m.loZip.WriteData(m.lcData)
m.loZip.CloseFile()
m.loZip.closearchive("ěščřžýáíé")
ENDIF
RELE m.loZIP |