public static IsZipFile ( Stream stream, bool testExtract ) : bool | ||
stream | Stream | The stream to check. |
testExtract | bool | true if the caller wants to extract each entry. |
return | bool |
This method reads the zip archive contained in the specified stream, verifying the ZIP metadata as it reads. If testExtract is true, this method also extracts each entry in the archive, dumping all the bits into Stream.Null.
If everything succeeds, then the method returns true. If anything fails - for example if an incorrect signature or CRC is found, indicating a corrupt file, the the method returns false. This method also returns false for a file that does not exist.
If testExtract
is true, this method reads in the content for each entry, expands it, and checks CRCs. This provides an additional check beyond verifying the zip header data.
If testExtract
is true, and if any of the zip entries are protected with a password, this method will return false. If you want to verify a ZipFile that has entries which are protected with a password, you will need to do that manually.
public static IsZipFile ( Stream stream, bool testExtract ) : bool | ||
stream | Stream | The stream to check. |
testExtract | bool | true if the caller wants to extract each entry. |
return | bool |