C# Class ZForge.Zip.ZipEntry

Represents a single entry in a ZipFile. Typically, applications get a ZipEntry by enumerating the entries within a ZipFile.
Exibir arquivo Open project: zhuangyy/Motion Class Usage Examples

Private Properties

Property Type Description
Create ZipEntry
Create ZipEntry
Extract void
IsNotValidSig bool
ReadHeader bool
Write void
WriteCentralDirectoryEntry void
WriteHeader void

Public Methods

Method Description
Extract ( ) : void

Extract the current entry to the current working directory.

The last modified time of the created file may be adjusted during extraction to compensate for differences in how the .NET Base Class Library deals with daylight saving time (DST) versus how the Windows filesystem deals with daylight saving time. See http://blogs.msdn.com/oldnewthing/archive/2003/10/24/55413.aspx for more context.

In a nutshell: Daylight savings time rules change regularly. In 2007, for example, the inception week of DST changed. In 1977, DST was in place all year round. in 1945, likewise. And so on. Win32 does not attempt to guess which time zone rules were in effect at the time in question. It will render a time as "standard time" and allow the app to change to DST as necessary. .NET makes a different choice.

Compare the output of FileInfo.LastWriteTime.ToString("f") with what you see in the property sheet for a file that was last written to on the other side of the DST transition. For example, suppose the file was last modified on October 17, during DST but DST is not currently in effect. Explorer's file properties reports Thursday, October 17, 2003, 8:45:38 AM, but .NETs FileInfo reports Thursday, October 17, 2003, 9:45 AM.

Win32 says, "Thursday, October 17, 2002 8:45:38 AM PST". Note: Pacific STANDARD Time. Even though October 17 of that year occurred during Pacific Daylight Time, Win32 displays the time as standard time because that's what time it is NOW.

.NET BCL assumes that the current DST rules were in place at the time in question. So, .NET says, "Well, if the rules in effect now were also in effect on October 17, 2003, then that would be daylight time" so it displays "Thursday, October 17, 2003, 9:45 AM PDT" - daylight time.

So .NET gives a value which is more intuitively correct, but is also potentially incorrect, and which is not invertible. Win32 gives a value which is intuitively incorrect, but is strictly correct.

With this adjustment, I add one hour to the tweaked .NET time, if necessary. That is to say, if the time in question had occurred in what the .NET BCL assumed to be DST (an assumption that may be wrong given the constantly changing DST rules).

This method has three overloads.
Extract ( System s ) : void

Extracts the entry to the specified stream. For example, the caller could specify Console.Out.

Extract ( string BaseDirectory ) : void

Extract the entry to the filesystem, starting at the specified base directory.

IsDirectory ( ) : bool

Read ( System s ) : ZipEntry

Reads one ZipEntry from the given stream.

Private Methods

Method Description
Create ( String filename ) : ZipEntry
Create ( String filename, string DirectoryPathInArchive ) : ZipEntry
Extract ( string basedir, System s ) : void
IsNotValidSig ( int signature ) : bool
ReadHeader ( System s, ZipEntry ze ) : bool
Write ( System s ) : void
WriteCentralDirectoryEntry ( System s ) : void
WriteHeader ( System s, byte bytes ) : void

Method Details

Extract() public method

Extract the current entry to the current working directory.

The last modified time of the created file may be adjusted during extraction to compensate for differences in how the .NET Base Class Library deals with daylight saving time (DST) versus how the Windows filesystem deals with daylight saving time. See http://blogs.msdn.com/oldnewthing/archive/2003/10/24/55413.aspx for more context.

In a nutshell: Daylight savings time rules change regularly. In 2007, for example, the inception week of DST changed. In 1977, DST was in place all year round. in 1945, likewise. And so on. Win32 does not attempt to guess which time zone rules were in effect at the time in question. It will render a time as "standard time" and allow the app to change to DST as necessary. .NET makes a different choice.

Compare the output of FileInfo.LastWriteTime.ToString("f") with what you see in the property sheet for a file that was last written to on the other side of the DST transition. For example, suppose the file was last modified on October 17, during DST but DST is not currently in effect. Explorer's file properties reports Thursday, October 17, 2003, 8:45:38 AM, but .NETs FileInfo reports Thursday, October 17, 2003, 9:45 AM.

Win32 says, "Thursday, October 17, 2002 8:45:38 AM PST". Note: Pacific STANDARD Time. Even though October 17 of that year occurred during Pacific Daylight Time, Win32 displays the time as standard time because that's what time it is NOW.

.NET BCL assumes that the current DST rules were in place at the time in question. So, .NET says, "Well, if the rules in effect now were also in effect on October 17, 2003, then that would be daylight time" so it displays "Thursday, October 17, 2003, 9:45 AM PDT" - daylight time.

So .NET gives a value which is more intuitively correct, but is also potentially incorrect, and which is not invertible. Win32 gives a value which is intuitively incorrect, but is strictly correct.

With this adjustment, I add one hour to the tweaked .NET time, if necessary. That is to say, if the time in question had occurred in what the .NET BCL assumed to be DST (an assumption that may be wrong given the constantly changing DST rules).

This method has three overloads.
public Extract ( ) : void
return void

Extract() public method

Extracts the entry to the specified stream. For example, the caller could specify Console.Out.
public Extract ( System s ) : void
s System the stream to which the entry should be extracted.
return void

Extract() public method

Extract the entry to the filesystem, starting at the specified base directory.
public Extract ( string BaseDirectory ) : void
BaseDirectory string the pathname of the base directory
return void

IsDirectory() public method

public IsDirectory ( ) : bool
return bool

Read() public static method

Reads one ZipEntry from the given stream.
public static Read ( System s ) : ZipEntry
s System the stream to read from.
return ZipEntry