SevenZipArchiveException.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #if UNMANAGED
  2. namespace SevenZip
  3. {
  4. using System;
  5. using System.Runtime.Serialization;
  6. /// <summary>
  7. /// Exception class for 7-zip archive open or read operations.
  8. /// </summary>
  9. [Serializable]
  10. public class SevenZipArchiveException : SevenZipException
  11. {
  12. /// <summary>
  13. /// Exception default message which is displayed if no extra information is specified
  14. /// </summary>
  15. public static string DefaultMessage =
  16. $"Invalid archive: open/read error! Is it encrypted and a wrong password was provided?{Environment.NewLine}" +
  17. "If your archive is an exotic one, it is possible that SevenZipSharp has no signature for " +
  18. "its format and thus decided it is TAR by mistake.";
  19. /// <summary>
  20. /// Initializes a new instance of the SevenZipArchiveException class
  21. /// </summary>
  22. public SevenZipArchiveException() : base(DefaultMessage) { }
  23. /// <summary>
  24. /// Initializes a new instance of the SevenZipArchiveException class
  25. /// </summary>
  26. /// <param name="message">Additional detailed message</param>
  27. public SevenZipArchiveException(string message) : base(DefaultMessage, message) { }
  28. /// <summary>
  29. /// Initializes a new instance of the SevenZipArchiveException class
  30. /// </summary>
  31. /// <param name="message">Additional detailed message</param>
  32. /// <param name="inner">Inner exception occurred</param>
  33. public SevenZipArchiveException(string message, Exception inner) : base(DefaultMessage, message, inner) { }
  34. /// <summary>
  35. /// Initializes a new instance of the SevenZipArchiveException class
  36. /// </summary>
  37. /// <param name="info">All data needed for serialization or deserialization</param>
  38. /// <param name="context">Serialized stream descriptor</param>
  39. protected SevenZipArchiveException(
  40. SerializationInfo info, StreamingContext context)
  41. : base(info, context) { }
  42. }
  43. }
  44. #endif