Пример #1
0
 /// <summary>
 ///   Extract the entry to a file in the filesystem, using the specified
 ///   behavior when extraction would overwrite an existing file.
 /// </summary>
 ///
 /// <remarks>
 /// <para>
 ///   See the remarks on the <see cref="LastModified"/> property, for some
 ///   details about how the last modified time of the file is set after
 ///   extraction.
 /// </para>
 /// </remarks>
 ///
 /// <param name="extractExistingFile">
 ///   The action to take if extraction would overwrite an existing file.
 /// </param>
 public static void Extract(this ZipEntry zipEntry, ExtractExistingFileAction extractExistingFile)
 {
     zipEntry.ExtractExistingFile = extractExistingFile;
     zipEntry.InternalExtractToBaseDir(".", null);
 }
Пример #2
0
 /// <summary>
 ///   Extract the entry to the filesystem, starting at the current
 ///   working directory.
 /// </summary>
 ///
 /// <overloads>
 ///   This method has a bunch of overloads! One of them is sure to
 ///   be the right one for you... If you don't like these, check
 ///   out the <c>ExtractWithPassword()</c> methods.
 /// </overloads>
 ///
 /// <seealso cref="Ionic.Zip.ZipEntry.ExtractExistingFile"/>
 /// <seealso cref="ZipEntry.Extract(ExtractExistingFileAction)"/>
 ///
 /// <remarks>
 ///
 /// <para>
 ///   This method extracts an entry from a zip file into the current
 ///   working directory.  The path of the entry as extracted is the full
 ///   path as specified in the zip archive, relative to the current
 ///   working directory.  After the file is extracted successfully, the
 ///   file attributes and timestamps are set.
 /// </para>
 ///
 /// <para>
 ///   The action taken when extraction an entry would overwrite an
 ///   existing file is determined by the <see cref="ExtractExistingFile"
 ///   /> property.
 /// </para>
 ///
 /// <para>
 ///   Within the call to <c>Extract()</c>, the content for the entry is
 ///   written into a filesystem file, and then the last modified time of the
 ///   file is set according to the <see cref="LastModified"/> property on
 ///   the entry. See the remarks the <see cref="LastModified"/> property for
 ///   some details about the last modified time.
 /// </para>
 ///
 /// </remarks>
 public static void Extract(this ZipEntry zipEntry)
 {
     zipEntry.InternalExtractToBaseDir(".", null);
 }
Пример #3
0
 /// <summary>
 ///   Extract the entry to the filesystem, starting at the specified base
 ///   directory, and using the specified password.
 /// </summary>
 ///
 /// <seealso cref="Ionic.Zip.ZipEntry.ExtractExistingFile"/>
 /// <seealso cref="Ionic.Zip.ZipEntry.ExtractWithPassword(string, ExtractExistingFileAction, string)"/>
 ///
 /// <remarks>
 /// <para>
 ///   Existing entries in the filesystem will not be overwritten. If you
 ///   would like to force the overwrite of existing files, see the <see
 ///   cref="Ionic.Zip.ZipEntry.ExtractExistingFile"/>property, or call
 ///   <see
 ///   cref="ExtractWithPassword(ExtractExistingFileAction,string)"/>.
 /// </para>
 ///
 /// <para>
 ///   See the remarks on the <see cref="LastModified"/> property, for some
 ///   details about how the last modified time of the created file is set.
 /// </para>
 /// </remarks>
 ///
 /// <param name="baseDirectory">The pathname of the base directory.</param>
 /// <param name="password">The Password to use for decrypting the entry.</param>
 public static void ExtractWithPassword(this ZipEntry zipEntry, string baseDirectory, string password)
 {
     zipEntry.InternalExtractToBaseDir(baseDirectory, password);
 }
Пример #4
0
 /// <summary>
 ///   Extract the entry to the filesystem, starting at the specified base
 ///   directory, and using the specified behavior when extraction would
 ///   overwrite an existing file.
 /// </summary>
 ///
 /// <remarks>
 ///   See the remarks on the <see cref="LastModified"/> property, for some
 ///   details about how the last modified time of the created file is set.
 /// </remarks>
 ///
 /// <param name="baseDirectory">the pathname of the base directory</param>
 ///
 /// <param name="extractExistingFile">The action to take if extraction would
 /// overwrite an existing file.</param>
 ///
 /// <param name="password">The Password to use for decrypting the entry.</param>
 public static void ExtractWithPassword(this ZipEntry zipEntry, string baseDirectory, ExtractExistingFileAction extractExistingFile, string password)
 {
     zipEntry.ExtractExistingFile = extractExistingFile;
     zipEntry.InternalExtractToBaseDir(baseDirectory, password);
 }
Пример #5
0
 /// <summary>
 ///   Extract the entry to the filesystem, starting at the specified base
 ///   directory.
 /// </summary>
 ///
 /// <param name="baseDirectory">the pathname of the base directory</param>
 ///
 /// <seealso cref="Ionic.Zip.ZipEntry.ExtractExistingFile"/>
 /// <seealso cref="Ionic.Zip.ZipEntry.Extract(string, ExtractExistingFileAction)"/>
 ///
 /// <example>
 /// This example extracts only the entries in a zip file that are .txt files,
 /// into a directory called "textfiles".
 /// <code lang="C#">
 /// using (ZipFile zip = ZipFile.Read("PackedDocuments.zip"))
 /// {
 ///   foreach (string s1 in zip.EntryFilenames)
 ///   {
 ///     if (s1.EndsWith(".txt"))
 ///     {
 ///       zip[s1].Extract("textfiles");
 ///     }
 ///   }
 /// }
 /// </code>
 /// <code lang="VB">
 ///   Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip")
 ///       Dim s1 As String
 ///       For Each s1 In zip.EntryFilenames
 ///           If s1.EndsWith(".txt") Then
 ///               zip(s1).Extract("textfiles")
 ///           End If
 ///       Next
 ///   End Using
 /// </code>
 /// </example>
 ///
 /// <remarks>
 ///
 /// <para>
 ///   Using this method, existing entries in the filesystem will not be
 ///   overwritten. If you would like to force the overwrite of existing
 ///   files, see the <see cref="ExtractExistingFile"/> property, or call
 ///   <see cref="Extract(string, ExtractExistingFileAction)"/>.
 /// </para>
 ///
 /// <para>
 ///   See the remarks on the <see cref="LastModified"/> property, for some
 ///   details about how the last modified time of the created file is set.
 /// </para>
 /// </remarks>
 public static void Extract(this ZipEntry zipEntry, string baseDirectory)
 {
     zipEntry.InternalExtractToBaseDir(baseDirectory, null);
 }