InvalidNameException.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Net.ApiService.Compression.Exceptions;
  3. using System.Runtime.Serialization;
  4. namespace System.Net.ApiService.Compression.Core {
  5. /// <summary>
  6. /// InvalidNameException is thrown for invalid names such as directory traversal paths and names with invalid characters
  7. /// </summary>
  8. [Serializable]
  9. public class InvalidNameException : SharpZipBaseException
  10. {
  11. /// <summary>
  12. /// Initializes a new instance of the InvalidNameException class with a default error message.
  13. /// </summary>
  14. public InvalidNameException() : base("An invalid name was specified")
  15. {
  16. }
  17. /// <summary>
  18. /// Initializes a new instance of the InvalidNameException class with a specified error message.
  19. /// </summary>
  20. /// <param name="message">A message describing the exception.</param>
  21. public InvalidNameException(string message) : base(message)
  22. {
  23. }
  24. /// <summary>
  25. /// Initializes a new instance of the InvalidNameException class with a specified
  26. /// error message and a reference to the inner exception that is the cause of this exception.
  27. /// </summary>
  28. /// <param name="message">A message describing the exception.</param>
  29. /// <param name="innerException">The inner exception</param>
  30. public InvalidNameException(string message, Exception innerException) : base(message, innerException)
  31. {
  32. }
  33. /// <summary>
  34. /// Initializes a new instance of the InvalidNameException class with serialized data.
  35. /// </summary>
  36. /// <param name="info">
  37. /// The System.Runtime.Serialization.SerializationInfo that holds the serialized
  38. /// object data about the exception being thrown.
  39. /// </param>
  40. /// <param name="context">
  41. /// The System.Runtime.Serialization.StreamingContext that contains contextual information
  42. /// about the source or destination.
  43. /// </param>
  44. protected InvalidNameException(SerializationInfo info, StreamingContext context)
  45. : base(info, context)
  46. {
  47. }
  48. }
  49. }