How to manage ZIP files
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 Recorder 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 ZIP 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.
During lengthy operations for both compression and decompression, the container application is notified through the ZipOperationStart event followed by a number of ZipOperationPerc events and finally by the ZipOperationDone event.
Existing entries can be removed through the ZIP.EntryRemove method.
Samples of use of the ZIP object in Visual Basic 6 and Visual C++ 6 can be found inside the following samples installed with the product's setup package: