1 | // Exceptions.cs
|
---|
2 | // ------------------------------------------------------------------
|
---|
3 | //
|
---|
4 | // Copyright (c) 2008, 2009 Dino Chiesa and Microsoft Corporation.
|
---|
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: <2011-July-12 12:19:10>
|
---|
19 | //
|
---|
20 | // ------------------------------------------------------------------
|
---|
21 | //
|
---|
22 | // This module defines exceptions used in the class library.
|
---|
23 | //
|
---|
24 |
|
---|
25 |
|
---|
26 |
|
---|
27 | using System;
|
---|
28 | using System.Collections.Generic;
|
---|
29 | using System.Text;
|
---|
30 | #if !NETCF
|
---|
31 | using System.Runtime.Serialization;
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | namespace OfficeOpenXml.Packaging.Ionic.Zip
|
---|
35 | {
|
---|
36 | ///// <summary>
|
---|
37 | ///// Base exception type for all custom exceptions in the Zip library. It acts as a marker class.
|
---|
38 | ///// </summary>
|
---|
39 | //[AttributeUsage(AttributeTargets.Class)]
|
---|
40 | //public class ZipExceptionAttribute : Attribute { }
|
---|
41 |
|
---|
42 |
|
---|
43 |
|
---|
44 | /// <summary>
|
---|
45 | /// Issued when an <c>ZipEntry.ExtractWithPassword()</c> method is invoked
|
---|
46 | /// with an incorrect password.
|
---|
47 | /// </summary>
|
---|
48 | #if !SILVERLIGHT
|
---|
49 | [Serializable]
|
---|
50 | #endif
|
---|
51 | [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000B")]
|
---|
52 | public class BadPasswordException : ZipException
|
---|
53 | {
|
---|
54 | /// <summary>
|
---|
55 | /// Default ctor.
|
---|
56 | /// </summary>
|
---|
57 | public BadPasswordException() { }
|
---|
58 |
|
---|
59 | /// <summary>
|
---|
60 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
61 | /// </summary>
|
---|
62 | /// <param name="message">The message in the exception.</param>
|
---|
63 | public BadPasswordException(String message)
|
---|
64 | : base(message)
|
---|
65 | { }
|
---|
66 |
|
---|
67 | /// <summary>
|
---|
68 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
69 | /// </summary>
|
---|
70 | /// <param name="message">The message in the exception.</param>
|
---|
71 | /// <param name="innerException">The innerException for this exception.</param>
|
---|
72 | public BadPasswordException(String message, Exception innerException)
|
---|
73 | : base(message, innerException)
|
---|
74 | {
|
---|
75 | }
|
---|
76 |
|
---|
77 |
|
---|
78 | #if ! (NETCF || SILVERLIGHT)
|
---|
79 | /// <summary>
|
---|
80 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
81 | /// </summary>
|
---|
82 | /// <param name="info">The serialization info for the exception.</param>
|
---|
83 | /// <param name="context">The streaming context from which to deserialize.</param>
|
---|
84 | protected BadPasswordException(SerializationInfo info, StreamingContext context)
|
---|
85 | : base(info, context)
|
---|
86 | { }
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | }
|
---|
90 |
|
---|
91 | /// <summary>
|
---|
92 | /// Indicates that a read was attempted on a stream, and bad or incomplete data was
|
---|
93 | /// received.
|
---|
94 | /// </summary>
|
---|
95 | #if !SILVERLIGHT
|
---|
96 | [Serializable]
|
---|
97 | #endif
|
---|
98 | [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000A")]
|
---|
99 | public class BadReadException : ZipException
|
---|
100 | {
|
---|
101 | /// <summary>
|
---|
102 | /// Default ctor.
|
---|
103 | /// </summary>
|
---|
104 | public BadReadException() { }
|
---|
105 |
|
---|
106 | /// <summary>
|
---|
107 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
108 | /// </summary>
|
---|
109 | /// <param name="message">The message in the exception.</param>
|
---|
110 | public BadReadException(String message)
|
---|
111 | : base(message)
|
---|
112 | { }
|
---|
113 |
|
---|
114 | /// <summary>
|
---|
115 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
116 | /// </summary>
|
---|
117 | /// <param name="message">The message in the exception.</param>
|
---|
118 | /// <param name="innerException">The innerException for this exception.</param>
|
---|
119 | public BadReadException(String message, Exception innerException)
|
---|
120 | : base(message, innerException)
|
---|
121 | {
|
---|
122 | }
|
---|
123 |
|
---|
124 | #if ! (NETCF || SILVERLIGHT)
|
---|
125 | /// <summary>
|
---|
126 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
127 | /// </summary>
|
---|
128 | /// <param name="info">The serialization info for the exception.</param>
|
---|
129 | /// <param name="context">The streaming context from which to deserialize.</param>
|
---|
130 | protected BadReadException(SerializationInfo info, StreamingContext context)
|
---|
131 | : base(info, context)
|
---|
132 | { }
|
---|
133 | #endif
|
---|
134 |
|
---|
135 | }
|
---|
136 |
|
---|
137 |
|
---|
138 |
|
---|
139 | /// <summary>
|
---|
140 | /// Issued when an CRC check fails upon extracting an entry from a zip archive.
|
---|
141 | /// </summary>
|
---|
142 | #if !SILVERLIGHT
|
---|
143 | [Serializable]
|
---|
144 | #endif
|
---|
145 | [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00009")]
|
---|
146 | public class BadCrcException : ZipException
|
---|
147 | {
|
---|
148 | /// <summary>
|
---|
149 | /// Default ctor.
|
---|
150 | /// </summary>
|
---|
151 | public BadCrcException() { }
|
---|
152 |
|
---|
153 | /// <summary>
|
---|
154 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
155 | /// </summary>
|
---|
156 | /// <param name="message">The message in the exception.</param>
|
---|
157 | public BadCrcException(String message)
|
---|
158 | : base(message)
|
---|
159 | { }
|
---|
160 |
|
---|
161 |
|
---|
162 | #if ! (NETCF || SILVERLIGHT)
|
---|
163 | /// <summary>
|
---|
164 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
165 | /// </summary>
|
---|
166 | /// <param name="info">The serialization info for the exception.</param>
|
---|
167 | /// <param name="context">The streaming context from which to deserialize.</param>
|
---|
168 | protected BadCrcException(SerializationInfo info, StreamingContext context)
|
---|
169 | : base(info, context)
|
---|
170 | { }
|
---|
171 | #endif
|
---|
172 |
|
---|
173 | }
|
---|
174 |
|
---|
175 |
|
---|
176 | /// <summary>
|
---|
177 | /// Issued when errors occur saving a self-extracting archive.
|
---|
178 | /// </summary>
|
---|
179 | #if !SILVERLIGHT
|
---|
180 | [Serializable]
|
---|
181 | #endif
|
---|
182 | [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00008")]
|
---|
183 | public class SfxGenerationException : ZipException
|
---|
184 | {
|
---|
185 | /// <summary>
|
---|
186 | /// Default ctor.
|
---|
187 | /// </summary>
|
---|
188 | public SfxGenerationException() { }
|
---|
189 |
|
---|
190 | /// <summary>
|
---|
191 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
192 | /// </summary>
|
---|
193 | /// <param name="message">The message in the exception.</param>
|
---|
194 | public SfxGenerationException(String message)
|
---|
195 | : base(message)
|
---|
196 | { }
|
---|
197 |
|
---|
198 | #if ! (NETCF || SILVERLIGHT)
|
---|
199 | /// <summary>
|
---|
200 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
201 | /// </summary>
|
---|
202 | /// <param name="info">The serialization info for the exception.</param>
|
---|
203 | /// <param name="context">The streaming context from which to deserialize.</param>
|
---|
204 | protected SfxGenerationException(SerializationInfo info, StreamingContext context)
|
---|
205 | : base(info, context)
|
---|
206 | { }
|
---|
207 | #endif
|
---|
208 |
|
---|
209 | }
|
---|
210 |
|
---|
211 |
|
---|
212 | /// <summary>
|
---|
213 | /// Indicates that an operation was attempted on a ZipFile which was not possible
|
---|
214 | /// given the state of the instance. For example, if you call <c>Save()</c> on a ZipFile
|
---|
215 | /// which has no filename set, you can get this exception.
|
---|
216 | /// </summary>
|
---|
217 | #if !SILVERLIGHT
|
---|
218 | [Serializable]
|
---|
219 | #endif
|
---|
220 | [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00007")]
|
---|
221 | public class BadStateException : ZipException
|
---|
222 | {
|
---|
223 | /// <summary>
|
---|
224 | /// Default ctor.
|
---|
225 | /// </summary>
|
---|
226 | public BadStateException() { }
|
---|
227 |
|
---|
228 | /// <summary>
|
---|
229 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
230 | /// </summary>
|
---|
231 | /// <param name="message">The message in the exception.</param>
|
---|
232 | public BadStateException(String message)
|
---|
233 | : base(message)
|
---|
234 | { }
|
---|
235 |
|
---|
236 | /// <summary>
|
---|
237 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
238 | /// </summary>
|
---|
239 | /// <param name="message">The message in the exception.</param>
|
---|
240 | /// <param name="innerException">The innerException for this exception.</param>
|
---|
241 | public BadStateException(String message, Exception innerException)
|
---|
242 | : base(message, innerException)
|
---|
243 | {}
|
---|
244 |
|
---|
245 | #if ! (NETCF || SILVERLIGHT)
|
---|
246 | /// <summary>
|
---|
247 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
248 | /// </summary>
|
---|
249 | /// <param name="info">The serialization info for the exception.</param>
|
---|
250 | /// <param name="context">The streaming context from which to deserialize.</param>
|
---|
251 | protected BadStateException(SerializationInfo info, StreamingContext context)
|
---|
252 | : base(info, context)
|
---|
253 | { }
|
---|
254 | #endif
|
---|
255 |
|
---|
256 | }
|
---|
257 |
|
---|
258 | /// <summary>
|
---|
259 | /// Base class for all exceptions defined by and throw by the Zip library.
|
---|
260 | /// </summary>
|
---|
261 | #if !SILVERLIGHT
|
---|
262 | [Serializable]
|
---|
263 | #endif
|
---|
264 | [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00006")]
|
---|
265 | public class ZipException : Exception
|
---|
266 | {
|
---|
267 | /// <summary>
|
---|
268 | /// Default ctor.
|
---|
269 | /// </summary>
|
---|
270 | public ZipException() { }
|
---|
271 |
|
---|
272 | /// <summary>
|
---|
273 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
274 | /// </summary>
|
---|
275 | /// <param name="message">The message in the exception.</param>
|
---|
276 | public ZipException(String message) : base(message) { }
|
---|
277 |
|
---|
278 | /// <summary>
|
---|
279 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
280 | /// </summary>
|
---|
281 | /// <param name="message">The message in the exception.</param>
|
---|
282 | /// <param name="innerException">The innerException for this exception.</param>
|
---|
283 | public ZipException(String message, Exception innerException)
|
---|
284 | : base(message, innerException)
|
---|
285 | { }
|
---|
286 |
|
---|
287 | #if ! (NETCF || SILVERLIGHT)
|
---|
288 | /// <summary>
|
---|
289 | /// Come on, you know how exceptions work. Why are you looking at this documentation?
|
---|
290 | /// </summary>
|
---|
291 | /// <param name="info">The serialization info for the exception.</param>
|
---|
292 | /// <param name="context">The streaming context from which to deserialize.</param>
|
---|
293 | protected ZipException(SerializationInfo info, StreamingContext context)
|
---|
294 | : base(info, context)
|
---|
295 | { }
|
---|
296 | #endif
|
---|
297 |
|
---|
298 | }
|
---|
299 |
|
---|
300 | }
|
---|