C# Класс Nexus.Client.Util.Archive

Encapsulates the interactions with an archive file.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
m_lstNonArchiveExtensions List

Открытые методы

Метод Описание
Archive ( string p_strPath ) : System

A simple constructor the initializes the object with the given values.

BeginReadOnlyTransaction ( FileUtil p_futFileUtil ) : void

Starts a read-only transaction.

This puts the archive into read-only mode.

ChangeArchiveDirectory ( string p_strArchivePath, string p_strNewArchiveDirectory ) : string

Changes the directory of the archive referenced in the given path to the specified new directory.

This changes something of the form: arch:old\path\archive.zip//interior/path/file.txt to: arch:new\path\archive.zip//interior/path/file.txt

ContainsFile ( string p_strPath ) : bool

Determins if the archive contains the specified file.

DeleteFile ( string p_strFileName ) : void

Deletes the specified file from the archive.

If the specified file doesn't exist in the archive, nothing is done.

Dispose ( ) : void

Disposes of the resources used by the object.

EndReadOnlyTransaction ( ) : void

Ends a read-only transaction.

This takes the archive out of read-only mode, and releases any used resources.

GenerateArchivePath ( string p_strArchivePath, string p_strInternalPath ) : string

Generates a path to a file in an archive.

GetDirectories ( string p_strDirectory ) : string[]

Gets a list of directories that are in the specified directory in this archive.

GetExtractor ( string p_strPath ) : SevenZip.SevenZipExtractor

Gets a SevenZipExtractor for the given path.

This builds a SevenZipExtractor for the given path. The path can be to a nested archive (an archive in another archive).

GetFileContents ( string p_strPath ) : byte[]

Gets the contents of the specified file in the archive.

GetFiles ( string p_strDirectory, bool p_booRecurse ) : string[]

Gets a list of files that are in the specified directory in this archive.

GetFiles ( string p_strDirectory, string p_strPattern, bool p_booRecurse ) : string[]

Gets a list of files that are in the specified directory and match the given pattern in this archive.

GetThreadSafeExtractor ( string p_strPath ) : ThreadSafeSevenZipExtractor

Gets a ThreadSafeSevenZipExtractor for the given path.

This builds a ThreadSafeSevenZipExtractor for the given path. The path can be to a nested archive (an archive in another archive).

IsArchive ( string p_strPath ) : bool

Determines whether or not the file specified by the given path is an archive.

IsArchivePath ( string p_strPath ) : bool

Determines whether or not the given path points to a file in an archive.

IsDirectory ( string p_strPath ) : bool

Determins if the given path is a directory in this archive.

ParseArchivePath ( string p_strPath ) : string>.KeyValuePair

Parses the given path to extract the path to the archive file, and the path to a file within said archive.

ReplaceFile ( string p_strFileName, byte p_bteData ) : void

Replaces the specified file in the archive with the given data.

If the specified file doesn't exist in the archive, the file is added.

ReplaceFile ( string p_strFileName, string p_strData ) : void

Replaces the specified file in the archive with the given data.

If the specified file doesn't exist in the archive, the file is added.

Защищенные методы

Метод Описание
LoadFileIndices ( ) : void

Caches information about the files in the archive.

Приватные методы

Метод Описание
FileExtractionFinished ( object sender, SevenZip.FileInfoEventArgs e ) : void

Called when a file has been extracted from a source archive.

This notifies listeners that a read-only initialization step has finished.

GetExtractor ( string p_strPath, bool p_booThreadSafe ) : object

Gets a SevenZipExtractor for the given path.

This builds a SevenZipExtractor for the given path. The path can be to a nested archive (an archive in another archive).

Описание методов

Archive() публичный Метод

A simple constructor the initializes the object with the given values.
public Archive ( string p_strPath ) : System
p_strPath string The path to the archive file.
Результат System

BeginReadOnlyTransaction() публичный Метод

Starts a read-only transaction.
This puts the archive into read-only mode.
Thrown if is null.
public BeginReadOnlyTransaction ( FileUtil p_futFileUtil ) : void
p_futFileUtil FileUtil An instance of a class.
Результат void

ChangeArchiveDirectory() публичный статический Метод

Changes the directory of the archive referenced in the given path to the specified new directory.
This changes something of the form: arch:old\path\archive.zip//interior/path/file.txt to: arch:new\path\archive.zip//interior/path/file.txt
public static ChangeArchiveDirectory ( string p_strArchivePath, string p_strNewArchiveDirectory ) : string
p_strArchivePath string The archive path whose directory is to be replaced.
p_strNewArchiveDirectory string The new directory to put into the given archive path.
Результат string

ContainsFile() публичный Метод

Determins if the archive contains the specified file.
public ContainsFile ( string p_strPath ) : bool
p_strPath string The path of the file whose presence in the archive is to be determined.
Результат bool

DeleteFile() публичный Метод

