ZipErrorAction.cs 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // ZipErrorAction.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-September-01 18:43:20>
  19. //
  20. // ------------------------------------------------------------------
  21. //
  22. // This module defines the ZipErrorAction enum, which provides
  23. // an action to take when errors occur when opening or reading
  24. // files to be added to a zip file.
  25. //
  26. // ------------------------------------------------------------------
  27. namespace Ionic.Zip
  28. {
  29. /// <summary>
  30. /// An enum providing the options when an error occurs during opening or reading
  31. /// of a file or directory that is being saved to a zip file.
  32. /// </summary>
  33. ///
  34. /// <remarks>
  35. /// <para>
  36. /// This enum describes the actions that the library can take when an error occurs
  37. /// opening or reading a file, as it is being saved into a Zip archive.
  38. /// </para>
  39. ///
  40. /// <para>
  41. /// In some cases an error will occur when DotNetZip tries to open a file to be
  42. /// added to the zip archive. In other cases, an error might occur after the
  43. /// file has been successfully opened, while DotNetZip is reading the file.
  44. /// </para>
  45. ///
  46. /// <para>
  47. /// The first problem might occur when calling AddDirectory() on a directory
  48. /// that contains a Clipper .dbf file; the file is locked by Clipper and
  49. /// cannot be opened by another process. An example of the second problem is
  50. /// the ERROR_LOCK_VIOLATION that results when a file is opened by another
  51. /// process, but not locked, and a range lock has been taken on the file.
  52. /// Microsoft Outlook takes range locks on .PST files.
  53. /// </para>
  54. /// </remarks>
  55. public enum ZipErrorAction
  56. {
  57. /// <summary>
  58. /// Throw an exception when an error occurs while zipping. This is the default
  59. /// behavior. (For COM clients, this is a 0 (zero).)
  60. /// </summary>
  61. Throw,
  62. /// <summary>
  63. /// When an error occurs during zipping, for example a file cannot be opened,
  64. /// skip the file causing the error, and continue zipping. (For COM clients,
  65. /// this is a 1.)
  66. /// </summary>
  67. Skip,
  68. /// <summary>
  69. /// When an error occurs during zipping, for example a file cannot be opened,
  70. /// retry the operation that caused the error. Be careful with this option. If
  71. /// the error is not temporary, the library will retry forever. (For COM
  72. /// clients, this is a 2.)
  73. /// </summary>
  74. Retry,
  75. /// <summary>
  76. /// When an error occurs, invoke the zipError event. The event type used is
  77. /// <see cref="ZipProgressEventType.Error_Saving"/>. A typical use of this option:
  78. /// a GUI application may wish to pop up a dialog to allow the user to view the
  79. /// error that occurred, and choose an appropriate action. After your
  80. /// processing in the error event, if you want to skip the file, set <see
  81. /// cref="ZipEntry.ZipErrorAction"/> on the
  82. /// <c>ZipProgressEventArgs.CurrentEntry</c> to <c>Skip</c>. If you want the
  83. /// exception to be thrown, set <c>ZipErrorAction</c> on the <c>CurrentEntry</c>
  84. /// to <c>Throw</c>. If you want to cancel the zip, set
  85. /// <c>ZipProgressEventArgs.Cancel</c> to true. Cancelling differs from using
  86. /// Skip in that a cancel will not save any further entries, if there are any.
  87. /// (For COM clients, the value of this enum is a 3.)
  88. /// </summary>
  89. InvokeErrorEvent,
  90. }
  91. }