初始化上传
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib
|
||||
{
|
||||
/// <summary>
|
||||
/// SharpZipBaseException is the base exception class for SharpZipLib.
|
||||
/// All library exceptions are derived from this.
|
||||
/// </summary>
|
||||
/// <remarks>NOTE: Not all exceptions thrown will be derived from this class.
|
||||
/// A variety of other exceptions are possible for example <see cref="ArgumentNullException"></see></remarks>
|
||||
[Serializable]
|
||||
public class SharpZipBaseException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the SharpZipBaseException class.
|
||||
/// </summary>
|
||||
public SharpZipBaseException()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the SharpZipBaseException class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">A message describing the exception.</param>
|
||||
public SharpZipBaseException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the SharpZipBaseException class with a specified
|
||||
/// error message and a reference to the inner exception that is the cause of this exception.
|
||||
/// </summary>
|
||||
/// <param name="message">A message describing the exception.</param>
|
||||
/// <param name="innerException">The inner exception</param>
|
||||
public SharpZipBaseException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the SharpZipBaseException class with serialized data.
|
||||
/// </summary>
|
||||
/// <param name="info">
|
||||
/// The System.Runtime.Serialization.SerializationInfo that holds the serialized
|
||||
/// object data about the exception being thrown.
|
||||
/// </param>
|
||||
/// <param name="context">
|
||||
/// The System.Runtime.Serialization.StreamingContext that contains contextual information
|
||||
/// about the source or destination.
|
||||
/// </param>
|
||||
protected SharpZipBaseException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that an error occurred during decoding of a input stream due to corrupt
|
||||
/// data or (unintentional) library incompatibility.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class StreamDecodingException : SharpZipBaseException
|
||||
{
|
||||
private const string GenericMessage = "Input stream could not be decoded";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the StreamDecodingException with a generic message
|
||||
/// </summary>
|
||||
public StreamDecodingException() : base(GenericMessage) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the StreamDecodingException class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">A message describing the exception.</param>
|
||||
public StreamDecodingException(string message) : base(message) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the StreamDecodingException class with a specified
|
||||
/// error message and a reference to the inner exception that is the cause of this exception.
|
||||
/// </summary>
|
||||
/// <param name="message">A message describing the exception.</param>
|
||||
/// <param name="innerException">The inner exception</param>
|
||||
public StreamDecodingException(string message, Exception innerException) : base(message, innerException) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the StreamDecodingException class with serialized data.
|
||||
/// </summary>
|
||||
/// <param name="info">
|
||||
/// The System.Runtime.Serialization.SerializationInfo that holds the serialized
|
||||
/// object data about the exception being thrown.
|
||||
/// </param>
|
||||
/// <param name="context">
|
||||
/// The System.Runtime.Serialization.StreamingContext that contains contextual information
|
||||
/// about the source or destination.
|
||||
/// </param>
|
||||
protected StreamDecodingException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the input stream could not decoded due to known library incompability or missing features
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class StreamUnsupportedException : StreamDecodingException
|
||||
{
|
||||
private const string GenericMessage = "Input stream is in a unsupported format";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the StreamUnsupportedException with a generic message
|
||||
/// </summary>
|
||||
public StreamUnsupportedException() : base(GenericMessage) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the StreamUnsupportedException class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">A message describing the exception.</param>
|
||||
public StreamUnsupportedException(string message) : base(message) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the StreamUnsupportedException class with a specified
|
||||
/// error message and a reference to the inner exception that is the cause of this exception.
|
||||
/// </summary>
|
||||
/// <param name="message">A message describing the exception.</param>
|
||||
/// <param name="innerException">The inner exception</param>
|
||||
public StreamUnsupportedException(string message, Exception innerException) : base(message, innerException) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the StreamUnsupportedException class with serialized data.
|
||||
/// </summary>
|
||||
/// <param name="info">
|
||||
/// The System.Runtime.Serialization.SerializationInfo that holds the serialized
|
||||
/// object data about the exception being thrown.
|
||||
/// </param>
|
||||
/// <param name="context">
|
||||
/// The System.Runtime.Serialization.StreamingContext that contains contextual information
|
||||
/// about the source or destination.
|
||||
/// </param>
|
||||
protected StreamUnsupportedException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the input stream could not decoded due to the stream ending before enough data had been provided
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class UnexpectedEndOfStreamException : StreamDecodingException
|
||||
{
|
||||
private const string GenericMessage = "Input stream ended unexpectedly";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the UnexpectedEndOfStreamException with a generic message
|
||||
/// </summary>
|
||||
public UnexpectedEndOfStreamException() : base(GenericMessage) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the UnexpectedEndOfStreamException class with a specified error message.
|
||||
/// </summary>
|
||||
/// <param name="message">A message describing the exception.</param>
|
||||
public UnexpectedEndOfStreamException(string message) : base(message) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the UnexpectedEndOfStreamException class with a specified
|
||||
/// error message and a reference to the inner exception that is the cause of this exception.
|
||||
/// </summary>
|
||||
/// <param name="message">A message describing the exception.</param>
|
||||
/// <param name="innerException">The inner exception</param>
|
||||
public UnexpectedEndOfStreamException(string message, Exception innerException) : base(message, innerException) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the UnexpectedEndOfStreamException class with serialized data.
|
||||
/// </summary>
|
||||
/// <param name="info">
|
||||
/// The System.Runtime.Serialization.SerializationInfo that holds the serialized
|
||||
/// object data about the exception being thrown.
|
||||
/// </param>
|
||||
/// <param name="context">
|
||||
/// The System.Runtime.Serialization.StreamingContext that contains contextual information
|
||||
/// about the source or destination.
|
||||
/// </param>
|
||||
protected UnexpectedEndOfStreamException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ICSharpCode.SharpZipLib
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that a value was outside of the expected range when decoding an input stream
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ValueOutOfRangeException : StreamDecodingException
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ValueOutOfRangeException class naming the causing variable
|
||||
/// </summary>
|
||||
/// <param name="nameOfValue">Name of the variable, use: nameof()</param>
|
||||
public ValueOutOfRangeException(string nameOfValue)
|
||||
: base($"{nameOfValue} out of range") { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ValueOutOfRangeException class naming the causing variable,
|
||||
/// it's current value and expected range.
|
||||
/// </summary>
|
||||
/// <param name="nameOfValue">Name of the variable, use: nameof()</param>
|
||||
/// <param name="value">The invalid value</param>
|
||||
/// <param name="maxValue">Expected maximum value</param>
|
||||
/// <param name="minValue">Expected minimum value</param>
|
||||
public ValueOutOfRangeException(string nameOfValue, long value, long maxValue, long minValue = 0)
|
||||
: this(nameOfValue, value.ToString(), maxValue.ToString(), minValue.ToString()) { }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ValueOutOfRangeException class naming the causing variable,
|
||||
/// it's current value and expected range.
|
||||
/// </summary>
|
||||
/// <param name="nameOfValue">Name of the variable, use: nameof()</param>
|
||||
/// <param name="value">The invalid value</param>
|
||||
/// <param name="maxValue">Expected maximum value</param>
|
||||
/// <param name="minValue">Expected minimum value</param>
|
||||
public ValueOutOfRangeException(string nameOfValue, string value, string maxValue, string minValue = "0") :
|
||||
base($"{nameOfValue} out of range: {value}, should be {minValue}..{maxValue}")
|
||||
{ }
|
||||
|
||||
private ValueOutOfRangeException()
|
||||
{
|
||||
}
|
||||
|
||||
private ValueOutOfRangeException(string message, Exception innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ValueOutOfRangeException class with serialized data.
|
||||
/// </summary>
|
||||
/// <param name="info">
|
||||
/// The System.Runtime.Serialization.SerializationInfo that holds the serialized
|
||||
/// object data about the exception being thrown.
|
||||
/// </param>
|
||||
/// <param name="context">
|
||||
/// The System.Runtime.Serialization.StreamingContext that contains contextual information
|
||||
/// about the source or destination.
|
||||
/// </param>
|
||||
protected ValueOutOfRangeException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user