Class SharpSevenZipArchiveFormat
Check the format of archives.
Inherited Members
Namespace: SharpSevenZip
Assembly: SharpSevenZip.dll
Syntax
public static class SharpSevenZipArchiveFormat
Methods
| Edit this page View SourceCheckFormat(Stream)
Gets the InArchiveFormat for a specific extension.
Declaration
public static InArchiveFormat CheckFormat(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to identify. |
Returns
| Type | Description |
|---|---|
| InArchiveFormat | Corresponding InArchiveFormat. |
CheckFormat(Stream, out int, out bool)
Gets the InArchiveFormat for a specific extension.
Declaration
public static InArchiveFormat CheckFormat(Stream stream, out int offset, out bool isExecutable)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to identify. |
| int | offset | The archive beginning offset. |
| bool | isExecutable | True if the original format of the stream is PE; otherwise, false. |
Returns
| Type | Description |
|---|---|
| InArchiveFormat | Corresponding InArchiveFormat. |
CheckFormat(string)
Gets the InArchiveFormat for a specific file name.
Declaration
public static InArchiveFormat CheckFormat(string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | The archive file name. |
Returns
| Type | Description |
|---|---|
| InArchiveFormat | Corresponding InArchiveFormat. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
CheckFormat(string, out int, out bool)
Gets the InArchiveFormat for a specific file name.
Declaration
public static InArchiveFormat CheckFormat(string fileName, out int offset, out bool isExecutable)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | The archive file name. |
| int | offset | The archive beginning offset. |
| bool | isExecutable | True if the original format of the file is PE; otherwise, false. |
Returns
| Type | Description |
|---|---|
| InArchiveFormat | Corresponding InArchiveFormat. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
TryCheckFormat(Stream, out ArchiveFormatInfo)
Probes a stream for its archive format without throwing when it is not a recognised archive.
Declaration
public static bool TryCheckFormat(Stream stream, out ArchiveFormatInfo info)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to identify. |
| ArchiveFormatInfo | info | The full detection result (format, offset and executable flag). |
Returns
| Type | Description |
|---|---|
| bool | True when a recognised archive format was found; otherwise, false. |
TryCheckFormat(string, out ArchiveFormatInfo)
Probes a file for its archive format without throwing when it is not a recognised archive.
Declaration
public static bool TryCheckFormat(string fileName, out ArchiveFormatInfo info)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | The archive file name. |
| ArchiveFormatInfo | info | The full detection result (format, offset and executable flag). Pass it to SharpSevenZipExtractor(string, ArchiveFormatInfo) to open the archive without detecting the signature again. |
Returns
| Type | Description |
|---|---|
| bool | True when a recognised archive format was found; otherwise, false. |