[12074] | 1 | // ExtractExistingFileAction.cs
|
---|
| 2 | // ------------------------------------------------------------------
|
---|
| 3 | //
|
---|
| 4 | // Copyright (c) 2009 Dino Chiesa
|
---|
| 5 | // All rights reserved.
|
---|
| 6 | //
|
---|
| 7 | // This code module is part of DotNetZip, a zipfile class library.
|
---|
| 8 | //
|
---|
| 9 | // ------------------------------------------------------------------
|
---|
| 10 | //
|
---|
| 11 | // This code is licensed under the Microsoft Public License.
|
---|
| 12 | // See the file License.txt for the license details.
|
---|
| 13 | // More info on: http://dotnetzip.codeplex.com
|
---|
| 14 | //
|
---|
| 15 | // ------------------------------------------------------------------
|
---|
| 16 | //
|
---|
| 17 | // last saved (in emacs):
|
---|
| 18 | // Time-stamp: <2009-August-25 08:44:37>
|
---|
| 19 | //
|
---|
| 20 | // ------------------------------------------------------------------
|
---|
| 21 | //
|
---|
| 22 | // This module defines the ExtractExistingFileAction enum
|
---|
| 23 | //
|
---|
| 24 | //
|
---|
| 25 | // ------------------------------------------------------------------
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 | namespace OfficeOpenXml.Packaging.Ionic.Zip
|
---|
| 29 | {
|
---|
| 30 |
|
---|
| 31 | /// <summary>
|
---|
| 32 | /// An enum for the options when extracting an entry would overwrite an existing file.
|
---|
| 33 | /// </summary>
|
---|
| 34 | ///
|
---|
| 35 | /// <remarks>
|
---|
| 36 | /// <para>
|
---|
| 37 | /// This enum describes the actions that the library can take when an
|
---|
| 38 | /// <c>Extract()</c> or <c>ExtractWithPassword()</c> method is called to extract an
|
---|
| 39 | /// entry to a filesystem, and the extraction would overwrite an existing filesystem
|
---|
| 40 | /// file.
|
---|
| 41 | /// </para>
|
---|
| 42 | /// </remarks>
|
---|
| 43 | ///
|
---|
| 44 | internal enum ExtractExistingFileAction
|
---|
| 45 | {
|
---|
| 46 | /// <summary>
|
---|
| 47 | /// Throw an exception when extraction would overwrite an existing file. (For
|
---|
| 48 | /// COM clients, this is a 0 (zero).)
|
---|
| 49 | /// </summary>
|
---|
| 50 | Throw,
|
---|
| 51 |
|
---|
| 52 | /// <summary>
|
---|
| 53 | /// When extraction would overwrite an existing file, overwrite the file silently.
|
---|
| 54 | /// The overwrite will happen even if the target file is marked as read-only.
|
---|
| 55 | /// (For COM clients, this is a 1.)
|
---|
| 56 | /// </summary>
|
---|
| 57 | OverwriteSilently,
|
---|
| 58 |
|
---|
| 59 | /// <summary>
|
---|
| 60 | /// When extraction would overwrite an existing file, don't overwrite the file, silently.
|
---|
| 61 | /// (For COM clients, this is a 2.)
|
---|
| 62 | /// </summary>
|
---|
| 63 | DoNotOverwrite,
|
---|
| 64 |
|
---|
| 65 | /// <summary>
|
---|
| 66 | /// When extraction would overwrite an existing file, invoke the ExtractProgress
|
---|
| 67 | /// event, using an event type of <see
|
---|
| 68 | /// cref="ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite"/>. In
|
---|
| 69 | /// this way, the application can decide, just-in-time, whether to overwrite the
|
---|
| 70 | /// file. For example, a GUI application may wish to pop up a dialog to allow
|
---|
| 71 | /// the user to choose. You may want to examine the <see
|
---|
| 72 | /// cref="ExtractProgressEventArgs.ExtractLocation"/> property before making
|
---|
| 73 | /// the decision. If, after your processing in the Extract progress event, you
|
---|
| 74 | /// want to NOT extract the file, set <see cref="ZipEntry.ExtractExistingFile"/>
|
---|
| 75 | /// on the <c>ZipProgressEventArgs.CurrentEntry</c> to <c>DoNotOverwrite</c>.
|
---|
| 76 | /// If you do want to extract the file, set <c>ZipEntry.ExtractExistingFile</c>
|
---|
| 77 | /// to <c>OverwriteSilently</c>. If you want to cancel the Extraction, set
|
---|
| 78 | /// <c>ZipProgressEventArgs.Cancel</c> to true. Cancelling differs from using
|
---|
| 79 | /// DoNotOverwrite in that a cancel will not extract any further entries, if
|
---|
| 80 | /// there are any. (For COM clients, the value of this enum is a 3.)
|
---|
| 81 | /// </summary>
|
---|
| 82 | InvokeExtractProgressEvent,
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | }
|
---|