CookieException.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. #region License
  2. /*
  3. * CookieException.cs
  4. *
  5. * This code is derived from CookieException.cs (System.Net) of Mono
  6. * (http://www.mono-project.com).
  7. *
  8. * The MIT License
  9. *
  10. * Copyright (c) 2012-2019 sta.blockhead
  11. *
  12. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13. * of this software and associated documentation files (the "Software"), to deal
  14. * in the Software without restriction, including without limitation the rights
  15. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16. * copies of the Software, and to permit persons to whom the Software is
  17. * furnished to do so, subject to the following conditions:
  18. *
  19. * The above copyright notice and this permission notice shall be included in
  20. * all copies or substantial portions of the Software.
  21. *
  22. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  24. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  25. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  26. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  27. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  28. * THE SOFTWARE.
  29. */
  30. #endregion
  31. #region Authors
  32. /*
  33. * Authors:
  34. * - Lawrence Pit <loz@cable.a2000.nl>
  35. */
  36. #endregion
  37. using System;
  38. using System.Runtime.Serialization;
  39. using System.Security.Permissions;
  40. namespace WebSocketSharp.Net
  41. {
  42. /// <summary>
  43. /// The exception that is thrown when a <see cref="Cookie"/> gets an error.
  44. /// </summary>
  45. [Serializable]
  46. public class CookieException : FormatException, ISerializable
  47. {
  48. #region Internal Constructors
  49. internal CookieException (string message)
  50. : base (message)
  51. {
  52. }
  53. internal CookieException (string message, Exception innerException)
  54. : base (message, innerException)
  55. {
  56. }
  57. #endregion
  58. #region Protected Constructors
  59. /// <summary>
  60. /// Initializes a new instance of the <see cref="CookieException"/> class
  61. /// with the serialized data.
  62. /// </summary>
  63. /// <param name="serializationInfo">
  64. /// A <see cref="SerializationInfo"/> that holds the serialized object data.
  65. /// </param>
  66. /// <param name="streamingContext">
  67. /// A <see cref="StreamingContext"/> that specifies the source for
  68. /// the deserialization.
  69. /// </param>
  70. /// <exception cref="ArgumentNullException">
  71. /// <paramref name="serializationInfo"/> is <see langword="null"/>.
  72. /// </exception>
  73. protected CookieException (
  74. SerializationInfo serializationInfo, StreamingContext streamingContext
  75. )
  76. : base (serializationInfo, streamingContext)
  77. {
  78. }
  79. #endregion
  80. #region Public Constructors
  81. /// <summary>
  82. /// Initializes a new instance of the <see cref="CookieException"/> class.
  83. /// </summary>
  84. public CookieException ()
  85. : base ()
  86. {
  87. }
  88. #endregion
  89. #region Public Methods
  90. /// <summary>
  91. /// Populates the specified <see cref="SerializationInfo"/> instance with
  92. /// the data needed to serialize the current instance.
  93. /// </summary>
  94. /// <param name="serializationInfo">
  95. /// A <see cref="SerializationInfo"/> that holds the serialized object data.
  96. /// </param>
  97. /// <param name="streamingContext">
  98. /// A <see cref="StreamingContext"/> that specifies the destination for
  99. /// the serialization.
  100. /// </param>
  101. /// <exception cref="ArgumentNullException">
  102. /// <paramref name="serializationInfo"/> is <see langword="null"/>.
  103. /// </exception>
  104. [
  105. SecurityPermission (
  106. SecurityAction.LinkDemand,
  107. Flags = SecurityPermissionFlag.SerializationFormatter
  108. )
  109. ]
  110. public override void GetObjectData (
  111. SerializationInfo serializationInfo, StreamingContext streamingContext
  112. )
  113. {
  114. base.GetObjectData (serializationInfo, streamingContext);
  115. }
  116. #endregion
  117. #region Explicit Interface Implementation
  118. /// <summary>
  119. /// Populates the specified <see cref="SerializationInfo"/> instance with
  120. /// the data needed to serialize the current instance.
  121. /// </summary>
  122. /// <param name="serializationInfo">
  123. /// A <see cref="SerializationInfo"/> that holds the serialized object data.
  124. /// </param>
  125. /// <param name="streamingContext">
  126. /// A <see cref="StreamingContext"/> that specifies the destination for
  127. /// the serialization.
  128. /// </param>
  129. /// <exception cref="ArgumentNullException">
  130. /// <paramref name="serializationInfo"/> is <see langword="null"/>.
  131. /// </exception>
  132. [
  133. SecurityPermission (
  134. SecurityAction.LinkDemand,
  135. Flags = SecurityPermissionFlag.SerializationFormatter,
  136. SerializationFormatter = true
  137. )
  138. ]
  139. void ISerializable.GetObjectData (
  140. SerializationInfo serializationInfo, StreamingContext streamingContext
  141. )
  142. {
  143. base.GetObjectData (serializationInfo, streamingContext);
  144. }
  145. #endregion
  146. }
  147. }