Sample code for 30+ languages & platforms
PowerBuilder

Transition from Zip.AppendDataEncoded to Zip.AddEncoded

Provides instructions for replacing deprecated AppendDataEncoded method calls with AddEncoded.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Zip
string ls_PathInZip
string ls_Encoding
string ls_EncData
oleobject loo_EntryObj
oleobject loo_Ze
integer li_Index

li_Success = 0

loo_Zip = create oleobject
li_rc = loo_Zip.ConnectToNewObject("Chilkat.Zip")
if li_rc < 0 then
    destroy loo_Zip
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// ...
// ...
ls_PathInZip = "example.dat"
ls_Encoding = "base64"
ls_EncData = "... BASE64 DATA ..."

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

loo_EntryObj = loo_Zip.AppendDataEncoded(ls_PathInZip,ls_Encoding,ls_EncData)
if loo_Zip.LastMethodSuccess = 0 then
    Write-Debug loo_Zip.LastErrorText
    destroy loo_Zip
    return
end if

// ...
// ...

destroy loo_EntryObj

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

// Instead of returning the zip entry object, we just return success/failure.
li_Success = loo_Zip.AddEncoded(ls_PathInZip,ls_Encoding,ls_EncData)
if li_Success = 0 then
    Write-Debug loo_Zip.LastErrorText
    destroy loo_Zip
    return
end if

// Do the following if you need the zip entry object for what was just appended.
// The newly appended entry is the last one.
loo_Ze = create oleobject
li_rc = loo_Ze.ConnectToNewObject("Chilkat.ZipEntry")

li_Index = loo_Zip.NumEntries - 1
loo_Zip.EntryAt(li_Index,loo_Ze)


destroy loo_Zip
destroy loo_Ze