SevenZipArchiveEntry Class
An entry of a SevenZipArchive. The times, the attributes and the Unix permissions of an entry can be changed in SevenZipArchiveMode.Create and SevenZipArchiveMode.Update modes with the Set methods (the properties of ArchiveEntry are read-only, and C# cannot add a setter to an overridden property).
public sealed class SevenZipArchiveEntry : ArchiveEntry- Inheritance
ArchiveEntrySevenZipArchiveEntry
Properties
| Name | Description |
|---|---|
| Archive | Gets the archive of the entry. |
| Attributes | Gets the Windows attributes of the entry, without the bit with which 7-Zip marks the Unix permissions. |
| CompressedLength | Gets the length of the packed content of the folder of the entry when the entry is the only file of its folder, 0 for an entry without content, or -1 when the folder has several files (a solid folder) or is not written yet. |
| Crc32 | Gets the CRC-32 of the content of the entry, or null when the archive does not store it. |
| CreationTime | Gets the time the entry was created, or null when the archive does not store it. |
| FullName | Gets the path of the entry in the archive, with / separators. The name of a directory ends with /. |
| IsDirectory | Gets a value indicating whether the entry is a directory. |
| IsEncrypted | Gets a value indicating whether the content of the entry is encrypted with AES-256. |
| LastAccessTime | Gets the last time the entry was accessed, or null when the archive does not store it. |
| LastWriteTime | Gets the last time the entry was modified, or null when the archive does not store it. |
| Length | Gets the length of the content of the entry. For a new entry, it is the number of bytes written to it. |
| LinkTarget | Gets the target of a symbolic link (an entry whose Unix mode is a link: its content is the target), or null. |
| UnixFileMode | Gets the Unix permissions of the entry, which 7-Zip stores in the high 16 bits of the attributes. |
Archive
SevenZipArchiveEntry.csAttributes
SevenZipArchiveEntry.csGets the Windows attributes of the entry, without the bit with which 7-Zip marks the Unix permissions.
public override FileAttributes? Attributes { get; }Property value
CompressedLength
SevenZipArchiveEntry.csCreationTime
SevenZipArchiveEntry.csGets the time the entry was created, or null when the archive does not store it.
public override DateTimeOffset? CreationTime { get; }Property value
FullName
SevenZipArchiveEntry.csIsDirectory
SevenZipArchiveEntry.csIsEncrypted
SevenZipArchiveEntry.csLastAccessTime
SevenZipArchiveEntry.csGets the last time the entry was accessed, or null when the archive does not store it.
public override DateTimeOffset? LastAccessTime { get; }Property value
LastWriteTime
SevenZipArchiveEntry.csGets the last time the entry was modified, or null when the archive does not store it.
public override DateTimeOffset? LastWriteTime { get; }Property value
Length
SevenZipArchiveEntry.csLinkTarget
SevenZipArchiveEntry.csUnixFileMode
SevenZipArchiveEntry.csGets the Unix permissions of the entry, which 7-Zip stores in the high 16 bits of the attributes.
public override UnixFileMode? UnixFileMode { get; }Property value
Methods
| Name | Description |
|---|---|
| Delete() | Deletes the entry from the archive. |
| Open() | Opens the content of the entry: a read-only stream for an entry of the archive, or a write-only stream for a new entry (once). The read stream checks the CRC-32 of the content at its end. |
| SetAttributes(FileAttributes?) | Sets the Windows attributes of the entry (their low 16 bits). The Unix permissions are kept. |
| SetCreationTime(DateTimeOffset?) | Sets the time the entry was created. |
| SetLastAccessTime(DateTimeOffset?) | Sets the last time the entry was accessed. |
| SetLastWriteTime(DateTimeOffset?) | Sets the last time the entry was modified. |
| SetUnixFileMode(UnixFileMode?) | Sets the Unix permissions of the entry, which 7-Zip stores in the high 16 bits of the attributes with the type of the entry (a file, a directory or a symbolic link). |
Delete()
SevenZipArchiveEntry.csDeletes the entry from the archive.
public void Delete()Exceptions
NotSupportedException- The archive is not in
SevenZipArchiveMode.Updatemode.
Open()
SevenZipArchiveEntry.csOpens the content of the entry: a read-only stream for an entry of the archive, or a write-only stream for a new entry (once). The read stream checks the CRC-32 of the content at its end.
public override Stream Open()Returns
Stream The content of the entry.
Exceptions
InvalidOperationException- The entry is a directory, or another new entry is being written.
IOException- The new entry is already opened.
InvalidDataException- The archive is corrupted.
ArchivePasswordException- The entry is encrypted and the password is missing or wrong.
NotSupportedException- The entry is compressed with a method that is not supported.
SetAttributes(FileAttributes?)
SevenZipArchiveEntry.csSets the Windows attributes of the entry (their low 16 bits). The Unix permissions are kept.
public void SetAttributes(FileAttributes? value)Parameters
valueFileAttributes?- The attributes, or
nullto not store them.
SetCreationTime(DateTimeOffset?)
SevenZipArchiveEntry.csSets the time the entry was created.
public void SetCreationTime(DateTimeOffset? value)Parameters
valueDateTimeOffset?- The time, or
nullto not store it.
SetLastAccessTime(DateTimeOffset?)
SevenZipArchiveEntry.csSets the last time the entry was accessed.
public void SetLastAccessTime(DateTimeOffset? value)Parameters
valueDateTimeOffset?- The time, or
nullto not store it.
SetLastWriteTime(DateTimeOffset?)
SevenZipArchiveEntry.csSets the last time the entry was modified.
public void SetLastWriteTime(DateTimeOffset? value)Parameters
valueDateTimeOffset?- The time, or
nullto not store it.
SetUnixFileMode(UnixFileMode?)
SevenZipArchiveEntry.csSets the Unix permissions of the entry, which 7-Zip stores in the high 16 bits of the attributes with the type of the entry (a file, a directory or a symbolic link).
public void SetUnixFileMode(UnixFileMode? value)Parameters
valueUnixFileMode?- The permissions, or
nullto not store them.