C# Класс System.IO.Compression.ZipArchiveFile

ZipArchiveFile represents one archive file in the ZipArchive. It is analogous to the System.IO.DiffFile object for normal files.
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
CopyStream int
DateTimeToDosTime uint
DosTimeToDateTime DateTime
Read ZipArchiveFile
Validate void
WriteArchiveDirectoryEntryToStream void
WriteToStream void
WriteZipFileHeader void
ZipArchiveFile System.Diagnostics

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

Метод Описание
CopyTo ( string outputArchivePath ) : void

Copy the data in archive textStream named 'inputFilePath' into the 'this' archive textStream, discarding what was there before.

CopyToFile ( string outputFilePath ) : void

Copy the data in from the 'this' ZipArchiveFile to the archive textStream named 'outputFilePath' in to the file system at 'outputFilePath'.

Create ( ) : Stream

Truncates the archiveFile represented by the ZipArchiveFile to be empty and returns a Stream that can be used to write (binary) data into it.

CreateText ( ) : StreamWriter

Truncate the archive textStream and return a StreamWrite sutable for writing text to the textStream.

Delete ( ) : void

Delete the archiveFile represented by the ZipArchiveFile. The textStream can be in use without conflict. Deleting a textStream simply means it will not be persisted when ZipArchive.Close() is called.

MoveTo ( string newArchivePath ) : void

Truncates the archiveFile represented by the ZipArchiveFile to be empty and returns a TextWriter that text can be written to (using the default encoding).

OpenRead ( ) : Stream

Opens the archiveFile represented by the ZipArchiveFile and returns a stream that can use to read (binary) data.

OpenText ( ) : StreamReader

Opens the archiveFile represented by the ZipArchiveFile and returns a stream that can use to read text.

ReadAllText ( ) : string

Read all the text from the archiveFile represented by the ZipArchiveFile and return it as a string.

ToString ( ) : string

A text summary of the archive textStream (name and length).

WriteAllText ( string data ) : void

Replaces the data in the archiveFile represented by the ZipArchiveFile with the text in 'data'.

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

Метод Описание
CopyStream ( Stream fromStream, Stream toStream ) : int

Copies from one stream to another.

DateTimeToDosTime ( DateTime dateTime ) : uint

Encodes a DateTime instance as a 32-bit number to save space. The format is used in DOS.

DosTimeToDateTime ( uint dateTime ) : DateTime

Convert a classic DOS time to date time.

Read ( ZipArchive archive ) : ZipArchiveFile

Reads a single archiveFile from a Zip Archive. Should only be used by ZipArchive.

Validate ( ) : void

Validate the data.

WriteArchiveDirectoryEntryToStream ( Stream writer ) : void

Writes an archive directory entry to stream.

WriteToStream ( Stream writer ) : void

Used by ZipArchive to write the entry to the archive.

WriteZipFileHeader ( Stream writer ) : void

Writes the Zip file header to the stream.

ZipArchiveFile ( ZipArchive archive, string archiveName ) : System.Diagnostics

Create a new archive archiveFile with no data (empty). It is expected that only ZipArchive methods will use this routine.

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

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

Copy the data in archive textStream named 'inputFilePath' into the 'this' archive textStream, discarding what was there before.
public CopyTo ( string outputArchivePath ) : void
outputArchivePath string The output archive path.
Результат void

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

Copy the data in from the 'this' ZipArchiveFile to the archive textStream named 'outputFilePath' in to the file system at 'outputFilePath'.
public CopyToFile ( string outputFilePath ) : void
outputFilePath string The output file path.
Результат void

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

Truncates the archiveFile represented by the ZipArchiveFile to be empty and returns a Stream that can be used to write (binary) data into it.
public Create ( ) : Stream
Результат Stream

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

Truncate the archive textStream and return a StreamWrite sutable for writing text to the textStream.
public CreateText ( ) : StreamWriter
Результат StreamWriter

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

Delete the archiveFile represented by the ZipArchiveFile. The textStream can be in use without conflict. Deleting a textStream simply means it will not be persisted when ZipArchive.Close() is called.
public Delete ( ) : void
Результат void

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

Truncates the archiveFile represented by the ZipArchiveFile to be empty and returns a TextWriter that text can be written to (using the default encoding).
public MoveTo ( string newArchivePath ) : void
newArchivePath string The new archive path.
Результат void

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

Opens the archiveFile represented by the ZipArchiveFile and returns a stream that can use to read (binary) data.
public OpenRead ( ) : Stream
Результат Stream

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

Opens the archiveFile represented by the ZipArchiveFile and returns a stream that can use to read text.
public OpenText ( ) : StreamReader
Результат StreamReader

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

Read all the text from the archiveFile represented by the ZipArchiveFile and return it as a string.
public ReadAllText ( ) : string
Результат string

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

A text summary of the archive textStream (name and length).
public ToString ( ) : string
Результат string

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

Replaces the data in the archiveFile represented by the ZipArchiveFile with the text in 'data'.
public WriteAllText ( string data ) : void
data string The data to replace the archiveFile data with.
Результат void