C# | Visual Basic | Visual C++ |
public enum ZipErrorAction
Public Enumeration ZipErrorAction
public enum class ZipErrorAction
Member | Description |
---|---|
Throw |
Throw an exception when an error occurs while zipping. This is the default
behavior. (For COM clients, this is a 0 (zero).)
|
Skip |
When an error occurs during zipping, for example a file cannot be opened,
skip the file causing the error, and continue zipping. (For COM clients,
this is a 1.)
|
Retry |
When an error occurs during zipping, for example a file cannot be opened,
retry the operation that caused the error. Be careful with this option. If
the error is not temporary, the library will retry forever. (For COM
clients, this is a 2.)
|
InvokeErrorEvent |
When an error occurs, invoke the zipError event. The event type used is
Error_Saving. A typical use of this option:
a GUI application may wish to pop up a dialog to allow the user to view the
error that occurred, and choose an appropriate action. After your
processing in the error event, if you want to skip the file, set ZipErrorAction on the
ZipProgressEventArgs.CurrentEntry to Skip. If you want the
exception to be thrown, set ZipErrorAction on the CurrentEntry
to Throw. If you want to cancel the zip, set
ZipProgressEventArgs.Cancel to true. Cancelling differs from using
Skip in that a cancel will not save any further entries, if there are any.
(For COM clients, the value of this enum is a 3.)
|
This enum describes the actions that the library can take when an error occurs opening or reading a file, as it is being saved into a Zip archive.
In some cases an error will occur when DotNetZip tries to open a file to be added to the zip archive. In other cases, an error might occur after the file has been successfully opened, while DotNetZip is reading the file.
The first problem might occur when calling AddDirectory() on a directory that contains a Clipper .dbf file; the file is locked by Clipper and cannot be opened by another process. An example of the second problem is the ERROR_LOCK_VIOLATION that results when a file is opened by another process, but not locked, and a range lock has been taken on the file. Microsoft Outlook takes range locks on .PST files.