SevenZipFile Type

The file in the archive.

Remarks

This type contains information about the file that either exists in the archive or is being added to the archive.

Fields

Attributes
Integer

The attributes of the files to be compressed or decompressed. It will then be written to the archive during compression and to the file system during extraction.

If desired, you may change the value of Attributes before compressing or decompressing.

The property is a bitmask of flags, corresponding to the MS-DOS directory byte:

Readonly1
Hidden2
System4
Directory16
Archive32

In the Java Edition, due to limitations of the JRE, the effect of this property is limited. When including files, only the Hidden and Readonly bits will be read from the file system, and during extraction only the Readonly attribute will be written.

CompressedDate
Long

The date and time of the entry, as stored within the archive.

FileCompressedDate contains the last modified date of the file, as stored within the archive (it does not generally correspond to when the file was compressed).

FileCompressedDate is returned in a platform-specific format. The Java,C++, and most other Editions will return the number of milliseconds since January 1, 1970, 00:00:00. This value may be passed directly to the java.util.Date constructor to create a java.util.Date object representing this date.

The .NET Edition will return the number of ticks, or 100-nanosecond intervals, since January 1, 0001, 00:00:00. This value may be passed directly to the System.DateTime constructor to create a System.DateTime object representing this date.

Reading the value of this property will return a meaningful value only after the archive has been successfully scanned or decompressed, and only if the values of ArchiveFile, Files collection, and CompressedName have not been changed since. If a meaningful value is not available this property will return a value of 0.

NOTE: This may be set accordingly when the InputStream field is set to a valid stream to input the data for the current file. If not set, the default, 0, is used. Otherwise the value is read from disk.

CompressedName
String

The file name of the current file, as stored inside of the archive. This may be the same as in DecompressedName, but is not required to be.

All paths are stored in the archive in standard (UNIX) format. Pathnames specified in the host operating system's format will be immediately converted.

This field should generally be set with a relative path or with no path at all. The exact interpretation of the path is left to the decompression software; generally, pathnames will be interpreted as relative to a base directory, and these subdirectories will be created as needed. Absolute pathnames will not be interpreted correctly by the component, and may or may not be interpreted correctly by other decompression software.

Paths should be specified in standard (UNIX) format. They may also be specified in the format native to the host operating system, in which case they will be immediately converted.

Example


ZipControl.ArchiveFile = "c:\test.zip"
ZipControl.Files.Add(new ZIPFile())
ZipControl.Files[0].DecompressedName = "c:\test\ipworkszip\temp\test.txt"
ZipControl.Files[0].CompressedName = "readme.txt"
ZipControl.Compress()

CompressedSize
Long

The size of the compressed data, as compressed within the archive. Headers, footers, etc., are not included in the size.

Reading the value of this property will return a meaningful value only after the archive has been compressed, and only if the values of ArchiveFile, or Files have not been changed since.

CompressionLevel
Integer

The compression level to use for the file. This field specifies the level of compression to be used, valid values are 1, 2, 3, 4 and 5. Higher values will cause the component to compress better; lower values will cause the component to compress faster.

The default value is -1, which means the value specified in the CompressionLevel property will be used.

CompressionMethod
SevenzipCompressionMethods

This field specifies the compression method used for the individual file. The compression method set here is applicable to this file only. Possible values are:

ValueMethod
cmszLzma (0 - default) LZMA
cmszBzip2 (1) BZip2
cmszDelta (2) Delta
cmszCopy (3) Copy (no compression)
cmszDefalte (4) Deflate
cmszDefalte (5) LZMA2

If this field is not set, the method specified by the CompressionMethod property will be used. Note that different files in the archive may use different compression methods.

CRC
Long

The CRC value for the specified file found in the archive. This value is populated after compression or decompression.

DecompressedName
String

The name of the file in the archive, as stored on the file system, outside the archive.

When compressing files, This field should be specified with a path, if necessary, to allow the file to be found by the component. If the file cannot be found during compression, a trappable error will be generated, and the archive will not be correctly written.

When decompressing files, the field indicates where the file should be written. After the archive is scanned, the values of CompressedName and DecompressedName will be set to the exact filenames found in the archive. The value of DecompressedName may then be changed if desired.

If DecompressedName is set to an empty string before extraction, the file will not be written to disk at all. It will still be written to the Progress event if WriteToProgressEvent is set to true.

If DecompressedName is set to an empty string before compression, the file will be skipped, and not written to the archive.

A base path for decompression may be specified by setting the ExtractToPath property. If ExtractToPath is set to a non-empty string, the files will be decompressed to the directory specified in ExtractToPath. If the value of DecompressedName contains a pathname it will be regarded as relative to ExtractToPath.

Paths on the local file system should be specified in the format native to the host operating system. They may also be specified in standard (UNIX) format, in which case they will be immediately converted.

Example


ZipControl.ArchiveFile = "c:\test.tar"
ZipControl.Scan()
ZipControl.ExtractToPath = "c:\temp\"
ZipControl.Files[1].DecompressedName = "test\temp.out"
ZipControl.Extract(ZipControl.Files[1].CompressedName)
Incorrect Example
ZipControl.ExtractToPath = "c:\temp\"
ZipControl.Files[1].DecompressedName = "c:\temp\test\temp.out"
'The file would be extracted to c:\temp\c:\temp\test\temp.out

DecompressedSize
Long

The size of the file, as decompressed outside the archive. If an archive is open for read (i.e. has been scanned or decompressed), this information will be read from the archive headers. If an archive is not open for read, the component will retrieve the information for the corresponding value of DecompressedName from the local file system.

A value of -1 will be returned in case of an I/O error.

InputData
String

When This field is set, the component will read in the data from This field instead of reading from the file contained in the DecompressedName field.

InputDataB
Byte[]

When This field is set, the component will read in the data from This field instead of reading from the file contained in the DecompressedName field.

InputStream
System.IO.Stream

When This field is set to a valid stream, the component will read in the data from the stream as the current file instead of reading from the file contained in the DecompressedName field.

Constructors

public SevenZipFile();
Public SevenZipFile()
public SevenZipFile(string decompressedName);
Public SevenZipFile(ByVal DecompressedName As String)
public SevenZipFile(string compressedName, string decompressedName);
Public SevenZipFile(ByVal CompressedName As String, ByVal DecompressedName As String)
public SevenZipFile(string compressedName, System.IO.Stream inputStream);
Public SevenZipFile(ByVal CompressedName As String, ByVal InputStream As System.IO.Stream)

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