Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

You find this example project in your Plugins Download as a Xojo (Real Studio) project file within the examples folder: /Compression/zip
This example is the version from Thu, 6th Apr 2016.
Project "zip.rbp"
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub Open() 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 z.CreateFile "ZLib Readme and License.txt", info, "extra local1", "extra global1", "comment1", z.MethodDeflated, z.CompressionBestCompression while not b.EOF z.Write b.Read(100000) wend 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
Filetype text
End FileTypes
End Project

See also:

Feedback, Comments & Corrections

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

MBS FileMaker blog