// Exceptions.cs
// ------------------------------------------------------------------
//
// Copyright (c) 2008, 2009 Dino Chiesa and Microsoft Corporation.
// All rights reserved.
//
// This code module is part of DotNetZip, a zipfile class library.
//
// ------------------------------------------------------------------
//
// This code is licensed under the Microsoft Public License.
// See the file License.txt for the license details.
// More info on: http://dotnetzip.codeplex.com
//
// ------------------------------------------------------------------
//
// last saved (in emacs):
// Time-stamp: <2011-July-12 12:19:10>
//
// ------------------------------------------------------------------
//
// This module defines exceptions used in the class library.
//
using System;
using System.Collections.Generic;
using System.Text;
#if !NETCF
using System.Runtime.Serialization;
#endif
namespace OfficeOpenXml.Packaging.Ionic.Zip
{
/////
///// Base exception type for all custom exceptions in the Zip library. It acts as a marker class.
/////
//[AttributeUsage(AttributeTargets.Class)]
//public class ZipExceptionAttribute : Attribute { }
///
/// Issued when an ZipEntry.ExtractWithPassword() method is invoked
/// with an incorrect password.
///
#if !SILVERLIGHT
[Serializable]
#endif
[System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000B")]
public class BadPasswordException : ZipException
{
///
/// Default ctor.
///
public BadPasswordException() { }
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The message in the exception.
public BadPasswordException(String message)
: base(message)
{ }
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The message in the exception.
/// The innerException for this exception.
public BadPasswordException(String message, Exception innerException)
: base(message, innerException)
{
}
#if ! (NETCF || SILVERLIGHT)
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The serialization info for the exception.
/// The streaming context from which to deserialize.
protected BadPasswordException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endif
}
///
/// Indicates that a read was attempted on a stream, and bad or incomplete data was
/// received.
///
#if !SILVERLIGHT
[Serializable]
#endif
[System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000A")]
public class BadReadException : ZipException
{
///
/// Default ctor.
///
public BadReadException() { }
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The message in the exception.
public BadReadException(String message)
: base(message)
{ }
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The message in the exception.
/// The innerException for this exception.
public BadReadException(String message, Exception innerException)
: base(message, innerException)
{
}
#if ! (NETCF || SILVERLIGHT)
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The serialization info for the exception.
/// The streaming context from which to deserialize.
protected BadReadException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endif
}
///
/// Issued when an CRC check fails upon extracting an entry from a zip archive.
///
#if !SILVERLIGHT
[Serializable]
#endif
[System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00009")]
public class BadCrcException : ZipException
{
///
/// Default ctor.
///
public BadCrcException() { }
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The message in the exception.
public BadCrcException(String message)
: base(message)
{ }
#if ! (NETCF || SILVERLIGHT)
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The serialization info for the exception.
/// The streaming context from which to deserialize.
protected BadCrcException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endif
}
///
/// Issued when errors occur saving a self-extracting archive.
///
#if !SILVERLIGHT
[Serializable]
#endif
[System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00008")]
public class SfxGenerationException : ZipException
{
///
/// Default ctor.
///
public SfxGenerationException() { }
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The message in the exception.
public SfxGenerationException(String message)
: base(message)
{ }
#if ! (NETCF || SILVERLIGHT)
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The serialization info for the exception.
/// The streaming context from which to deserialize.
protected SfxGenerationException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endif
}
///
/// Indicates that an operation was attempted on a ZipFile which was not possible
/// given the state of the instance. For example, if you call Save() on a ZipFile
/// which has no filename set, you can get this exception.
///
#if !SILVERLIGHT
[Serializable]
#endif
[System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00007")]
public class BadStateException : ZipException
{
///
/// Default ctor.
///
public BadStateException() { }
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The message in the exception.
public BadStateException(String message)
: base(message)
{ }
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The message in the exception.
/// The innerException for this exception.
public BadStateException(String message, Exception innerException)
: base(message, innerException)
{}
#if ! (NETCF || SILVERLIGHT)
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The serialization info for the exception.
/// The streaming context from which to deserialize.
protected BadStateException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endif
}
///
/// Base class for all exceptions defined by and throw by the Zip library.
///
#if !SILVERLIGHT
[Serializable]
#endif
[System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00006")]
public class ZipException : Exception
{
///
/// Default ctor.
///
public ZipException() { }
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The message in the exception.
public ZipException(String message) : base(message) { }
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The message in the exception.
/// The innerException for this exception.
public ZipException(String message, Exception innerException)
: base(message, innerException)
{ }
#if ! (NETCF || SILVERLIGHT)
///
/// Come on, you know how exceptions work. Why are you looking at this documentation?
///
/// The serialization info for the exception.
/// The streaming context from which to deserialize.
protected ZipException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endif
}
}