C# Class _3PA.Lib.ZipStorer

Unique class for compression/decompression file. Represents a Zip file. FULL CREDITS GO TO : ZipStorer, by Jaime Olivares Website: http://github.com/jaime-olivares/zipstorer Version: 2.35 (March 14, 2010)
Inheritance: IDisposable
Afficher le fichier Open project: jcaillon/3P Class Usage Examples

Méthodes publiques

Свойство Type Description
EncodeUtf8 bool
ForceDeflating bool

Méthodes publiques

Méthode Description
AddFile ( Compression method, string pathname, string filenameInZip, string comment ) : void

Add full contents of a file into the Zip storage

AddStream ( Compression method, string filenameInZip, Stream source, System.DateTime modTime, string comment ) : void

Add full contents of a stream into the Zip storage

Close ( ) : void

Updates central directory (if pertinent) and close the Zip storage

This is a required step, unless automatic dispose is used

Create ( Stream stream, string comment ) : ZipStorer

Method to create a new zip storage in a stream

Create ( string filename, string comment ) : ZipStorer

Method to create a new storage file

Dispose ( ) : void

Closes the Zip file stream

ExtractFile ( ZipFileEntry zfe, Stream stream ) : bool

Copy the contents of a stored file into an opened stream

Unique compression methods are Store and Deflate

ExtractFile ( ZipFileEntry zfe, string filename ) : bool

Copy the contents of a stored file into a physical file

Unique compression methods are Store and Deflate

Open ( Stream stream, FileAccess access ) : ZipStorer

Method to open an existing storage from stream

Open ( string filename, FileAccess access ) : ZipStorer

Method to open an existing storage file

ReadCentralDir ( ) : List

Read all the file records in the central directory

RemoveEntries ( ZipStorer &zip, List zfes ) : bool

Removes one of many files in storage. It creates a new Zip file.

This method only works for storage of type FileStream

Private Methods

Méthode Description
DateTimeToDosTime ( System.DateTime dt ) : uint
DosTimeToDateTime ( uint dt ) : System.DateTime
GetFileOffset ( uint headerOffset ) : uint
NormalizedFilename ( string filename ) : string
ReadFileInfo ( ) : bool
Store ( ZipFileEntry &zfe, Stream source ) : void
UpdateCrcAndSizes ( ZipFileEntry &zfe ) : void
WriteCentralDirRecord ( ZipFileEntry zfe ) : void
WriteEndRecord ( uint size, uint offset ) : void
WriteLocalHeader ( ZipFileEntry &zfe ) : void
ZipStorer ( ) : System

Method Details

AddFile() public méthode

Add full contents of a file into the Zip storage
public AddFile ( Compression method, string pathname, string filenameInZip, string comment ) : void
method Compression Compression method
pathname string Full path of file to add to Zip storage
filenameInZip string Filename and path as desired in Zip directory
comment string Comment for stored file
Résultat void

AddStream() public méthode

Add full contents of a stream into the Zip storage
public AddStream ( Compression method, string filenameInZip, Stream source, System.DateTime modTime, string comment ) : void
method Compression Compression method
filenameInZip string Filename and path as desired in Zip directory
source Stream Stream object containing the data to store in Zip
modTime System.DateTime Modification time of the data to store
comment string Comment for stored file
Résultat void

Close() public méthode

Updates central directory (if pertinent) and close the Zip storage
This is a required step, unless automatic dispose is used
public Close ( ) : void
Résultat void

Create() public static méthode

Method to create a new zip storage in a stream
public static Create ( Stream stream, string comment ) : ZipStorer
stream Stream
comment string
Résultat ZipStorer

Create() public static méthode

Method to create a new storage file
public static Create ( string filename, string comment ) : ZipStorer
filename string Full path of Zip file to create
comment string General comment for Zip file
Résultat ZipStorer

Dispose() public méthode

Closes the Zip file stream
public Dispose ( ) : void
Résultat void

ExtractFile() public méthode

Copy the contents of a stored file into an opened stream
Unique compression methods are Store and Deflate
public ExtractFile ( ZipFileEntry zfe, Stream stream ) : bool
zfe ZipFileEntry Entry information of file to extract
stream Stream Stream to store the uncompressed data
Résultat bool

ExtractFile() public méthode

Copy the contents of a stored file into a physical file
Unique compression methods are Store and Deflate
public ExtractFile ( ZipFileEntry zfe, string filename ) : bool
zfe ZipFileEntry Entry information of file to extract
filename string Name of file to store uncompressed data
Résultat bool

Open() public static méthode

Method to open an existing storage from stream
public static Open ( Stream stream, FileAccess access ) : ZipStorer
stream Stream Already opened stream with zip contents
access FileAccess File access mode for stream operations
Résultat ZipStorer

Open() public static méthode

Method to open an existing storage file
public static Open ( string filename, FileAccess access ) : ZipStorer
filename string Full path of Zip file to open
access FileAccess File access mode as used in FileStream constructor
Résultat ZipStorer

ReadCentralDir() public méthode

Read all the file records in the central directory
public ReadCentralDir ( ) : List
Résultat List

RemoveEntries() public static méthode

Removes one of many files in storage. It creates a new Zip file.
This method only works for storage of type FileStream
public static RemoveEntries ( ZipStorer &zip, List zfes ) : bool
zip ZipStorer Reference to the current Zip object
zfes List List of Entries to remove from storage
Résultat bool

Property Details

EncodeUtf8 public_oe property

True if UTF8 encoding for filename and comments, false if default (CP 437)
public bool EncodeUtf8
Résultat bool

ForceDeflating public_oe property

Force deflate algotithm even if it inflates the stored file. Off by default.
public bool ForceDeflating
Résultat bool