Sample code for 30+ languages & platforms
Lianja

Transition from ZipEntry.NextEntry to ZipEntry.GetNext

Provides instructions for replacing deprecated NextEntry method calls with GetNext.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

// ------------------------------------------------------------------------
// The NextEntry method is deprecated.
// See below or code showing how to rewrite using EntryAt/GetNext

loZip = createobject("CkZip")

llSuccess = loZip.OpenZip("qa_data/zips/xml_files.zip")
if (llSuccess <> .T.) then
    ? loZip.LastErrorText
    release loZip
    return
endif

loEntry = loZip.FirstEntry()
if (loZip.LastMethodSuccess = .F.) then
    ? "This zip archive is empty."
    release loZip
    return
endif

llFinished = .F.
do while llFinished = .F.

    if (loEntry.IsDirectory = .F.) then
        ? loEntry.FileName
    else
        ? "(directory) " + loEntry.FileName
    endif

    loNext = loEntry.NextEntry()
    if (loEntry.LastMethodSuccess = .F.) then
        llFinished = .T.
    endif

    release loEntry
    loEntry = loNext
enddo

loZip.CloseZip()

? "----"

// ------------------------------------------------------------------------
// Do the equivalent using EntryAt/GetNext.

llSuccess = loZip.OpenZip("qa_data/zips/xml_files.zip")

loZe = createobject("CkZipEntry")
loZip.EntryAt(0,loZe)

llEntryValid = .T.
do while llEntryValid = .T.

    if (loZe.IsDirectory = .F.) then
        ? loZe.FileName
    else
        ? "(directory) " + loZe.FileName
    endif

    llEntryValid = loZe.GetNext()
enddo

loZip.CloseZip()


release loZip
release loZe