Sample code for 30+ languages & platforms
C#

Transition from ZipEntry.NextEntry to ZipEntry.GetNext

Provides instructions for replacing deprecated NextEntry method calls with GetNext.

Chilkat C# Downloads

C#
bool success = false;

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

Chilkat.Zip zip = new Chilkat.Zip();

success = zip.OpenZip("qa_data/zips/xml_files.zip");
if (success != true) {
    Debug.WriteLine(zip.LastErrorText);
    return;
}

Chilkat.ZipEntry entry = zip.FirstEntry();
if (zip.LastMethodSuccess == false) {
    Debug.WriteLine("This zip archive is empty.");
    return;
}

bool finished = false;
while (finished == false) {

    if (entry.IsDirectory == false) {
        Debug.WriteLine(entry.FileName);
    }
    else {
        Debug.WriteLine("(directory) " + entry.FileName);
    }

    Chilkat.ZipEntry next = entry.NextEntry();
    if (entry.LastMethodSuccess == false) {
        finished = true;
    }

    entry = next;
}

zip.CloseZip();

Debug.WriteLine("----");

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

success = zip.OpenZip("qa_data/zips/xml_files.zip");

Chilkat.ZipEntry ze = new Chilkat.ZipEntry();
zip.EntryAt(0,ze);

bool entryValid = true;
while (entryValid == true) {

    if (ze.IsDirectory == false) {
        Debug.WriteLine(ze.FileName);
    }
    else {
        Debug.WriteLine("(directory) " + ze.FileName);
    }

    entryValid = ze.GetNext();
}

zip.CloseZip();