SevenZip Class

Properties   Methods   Events   Configuration Settings   Errors  

The SevenZip class implements a 7zip-compatible compressor and decompressor.

Syntax

SevenZip

Remarks

To create a new archive, first set the ArchiveFile property to the name of the archive to be created. Then, specify the files to be compressed either by invoking IncludeFiles, or by adding a new object to the Files collection and setting the values of the FileDecompressedName and FileCompressedName. fields. Finally, call the Compress method to create the archive.

To decompress an existing archive, set ArchiveFile to the name of the archive to be decompressed. The ExtractToPath property may be set, and then calling the ExtractAll method will decompress all files in the archive to this path.

For finer control, the Scan method should be used to read the file information stored in the archive. This will fill out the information in the Files collection. The values of FileDecompressedName may then be changed if desired. Finally, ExtractAll may be used to decompress the entire archive, or Extract may be used for finer control.

Data may be streamed out by setting WriteToProgressEvent to true. Then, the Progress event may be trapped to retrieve the data.

Example (Creating an Archive)


ZipControl.ArchiveFile = "c:\test.zip"
ZipControl.RecurseSubdirectories = true
ZipControl.IncludeFiles("c:\foo\*")
ZipControl.Compress()

Example (Extracting from an Archive)


ZipControl.ArchiveFile = "c:\temp.zip"
ZipControl.ExtractToPath = "c:\extracted\"
ZipControl.ExtractAll()

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

ArchiveFileThe name of the zip, gzip, tar, or jar archive.
CompressionLevelThe compression level to use.
CompressionMethodUsed to set the method of compression.
ExcludedFilesA list of files to exclude.
ExtractToPathA base path to decompress to.
FileCountThe number of records in the File arrays.
FileAttributesThe attributes of the files to be compressed or decompressed.
FileCompressedDateThe date and time of the entry, as stored within the archive.
FileCompressedNameThe file name of the current file, as stored inside of the archive.
FileCompressedSizeThe size of the compressed data, as compressed within the archive.
FileCompressionLevelThe compression level to use for the file.
FileCompressionMethodThis property specifies the compression method used for the individual file.
FileCRCThe CRC value for the specified file found in the archive.
FileDecompressedNameThe name of the file in the archive, as stored on the file system, outside the archive.
FileDecompressedSizeThe size of the file, as decompressed outside the archive.
FileInputDataWhen This property is set, the class will read in the data from This property instead of reading from the file contained in the DecompressedName property.
FileInputStreamWhen This property is set to a valid stream, the class will read in the data from the stream as the current file instead of reading from the file contained in the DecompressedName property.
OverwriteFilesWhether or not to overwrite files.
PasswordA password for the zip archive.
RecurseSubdirectoriesWhether or not to recurse into subdirectories.
SevenZipData(Decompression only) The seven zip file contents as a byte array.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

AbortAborts the current operation.
AppendFilesAdds specified files to an existing archive.
CompressCreates the compressed archive.
ConfigSets or retrieves a configuration setting.
DeleteDeletes one or more files from an existing archive.
ExtractExtracts a single file, directory, or group of files, from the archive.
ExtractAllExtracts all files from the compressed archive.
IncludeFilesSpecifies that the indicated files should be added to the archive.
ResetResets the class.
ScanScans the compressed archive.
SetArchiveInputStreamThe stream to read the zip, tar, jar, or gzip archive from.
SetArchiveOutputStreamThe stream to write the zip, tar, jar, or gzip archive to.
UpdateWill update certain files in an archive.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

BeginFileFired before each file is processed.
EndFileFired after each file is processed.
ErrorInformation about non-fatal errors.
OverwriteFired whenever a file exists and may be overwritten.
ProgressFired as progress is made.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

BeginFileOnUpdateEnables or disables events firing when updating existing archives.
CheckForFileLocksIf true, the class requests an exclusive lock during initialization.
EnableFilterEnables or disables compression filters for executable files.
EnableHeaderCompressionEnables or disables archive header compression.
EnableHeaderEncryptionEnables or disables archive header encryption.
ExcludedAttributesAttributes of files to be excluded.
ExtractFilesOnlyWhether to only extract the files contained within the archive.
IsEncryptedIndicates whether the archive is encrypted.
OverwriteReadonlyFilesWhether to overwrite readonly files.
TempPathA temporary directory where data can be stored during processing.
WriteToProgressEventWhether or not to write data to the Progress Event.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks ZIP 2020 C++ Edition - Version 20.0 [Build 8300]