Sample code for 30+ languages & platforms
DataFlex

Transition from Zip.AppendDataEncoded to Zip.AddEncoded

Provides instructions for replacing deprecated AppendDataEncoded method calls with AddEncoded.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoZip
    String sPathInZip
    String sEncoding
    String sEncData
    Variant vEntryObj
    Handle hoEntryObj
    Variant vZe
    Handle hoZe
    Integer iIndex
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatZip)) To hoZip
    If (Not(IsComObjectCreated(hoZip))) Begin
        Send CreateComObject of hoZip
    End

    // ...
    // ...
    Move "example.dat" To sPathInZip
    Move "base64" To sEncoding
    Move "... BASE64 DATA ..." To sEncData

    // ------------------------------------------------------------------------
    // The AppendDataEncoded method is deprecated:

    Get ComAppendDataEncoded Of hoZip sPathInZip sEncoding sEncData To vEntryObj
    If (IsComObject(vEntryObj)) Begin
        Get Create (RefClass(cComChilkatZipEntry)) To hoEntryObj
        Set pvComObject Of hoEntryObj To vEntryObj
    End
    Get ComLastMethodSuccess Of hoZip To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoZip To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // ...
    // ...

    Send Destroy of hoEntryObj

    // ------------------------------------------------------------------------
    // Do the equivalent using AddEncoded.

    // Instead of returning the zip entry object, we just return success/failure.
    Get ComAddEncoded Of hoZip sPathInZip sEncoding sEncData To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoZip To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // Do the following if you need the zip entry object for what was just appended.
    // The newly appended entry is the last one.
    Get Create (RefClass(cComChilkatZipEntry)) To hoZe
    If (Not(IsComObjectCreated(hoZe))) Begin
        Send CreateComObject of hoZe
    End
    Get ComNumEntries Of hoZip To iTemp1
    Move (iTemp1 - 1) To iIndex
    Get pvComObject of hoZe to vZe
    Get ComEntryAt Of hoZip iIndex vZe To iSuccess


End_Procedure