Copyright © 2011-2023 MultiMedia Soft

How to manage ZIP files

Previous pageReturn to chapter overviewNext page

ZIP is an archive file format that supports lossless data compression. A ".ZIP" file may contain one or more files or directories that may have been compressed. Audio Sound Editor API for .NET comes with embedded support for this format and, apart from being able to manage general compression and decompression of files, allows storing recording sessions inside ZIP files that may be optionally protected with AES encryption.

 

ZIP files can be managed through the ZipMan class COM object accessible through the ZIP property; existing ZIP files can be opened with the ZIP.Open method: this method allows specifying a password that could be used for accessing entries protected through the legacy ZIP 2.0 encryption or through the latest AES encryption: you can know if a ZIP file is protected through the ZIP.IsProtected method.

 

You may also create a brand new ZIP file from scratch using the ZIP.Create method: also in this case you would have the option to protect your new ZIP file through encryption.

 

Once opened or created, existing entries of the ZIP file can be enumerated through the combination of the ZIP.EntriesCountGet and ZIP.EntryNameGet methods and extracted on the local disk through the ZIP.EntryExtractToFile method or inside a memory buffer through the ZIP.EntryExtractToMemory method: in this latest case, you can know how much room is needed for allocating the buffer through the ZIP.EntryUncompressedSizeGet method. It's important to note that, in order to load a sound file contained inside the ZIP file, the component doesn't need to extract it: the LoadSoundFromZip and the LoadSoundChannelFromZip methods can extract and automatically load the sound file from the ZIP.

 

New entries can be added by storing local disk files through the ZIP.EntryAdd method or by storing contents of a memory buffer through the ZIP.EntryAddFromMemory method.

 

During lengthy operations for both compression and decompression, the container application is notified about the current percentage of advancement through the CallbackPercentage delegate with the nOperation parameter set to OPERATION_ZIP.

 

Existing entries can be removed through the ZIP.EntryRemove method.

 

Once ZIP management is completed, you can save your modifications through the ZIP.Save method and close the ZIP management session through the ZIP.Close method.

 

 

Samples of use of the ZIP object in Visual C#.NET and Visual Basic.NET can be found inside the following samples installed with the product's setup package:

- SoundEditor