ArchiveFactory.GetArchive

GetArchive(string)

Detects the archive format and creates the appropriate IArchive object according to the type of archive specified by the given path.

public static IArchive GetArchive(string path)
ParameterTypeDescription
pathStringThe path to the archive to be analyzed.

Return Value

An IArchive object representing the archive.

Exceptions

exceptioncondition
ArgumentNullExceptionpath is null.
DirectoryNotFoundExceptionThe specified path is invalid, (for example, it is on an unmapped drive).
FileNotFoundExceptionThe file specified in path was not found.
IOExceptionAn I/O error occurred while opening the file.
PathTooLongExceptionThe specified path, file name, or both exceed the system-defined maximum length.
UnauthorizedAccessExceptionpath specified a directory. -or- The caller does not have the required permission.

See Also


GetArchive(Stream)

Detects the archive format and creates the appropriate IArchive object according to the type of archive specified by the given stream.

public static IArchive GetArchive(Stream stream)
ParameterTypeDescription
streamStreamThe stream containing the archive data. It must be seekable.

Return Value

An IArchive object representing the archive.

Exceptions

exceptioncondition
ArgumentExceptionstream is not seekable.
ArgumentNullExceptionstream is null.

See Also


GetArchive(Stream, string)

Detects the archive format and creates the appropriate IArchive object according to the type of encrypted archive specified by the given stream.

public static IArchive GetArchive(Stream stream, string password)
ParameterTypeDescription
streamStreamThe stream containing the archive data. It must be seekable.
passwordStringPassword to decrypt an encrypted archive.

Return Value

An IArchive object representing the archive.

Exceptions

exceptioncondition
ArgumentExceptionstream is not seekable.
ArgumentNullExceptionstream is null.

See Also