Example: /Compression/Old ZipMBS class/zip with encryption

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/Compression/Old ZipMBS class/zip 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/zip with encryption

This example is the version from Fri, 26th Nov 2020.

Project "zip with encryption.xojo_binary_project"
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
EventHandler Sub Open() const WindowBits = 15 const memLevel = 8 const password = "Hello" dim z as ZipMBS dim f as FolderItem dim d as date dim b as BinaryStream dim info as ZipFileInfoMBS f=SpecialFolder.Desktop.Child("test.zip") z=new ZipMBS(f,0) f=FindFile("ZLib Readme and License.txt") b=f.OpenAsBinaryFile(false) d=f.ModificationDate info=new ZipFileInfoMBS 'info.Day=d.day 'info.Month=d.Month-1 'info.Year=d.Year 'info.Minute=d.Minute 'info.hour=d.hour 'info.Second=d.Second info.SetDate d info.ExternalFileAttributes=0 info.InternalFileAttributes=0 info.DosDate=0 dim data as string = b.Read(b.Length) dim crc as integer = CRC32StringMBS(0, data) z.CreateFile("zip.rbp", info, "", "", "", z.MethodDeflated, z.CompressionBestCompression, false, false, WindowBits, memLevel, z.StrategyDefault, password, crc) z.Write data z.CloseFile z.Close("global comment") quit End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
End Class
FileTypes
Filetype text
End FileTypes
End Project

See also:

The items on this page are in the following plugins: MBS Compression Plugin.


💬 Ask a question or report a problem