ExtractExistingFileAction.cs 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. namespace Ionic.Zip
  27. {
  28. /// <summary>
  29. /// An enum for the options when extracting an entry would overwrite an existing file.
  30. /// </summary>
  31. ///
  32. /// <remarks>
  33. /// <para>
  34. /// This enum describes the actions that the library can take when an
  35. /// <c>Extract()</c> or <c>ExtractWithPassword()</c> method is called to extract an
  36. /// entry to a filesystem, and the extraction would overwrite an existing filesystem
  37. /// file.
  38. /// </para>
  39. /// </remarks>
  40. ///
  41. public enum ExtractExistingFileAction
  42. {
  43. /// <summary>
  44. /// Throw an exception when extraction would overwrite an existing file. (For
  45. /// COM clients, this is a 0 (zero).)
  46. /// </summary>
  47. Throw,
  48. /// <summary>
  49. /// When extraction would overwrite an existing file, overwrite the file silently.
  50. /// The overwrite will happen even if the target file is marked as read-only.
  51. /// (For COM clients, this is a 1.)
  52. /// </summary>
  53. OverwriteSilently,
  54. /// <summary>
  55. /// When extraction would overwrite an existing file, don't overwrite the file, silently.
  56. /// (For COM clients, this is a 2.)
  57. /// </summary>
  58. DoNotOverwrite,
  59. /// <summary>
  60. /// When extraction would overwrite an existing file, invoke the ExtractProgress
  61. /// event, using an event type of <see
  62. /// cref="ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite"/>. In
  63. /// this way, the application can decide, just-in-time, whether to overwrite the
  64. /// file. For example, a GUI application may wish to pop up a dialog to allow
  65. /// the user to choose. You may want to examine the <see
  66. /// cref="ExtractProgressEventArgs.ExtractLocation"/> property before making
  67. /// the decision. If, after your processing in the Extract progress event, you
  68. /// want to NOT extract the file, set <see cref="ZipEntry.ExtractExistingFile"/>
  69. /// on the <c>ZipProgressEventArgs.CurrentEntry</c> to <c>DoNotOverwrite</c>.
  70. /// If you do want to extract the file, set <c>ZipEntry.ExtractExistingFile</c>
  71. /// to <c>OverwriteSilently</c>. If you want to cancel the Extraction, set
  72. /// <c>ZipProgressEventArgs.Cancel</c> to true. Cancelling differs from using
  73. /// DoNotOverwrite in that a cancel will not extract any further entries, if
  74. /// there are any. (For COM clients, the value of this enum is a 3.)
  75. /// </summary>
  76. InvokeExtractProgressEvent,
  77. }
  78. }