Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Identify if ZIP File is Corrupted
Message
De
24/04/2013 15:06:42
 
 
À
24/04/2013 14:37:43
Erick Miranda
Formata Data Business - Grupo Linx
Contagem, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
MS SQL Server
Divers
Thread ID:
01571775
Message ID:
01571781
Vues:
53
This message has been marked as a message which has helped to the initial question of the thread.
>How can I to identify if ZIP file is corrupted, through VFP?

Following what Rick has said, the parsing of the output may be elaborated as follow. This is what I use in the .NET Zip class I have built. But, this code is easily transportable to VFP:
                    ' If we have an output
                    If loProcessfile.cOutput.Length > 0 Then

                        ' Make it available in case the client needs it
                        cCommandLineFullOutput = loProcessfile.cOutput

                        ' Remove empty lines
                        cCommandLineFullOutput = oApp.StrTran(cCommandLineFullOutput, oApp.cCR + oApp.cCR, oApp.cCR)

                        ' End-of-central-directory signature not found.
                        If oApp.At("End-of-central-directory signature not found.", loProcessfile.cOutput) > 0 Then
                            cMessage = cEndOfCentralDirectorySignatureNotFound
                            Exit For
                        End If

                        ' End-of-central-directory signature not found.
                        If oApp.At(" CRC check failed", loProcessfile.cOutput) > 0 Then
                            cMessage = oApp.StrTran(cTheFileIsCorrupted, "##File##", cFile)
                            Exit For
                        End If

                        ' If we have a caution
                        lnLocation = oApp.At("CAUTION: ", UCase(cCommandLineFullOutput))

                        ' If we did not find it
                        If lnLocation = 0 Then

                            ' If we have an error
                            lnLocation = oApp.At("FATAL ERROR: ", UCase(cCommandLineFullOutput))

                            ' If we did not find it
                            If lnLocation = 0 Then

                                ' If we have an error
                                lnLocation = oApp.At("ERROR: ", UCase(cCommandLineFullOutput))

                            End If

                        End If

                        ' If we found one
                        If lnLocation > 0 Then
                            cMessage = Mid(cCommandLineFullOutput, lnLocation)

                            ' If we have a carriage return
                            lnLocation = oApp.At(oApp.cCR, cMessage)

                            ' If we found it
                            If lnLocation > 0 Then
                                cMessage = Mid(cMessage, 1, lnLocation - 1)
                            End If

                            Exit Try
                        End If

                    End If
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform