The SevenZip class implements a 7zip-compatible compressor and decompressor.
To create a new archive, first set the archive_file property to the name of the archive to be created. Then, specify the files to be compressed either by invoking include_files, or by adding a new object to the files collection and setting the values of the file_decompressed_name and file_compressed_name. fields. Finally, call the compress method to create the archive.
To decompress an existing archive, set archive_file to the name of the archive to be decompressed. The extract_to_path property may be set, and then calling the extract_all 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 file_decompressed_name may then be changed if desired. Finally, extract_all may be used to decompress the entire archive, or extract may be used for finer control.
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()
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
|archive_file||The name of the zip, gzip, tar, or jar archive.|
|compression_level||The compression level to use.|
|compression_method||Used to set the method of compression.|
|excluded_files||A list of files to exclude.|
|extract_to_path||A base path to decompress to.|
|file_count||The number of records in the File arrays.|
|file_attributes||The attributes of the files to be compressed or decompressed.|
|file_compressed_date||The date and time of the entry, as stored within the archive.|
|file_compressed_name||The file name of the current file, as stored inside of the archive.|
|file_compressed_size||The size of the compressed data, as compressed within the archive.|
|file_compression_level||The compression level to use for the file.|
|file_compression_method||This property specifies the compression method used for the individual file.|
|file_crc||The CRC value for the specified file found in the archive.|
|file_decompressed_name||The name of the file in the archive, as stored on the file system, outside the archive.|
|file_decompressed_size||The size of the file, as decompressed outside the archive.|
|file_input_data||When 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.|
|overwrite_files||Whether or not to overwrite files.|
|password||A password for the zip archive.|
|recurse_subdirectories||Whether or not to recurse into subdirectories.|
|seven_zip_data||(Decompression only) The seven zip file contents as a byte array.|
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
|abort||Aborts the current operation.|
|append_files||Adds specified files to an existing archive.|
|compress||Creates the compressed archive.|
|config||Sets or retrieves a configuration setting.|
|delete||Deletes one or more files from an existing archive.|
|extract||Extracts a single file, directory, or group of files, from the archive.|
|extract_all||Extracts all files from the compressed archive.|
|include_files||Specifies that the indicated files should be added to the archive.|
|reset||Resets the class.|
|scan||Scans the compressed archive.|
|update||Will update certain files in an archive.|
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
|on_begin_file||Fired before each file is processed.|
|on_end_file||Fired after each file is processed.|
|on_error||Information about non-fatal errors.|
|on_overwrite||Fired whenever a file exists and may be overwritten.|
|on_progress||Fired as progress is made.|
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
|CheckForFileLocks||If true, the class requests an exclusive lock during initialization.|
|EnableFilter||Enables or disables compression filters for executable files.|
|EnableHeaderCompression||Enables or disables archive header compression.|
|EnableHeaderEncryption||Enables or disables archive header encryption.|
|ExcludedAttributes||Attributes of files to be excluded.|
|ExtractFilesOnly||Whether to only extract the files contained within the archive.|
|IsEncrypted||Indicates whether the archive is encrypted.|
|OverwriteReadonlyFiles||Whether to overwrite readonly files.|
|TempPath||A temporary directory where data can be stored during processing.|
|WriteToProgressEvent||Whether or not to write data to the Progress Event.|
|BuildInfo||Information about the product's build.|
|CodePage||The system code page used for Unicode to Multibyte translations.|
|LicenseInfo||Information about the current license.|
|ProcessIdleEvents||Whether the class uses its internal event loop to process events when the main thread is idle.|
|SelectWaitMillis||The length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.|
|UseInternalSecurityAPI||Tells the class whether or not to use the system security libraries or an internal implementation.|