Platforms to show: All Mac Windows Linux Cross-Platform

/Compression/Old ZipMBS class/zip without compression


Required plugins for this example: MBS Main Plugin, MBS MacClassic Plugin, MBS Compression Plugin, MBS Images Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Compression/Old ZipMBS class/zip without compression

This example is the version from Tue, 3rd Aug 2015.

Project "zip without compression.xojo_binary_project"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
EventHandler Sub Open() MakeTestFiles run "test.zip", true run "test no compression.zip", false End EventHandler
Sub AddFile(z as ZipMBS, f as FolderItem, compress as Boolean) dim b as BinaryStream dim info as ZipFileInfoMBS dim d as date 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.ExternalFileAttributes=0 info.InternalFileAttributes=0 info.DosDate=0 if compress then // with compression: z.CreateFile f.name, info, "", "", f.CommentMBS, z.MethodDeflated, z.CompressionBestCompression else // no compression z.CreateFile f.name, info, "", "", f.CommentMBS, z.MethodNone, z.CompressionNo end if while not b.EOF z.Write b.Read(100000) wend z.CloseFile End Sub
Sub MakeTestFiles() dim f as FolderItem dim p as Picture p=LogoMBS(500) f=SpecialFolder.Desktop.Child("test.jpg") f.SaveAsJPEG p f=SpecialFolder.Desktop.Child("test.png") call f.SaveAsPNGMBS(p,0) dim m as MemoryBlock = New MemoryBlock(1024*1024*10) dim s as string = m f = SpecialFolder.Desktop.Child("test.txt") // Change to this in newer RB Versions: BinaryStream.Create(f, true) dim b as BinaryStream = f.CreateBinaryFile("") b.Write s End Sub
Sub run(name as string, compress as Boolean) dim f as FolderItem = SpecialFolder.Desktop.Child(name) dim z as new ZipMBS(f,0) AddFile z, SpecialFolder.Desktop.Child("test.jpg"), compress AddFile z, SpecialFolder.Desktop.Child("test.png"), compress AddFile z, SpecialFolder.Desktop.Child("test.txt"), compress z.Close("global comment") End Sub
End Class
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
End Class
End Project

See also:

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


The biggest plugin in space...