ExtractWithPassword Method (password)

DotNetZip

Ionic Zip Library v1.9.1.6 ExtractWithPassword Method (password)
ReferenceIonic.ZipZipEntryExtractWithPassword(String)
Extract the entry to the filesystem, using the current working directory and the specified password.
Declaration Syntax
C# Visual Basic Visual C++
public void ExtractWithPassword(
	string password
)
Public Sub ExtractWithPassword ( _
	password As String _
)
public:
void ExtractWithPassword(
	String^ password
)
Parameters
password (String)
The Password to use for decrypting the entry.
Remarks

Existing entries in the filesystem will not be overwritten. If you would like to force the overwrite of existing files, see the ExtractExistingFileproperty, or call ExtractWithPassword(ExtractExistingFileAction, String).

See the remarks on the LastModified property for some details about how the "last modified" time of the created file is set.

Examples
In this example, entries that use encryption are extracted using a particular password.
CopyC#
using (var zip = ZipFile.Read(FilePath))
{
    foreach (ZipEntry e in zip)
    {
        if (e.UsesEncryption)
            e.ExtractWithPassword("Secret!");
        else
            e.Extract();
    }
}
CopyVB.NET
Using zip As ZipFile = ZipFile.Read(FilePath)
    Dim e As ZipEntry
    For Each e In zip
        If (e.UsesEncryption)
          e.ExtractWithPassword("Secret!")
        Else
          e.Extract
        End If
    Next
End Using

Assembly: Ionic.Zip (Module: Ionic.Zip) Version: 1.9.1.8 (1.9.1.8)