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 ZipMan class 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 StartFromZipFile and the StartSplitFromZipFile 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; if a recoding session should be available, you may add it to the opened ZIP file trough the RecordedSound.AddToZip method directly.
During lengthy operations for both compression and decompression, the container application is notified through the CallbackZipOperationPerc delegate which reports the current percentage of advancement.
Existing entries can be removed through the ZIP.EntryRemove method.
Samples of use of the ZipMan class in Visual C#.NET and Visual Basic.NET can be found inside the following samples installed with the product's setup package: