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.
显示文件 Open project: garyjohnson/wpnest Class Usage Examples

Private Properties

Property Type Description
CopyStream int
DateTimeToDosTime uint
DosTimeToDateTime DateTime
Read ZipArchiveFile
Validate void
WriteArchiveDirectoryEntryToStream void
WriteToStream void
WriteZipFileHeader void
ZipArchiveFile System.Diagnostics

Public Methods

Method 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

Method 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 method

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.
return void

CopyToFile() public method

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.
return void

Create() public method

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
return Stream

CreateText() public method

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

Delete() public method

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
return void

MoveTo() public method

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.
return void

OpenRead() public method

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

OpenText() public method

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

ReadAllText() public method

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

ToString() public method

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

WriteAllText() public method

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.
return void