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