Deletes the specified file from the archive.
If the specified file doesn't exist in the archive, nothing is done.
Thrown if modification of archives of the current /// archive type is not supported. Thrown if modification of archive is attempted /// while the archive is in a ready only transaction.
public DeleteFile ( string p_strFileName ) : void
p_strFileName string The path to the file to delete from the archive.
Результат void

Dispose() публичный Метод

Disposes of the resources used by the object.
public Dispose ( ) : void
Результат void

EndReadOnlyTransaction() публичный Метод

Ends a read-only transaction.
This takes the archive out of read-only mode, and releases any used resources.
public EndReadOnlyTransaction ( ) : void
Результат void

GenerateArchivePath() публичный статический Метод

Generates a path to a file in an archive.
public static GenerateArchivePath ( string p_strArchivePath, string p_strInternalPath ) : string
p_strArchivePath string The path of the archive file.
p_strInternalPath string The path of the file in the archive.
Результат string

GetDirectories() публичный Метод

Gets a list of directories that are in the specified directory in this archive.
public GetDirectories ( string p_strDirectory ) : string[]
p_strDirectory string The directory in the archive whose descendents are to be returned.
Результат string[]

GetExtractor() публичный статический Метод

Gets a SevenZipExtractor for the given path.
This builds a SevenZipExtractor for the given path. The path can be to a nested archive (an archive in another archive).
public static GetExtractor ( string p_strPath ) : SevenZip.SevenZipExtractor
p_strPath string The path to the archive for which to get a .
Результат SevenZip.SevenZipExtractor

GetFileContents() публичный Метод

Gets the contents of the specified file in the archive.
public GetFileContents ( string p_strPath ) : byte[]
p_strPath string The file whose contents are to be retrieved.
Результат byte[]

GetFiles() публичный Метод

Gets a list of files that are in the specified directory in this archive.
public GetFiles ( string p_strDirectory, bool p_booRecurse ) : string[]
p_strDirectory string The directory in the archive whose descendents are to be returned.
p_booRecurse bool Whether to return files that are in subdirectories of the given directory.
Результат string[]

GetFiles() публичный Метод

Gets a list of files that are in the specified directory and match the given pattern in this archive.
public GetFiles ( string p_strDirectory, string p_strPattern, bool p_booRecurse ) : string[]
p_strDirectory string The directory in the archive whose descendents are to be returned.
p_strPattern string The filename pattern of the files to be returned.
p_booRecurse bool Whether to return files that are in subdirectories of the given directory.
Результат string[]

GetThreadSafeExtractor() публичный статический Метод

Gets a ThreadSafeSevenZipExtractor for the given path.
This builds a ThreadSafeSevenZipExtractor for the given path. The path can be to a nested archive (an archive in another archive).
public static GetThreadSafeExtractor ( string p_strPath ) : ThreadSafeSevenZipExtractor
p_strPath string The path to the archive for which to get a .
Результат ThreadSafeSevenZipExtractor

IsArchive() публичный статический Метод

Determines whether or not the file specified by the given path is an archive.
public static IsArchive ( string p_strPath ) : bool
p_strPath string
Результат bool

IsArchivePath() публичный статический Метод

Determines whether or not the given path points to a file in an archive.
public static IsArchivePath ( string p_strPath ) : bool
p_strPath string
Результат bool

IsDirectory() публичный Метод

Determins if the given path is a directory in this archive.
public IsDirectory ( string p_strPath ) : bool
p_strPath string The path to examine.
Результат bool

LoadFileIndices() защищенный Метод

Caches information about the files in the archive.
protected LoadFileIndices ( ) : void
Результат void

ParseArchivePath() публичный статический Метод

Parses the given path to extract the path to the archive file, and the path to a file within said archive.
public static ParseArchivePath ( string p_strPath ) : string>.KeyValuePair
p_strPath string The file path to parse.
Результат string>.KeyValuePair

ReplaceFile() публичный Метод

Replaces the specified file in the archive with the given data.
If the specified file doesn't exist in the archive, the file is added.
Thrown if modification of archives of the current /// archive type is not supported. Thrown if modification of archive is attempted /// while the archive is in a ready only transaction.
public ReplaceFile ( string p_strFileName, byte p_bteData ) : void
p_strFileName string The path to the file to replace in the archive.
p_bteData byte The new file data.
Результат void

ReplaceFile() публичный Метод

Replaces the specified file in the archive with the given data.
If the specified file doesn't exist in the archive, the file is added.
public ReplaceFile ( string p_strFileName, string p_strData ) : void
p_strFileName string The path to the file to replace in the archive.
p_strData string The new file data.
Результат void

Описание свойств

m_lstNonArchiveExtensions защищенное статическое свойство

A list of well-known extensions of files that are not archives.
This list is used to speed up determination of whether or not a given file is an archive.
protected static List m_lstNonArchiveExtensions
Результат List