Unique class for compression/decompression file. Represents a Zip file.
More...
|
bool | EncodeUTF8 = false |
| True if UTF8 encoding for filename and comments, false if default (CP 437) More...
|
|
bool | ForceDeflating = false |
| Force deflate algotithm even if it inflates the stored file. Off by default. More...
|
|
|
uint | GetFileOffset (uint headerOffset) |
| Calculate the file offset by reading the corresponding local header More...
|
|
void | WriteLocalHeader (ref ZipFileEntry zfe) |
| More...
|
|
void | WriteCentralDirRecord (ZipFileEntry zfe) |
| Central directory's File header: central file header signature 4 bytes (0x02014b50) version made by 2 bytes version needed to extract 2 bytes general purpose bit flag 2 bytes compression method 2 bytes last mod file time 2 bytes last mod file date 2 bytes crc-32 4 bytes compressed size 4 bytes uncompressed size 4 bytes filename length 2 bytes extra field length 2 bytes file comment length 2 bytes disk number start 2 bytes internal file attributes 2 bytes external file attributes 4 bytes relative offset of local header 4 bytes More...
|
|
void | WriteEndRecord (uint size, uint offset) |
| End of central dir record: end of central dir signature 4 bytes (0x06054b50) number of this disk 2 bytes number of the disk with the start of the central directory 2 bytes total number of entries in the central dir on this disk 2 bytes total number of entries in the central dir 2 bytes size of the central directory 4 bytes offset of start of central directory with respect to the starting disk number 4 bytes zipfile comment length 2 bytes zipfile comment (variable size) More...
|
|
void | Store (ref ZipFileEntry zfe, Stream source) |
| Copies all source file into storage file More...
|
|
uint | DateTimeToDosTime (DateTime dtdostime) |
| More...
|
|
DateTime | DosTimeToDateTime (uint dtdostime) |
| More...
|
|
void | UpdateCrcAndSizes (ref ZipFileEntry zfe) |
| More...
|
|
string | NormalizedFilename (string zipfilename) |
| Replaces backslashes with slashes to store in zip header. More...
|
|
bool | ReadFileInfo () |
| Reads the end-of-central-directory record. More...
|
|
|
static | ZipStorer () |
| Static constructor. Just invoked once in order to create the CRC32 lookup table. More...
|
|
Enumerator |
---|
Store |
Uncompressed storage
|
Deflate |
Deflate compression method
|
static NoteFly.ZipStorer.ZipStorer |
( |
| ) |
|
|
staticprivate |
void NoteFly.ZipStorer.AddFile |
( |
Compression |
compressionmethod, |
|
|
string |
pathname, |
|
|
string |
filenameInZip, |
|
|
string |
zipfilecomment |
|
) |
| |
- Parameters
-
compressionmethod | Compression method |
pathname | Full path of file to add to Zip storage |
filenameInZip | Filename and path as desired in Zip directory |
zipfilecomment | Comment for stored file |
void NoteFly.ZipStorer.AddStream |
( |
Compression |
compressionmethod, |
|
|
string |
filenameInZip, |
|
|
Stream |
source, |
|
|
DateTime |
modTime, |
|
|
string |
zipfilecomment |
|
) |
| |
- Parameters
-
compressionmethod | Compression method |
filenameInZip | Filename and path as desired in Zip directory |
source | Stream object containing the data to store in Zip |
modTime | Modification time of the data to store |
comment | Comment for stored file |
void NoteFly.ZipStorer.Close |
( |
| ) |
|
This is a required step, unless automatic dispose is used
static ZipStorer NoteFly.ZipStorer.Create |
( |
string |
zipfilename, |
|
|
string |
zipcomment |
|
) |
| |
|
static |
- Parameters
-
zipfilename | Full path of Zip file to create |
zipcomment | General comment for Zip file |
- Returns
- A valid ZipStorer object
static ZipStorer NoteFly.ZipStorer.Create |
( |
Stream |
zipstream, |
|
|
string |
zipcomment |
|
) |
| |
|
static |
- Parameters
-
stream | The zip file stream. |
comment | The zip file comment. |
- Returns
- A valid ZipStorer object
uint NoteFly.ZipStorer.DateTimeToDosTime |
( |
DateTime |
dtdostime | ) |
|
|
private |
DOS Date and time: MS-DOS date. The date is a packed value with the following format. Bits Description 0-4 Day of the month (1–31) 5-8 Month (1 = January, 2 = February, and so on) 9-15 Year offset from 1980 (add 1980 to get actual year) MS-DOS time. The time is a packed value with the following format. Bits Description 0-4 Second divided by 2 5-10 Minute (0–59) 11-15 Hour (0–23 on a 24-hour clock)
- Parameters
-
- Returns
void NoteFly.ZipStorer.Dispose |
( |
| ) |
|
DateTime NoteFly.ZipStorer.DosTimeToDateTime |
( |
uint |
dtdostime | ) |
|
|
private |
bool NoteFly.ZipStorer.ExtractFile |
( |
ZipFileEntry |
zfe, |
|
|
string |
filename |
|
) |
| |
- Parameters
-
zfe | Entry information of file to extract |
filename | Name of file to store uncompressed data |
- Returns
- True if success, false if not.
Unique compression methods are Store and Deflate
bool NoteFly.ZipStorer.ExtractFile |
( |
ZipFileEntry |
zfe, |
|
|
Stream |
stream |
|
) |
| |
- Parameters
-
zfe | Entry information of file to extract |
stream | Stream to store the uncompressed data |
- Returns
- True if success, false if not.
Unique compression methods are Store and Deflate
uint NoteFly.ZipStorer.GetFileOffset |
( |
uint |
headerOffset | ) |
|
|
private |
- Parameters
-
_headerOffset | File pointer offset |
- Returns
string NoteFly.ZipStorer.NormalizedFilename |
( |
string |
zipfilename | ) |
|
|
private |
static ZipStorer NoteFly.ZipStorer.Open |
( |
string |
zipfile, |
|
|
FileAccess |
zipfileaccess |
|
) |
| |
|
static |
- Parameters
-
filename | Full path of Zip file to open |
access | File access mode as used in FileStream constructor |
- Returns
- A valid ZipStorer object
static ZipStorer NoteFly.ZipStorer.Open |
( |
Stream |
zipstream, |
|
|
FileAccess |
zipfileaccess |
|
) |
| |
|
static |
- Parameters
-
stream | Already opened stream with zip contents |
access | File access mode for stream operations |
- Returns
- A valid ZipStorer object
- Returns
- List of all entries in directory
bool NoteFly.ZipStorer.ReadFileInfo |
( |
| ) |
|
|
private |
- Parameters
-
zip | Reference to the current Zip object |
zfes | List of Entries to remove from storage |
- Returns
- True if success, false if not
This method only works for storage of type FileStream
void NoteFly.ZipStorer.Store |
( |
ref ZipFileEntry |
zfe, |
|
|
Stream |
source |
|
) |
| |
|
private |
void NoteFly.ZipStorer.UpdateCrcAndSizes |
( |
ref ZipFileEntry |
zfe | ) |
|
|
private |
CRC32 algorithm The 'magic number' for the CRC is 0xdebb20e3. The proper CRC pre and post conditioning is used, meaning that the CRC register is pre-conditioned with all ones (a starting value of 0xffffffff) and the value is post-conditioned by taking the one's complement of the CRC residual. If bit 3 of the general purpose flag is set, this field is set to zero in the local header and the correct value is put in the data descriptor and in the central directory.
- Parameters
-
void NoteFly.ZipStorer.WriteCentralDirRecord |
( |
ZipFileEntry |
zfe | ) |
|
|
private |
filename (variable size) extra field (variable size) file comment (variable size)
void NoteFly.ZipStorer.WriteEndRecord |
( |
uint |
size, |
|
|
uint |
offset |
|
) |
| |
|
private |
void NoteFly.ZipStorer.WriteLocalHeader |
( |
ref ZipFileEntry |
zfe | ) |
|
|
private |
Local file header: local file header signature 4 bytes (0x04034b50) version needed to extract 2 bytes general purpose bit flag 2 bytes compression method 2 bytes last mod file time 2 bytes last mod file date 2 bytes crc-32 4 bytes compressed size 4 bytes uncompressed size 4 bytes filename length 2 bytes extra field length 2 bytes
filename (variable size) extra field (variable size)
- Parameters
-
byte [] NoteFly.ZipStorer.centraldirimage = null |
|
private |
string NoteFly.ZipStorer.comment = string.Empty |
|
private |
uint [] NoteFly.ZipStorer.crctable = null |
|
staticprivate |
Encoding NoteFly.ZipStorer.DefaultEncoding = Encoding.GetEncoding(437) |
|
staticprivate |
bool NoteFly.ZipStorer.EncodeUTF8 = false |
ushort NoteFly.ZipStorer.existingfiles = 0 |
|
private |
FileAccess NoteFly.ZipStorer.fileaccess |
|
private |
string NoteFly.ZipStorer.filename |
|
private |
bool NoteFly.ZipStorer.ForceDeflating = false |
Stream NoteFly.ZipStorer.zipfilestream |
|
private |
|