Chilkat Forum

Programming Languages / Environments => .NET => Topic started by: XardozCom on June 13, 2018, 11:54:48 PM

Title: Replacing Ionic.zip.dll with Chilkat.zip
Post by: XardozCom on June 13, 2018, 11:54:48 PM


All seems to be going well as Chilkat is straightforward

We get a Zip with a file with the needed data, but no password required!

Please help...

    Public Function ReturnDecodedKeys(ByVal sFeatureNumber As String, _
                                      ByVal sAppDataPath As String, _
                                      Optional ByVal bZip As Boolean = False) As String

        If bZip Then
            Dim zip As New Chilkat.Zip
            Dim success As Boolean = zip.UnlockComponent("z")
            Dim resultZip As String = ""
            If (success <> True) Then
                resultZip = zip.LastErrorText
                AppendToFile("Chilkat Logon Failed: " & resultZip)
                Return resultZip
                Exit Function
            End If

            zip.SetPassword("1234")
            zip.PasswordProtect = True
            Dim saveExtraPath As Boolean
            saveExtraPath = False
            success = False
            success = zip.AppendOneFileOrDir(sAppDataPath & "\Feature" & sFeatureNumber & ".zip", saveExtraPath)
            'success = zip.NewZip(sAppDataPath & "\Feature" & sFeatureNumber & ".zip")
            If (success <> True) Then
                resultZip = zip.LastErrorText
                AppendToFile("Chilkat Zip Creation Failed: " & resultZip)
                Return resultZip
                Exit Function
            End If

            Dim fac As New Chilkat.FileAccess
            zip.AppendString("results.dat", sSystemKey.ToString & vbNewLine & s.ToString)
            success = False

            success = zip.WriteZipAndClose()
            If (success <> True) Then
                resultZip = zip.LastErrorText
                AppendToFile("Feature.zip Failed: " & resultZip)
                Return resultZip
                Exit Function
            End If

        End If

        ReturnDecodedKeys = s 'sSystemKey & "|" & s
    End Function

Title: Re: Replacing Ionic.zip.dll with Chilkat.zip
Post by: Chilkat on June 14, 2018, 07:37:57 AM
The sequence of calls should be like this:

Code: [Select]
Dim zip As New Chilkat.Zip
success = zip.NewZip(sAppDataPath & "\Feature" & sFeatureNumber & ".zip")
zip.SetPassword("1234")
zip.PasswordProtect = True
zip.AppendString("results.dat", sSystemKey.ToString & vbNewLine & s.ToString)
success = zip.WriteZipAndClose()
Title: Re: Replacing Ionic.zip.dll with Chilkat.zip
Post by: XardozCom on June 14, 2018, 10:38:48 AM
Thank You