C# Class System.IO.Compression.ZipArchiveFile

ZipArchiveFile represents one archive file in the ZipArchive. It is analogous to the System.IO.DiffFile object for normal files.
Afficher le fichier Open project: garyjohnson/wpnest Class Usage Examples

Private Properties

Свойство Type Description
CopyStream int
DateTimeToDosTime uint
DosTimeToDateTime DateTime
Read ZipArchiveFile
Validate void
WriteArchiveDirectoryEntryToStream void
WriteToStream void
WriteZipFileHeader void
ZipArchiveFile System.Diagnostics

Méthodes publiques

Méthode Description
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'.

Private Methods

Méthode Description
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.

Method Details

CopyTo() public méthode

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.
Résultat void

CopyToFile() public méthode

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.
Résultat void

Create() public méthode

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
Résultat Stream

CreateText() public méthode

Truncate the archive textStream and return a StreamWrite sutable for writing text to the textStream.
public CreateText ( ) : StreamWriter
Résultat StreamWriter

Delete() public méthode

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
Résultat void

MoveTo() public méthode

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.
Résultat void

OpenRead() public méthode

Opens the archiveFile represented by the ZipArchiveFile and returns a stream that can use to read (binary) data.
public OpenRead ( ) : Stream
Résultat Stream

OpenText() public méthode

Opens the archiveFile represented by the ZipArchiveFile and returns a stream that can use to read text.
public OpenText ( ) : StreamReader
Résultat StreamReader

ReadAllText() public méthode

Read all the text from the archiveFile represented by the ZipArchiveFile and return it as a string.
public ReadAllText ( ) : string
Résultat string

ToString() public méthode

A text summary of the archive textStream (name and length).
public ToString ( ) : string
Résultat string

WriteAllText() public méthode

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.
Résultat void