Platforms to show: All Mac Windows Linux Cross-Platform
/Compression/Old ZipMBS class/unzip with encryption
Required plugins for this example: MBS Compression Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Compression/Old ZipMBS class/unzip with encryption
This example is the version from Fri, 26th Nov 2020.
Project "unzip with encryption.xojo_binary_project"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
Control EditField1 Inherits TextArea
ControlInstance EditField1 Inherits TextArea
End Control
EventHandler Sub Open()
Const password = "Hello"
dim f as FolderItem
Dim z As UnZipMBS
dim lines(-1) as string
dim s as string
Dim info As UnZipFileInfoMBS
f=SpecialFolder.Desktop.Child("test.zip")
z=new UnZipMBS(f)
lines.Append "Global Comment: "+z.Comment
lines.Append "FileCount: "+str(z.Count)
z.GoToFirstFile
do
lines.Append "FileOffset: "+str(z.Offset)
lines.Append "CurrentFileName: "+z.FileName
info=z.FileInfo
lines.Append "uncompressedSize: "+str(info.uncompressedSize)
lines.Append "compressedSize: "+str(info.compressedSize)
lines.Append "date: "+info.date.ShortDate+" "+info.date.ShortTime
z.OpenCurrentFile(password)
if z.Lasterror=0 then
lines.Append "GetLocalExtrafield: "+z.GetLocalExtrafield
lines.Append "eof: "+str(z.eof)
lines.Append "Position: "+str(z.Position)
s=z.ReadCurrentFile(100000)
If z.Lasterror = 0 Then
'MsgBox s
lines.Append "eof: "+Str(z.eof)
lines.Append "Position: "+Str(z.Position)
Else
// error -3 here on wrong password
MsgBox "Failed with error: "+Str(z.Lasterror)
End If
z.CloseCurrentFile
Else
MsgBox "Failed with error: "+Str(z.Lasterror)
end if
z.GoToNextFile
loop until z.Lasterror<>0
EditField1.text=Join(lines,EndOfLine)
End EventHandler
Protected Function str(b as boolean) As string
if b then
Return "true"
else
Return "false"
end if
End Function
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu5 = ""
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu4 = ""
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = ""
End MenuBar
Class App Inherits Application
End Class
End Project
See also:
- /Compression/Old ZipMBS class/create epub file
- /Compression/Old ZipMBS class/ExtractFiles test
- /Compression/Old ZipMBS class/test huge files with big archive
- /Compression/Old ZipMBS class/unzip with memory
- /Compression/Old ZipMBS class/unzip with offset
- /Compression/Old ZipMBS class/unzip with string
- /Compression/Old ZipMBS class/zip
- /Compression/Old ZipMBS class/zip folder with encryption
- /Compression/Old ZipMBS class/zip images
- /Compression/Old ZipMBS class/zip images with offset
The items on this page are in the following plugins: MBS Compression Plugin.