diff options
| author | Andrew Rabert <6550543+nvllsvm@users.noreply.github.com> | 2019-01-19 15:11:50 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-19 15:11:50 -0500 |
| commit | 55538764fa06a64795c099fc6496df9dbb4156bd (patch) | |
| tree | 8c1f94861ecebdf634b70a7265945b6f8f13aff1 /SocketHttpListener/CloseEventArgs.cs | |
| parent | 3b52035ee064a5d9aa215d9515211d4508585d39 (diff) | |
| parent | c5430f86b0b5863482e7c4f7e55a79c7d88c133b (diff) | |
Merge pull request #575 from EraYaN/reformat
Reformat all C# server code to conform with code standards
Diffstat (limited to 'SocketHttpListener/CloseEventArgs.cs')
| -rw-r--r-- | SocketHttpListener/CloseEventArgs.cs | 131 |
1 files changed, 60 insertions, 71 deletions
diff --git a/SocketHttpListener/CloseEventArgs.cs b/SocketHttpListener/CloseEventArgs.cs index ff30126bc..c6460fd23 100644 --- a/SocketHttpListener/CloseEventArgs.cs +++ b/SocketHttpListener/CloseEventArgs.cs @@ -3,88 +3,77 @@ using System.Text; namespace SocketHttpListener { - /// <summary> - /// Contains the event data associated with a <see cref="WebSocket.OnClose"/> event. - /// </summary> - /// <remarks> - /// A <see cref="WebSocket.OnClose"/> event occurs when the WebSocket connection has been closed. - /// If you would like to get the reason for the close, you should access the <see cref="Code"/> or - /// <see cref="Reason"/> property. - /// </remarks> - public class CloseEventArgs : EventArgs - { - #region Private Fields + /// <summary> + /// Contains the event data associated with a <see cref="WebSocket.OnClose"/> event. + /// </summary> + /// <remarks> + /// A <see cref="WebSocket.OnClose"/> event occurs when the WebSocket connection has been closed. + /// If you would like to get the reason for the close, you should access the <see cref="Code"/> or + /// <see cref="Reason"/> property. + /// </remarks> + public class CloseEventArgs : EventArgs + { + #region Private Fields - private bool _clean; - private ushort _code; - private string _reason; + private bool _clean; + private ushort _code; + private string _reason; - #endregion + #endregion - #region Internal Constructors + #region Internal Constructors - internal CloseEventArgs (PayloadData payload) - { - var data = payload.ApplicationData; - var len = data.Length; - _code = len > 1 - ? data.SubArray (0, 2).ToUInt16 (ByteOrder.Big) - : (ushort) CloseStatusCode.NoStatusCode; + internal CloseEventArgs(PayloadData payload) + { + var data = payload.ApplicationData; + var len = data.Length; + _code = len > 1 + ? data.SubArray(0, 2).ToUInt16(ByteOrder.Big) + : (ushort)CloseStatusCode.NoStatusCode; - _reason = len > 2 - ? GetUtf8String(data.SubArray (2, len - 2)) - : string.Empty; - } + _reason = len > 2 + ? GetUtf8String(data.SubArray(2, len - 2)) + : string.Empty; + } - private static string GetUtf8String(byte[] bytes) - { - return Encoding.UTF8.GetString(bytes, 0, bytes.Length); - } + private static string GetUtf8String(byte[] bytes) + { + return Encoding.UTF8.GetString(bytes, 0, bytes.Length); + } - #endregion + #endregion - #region Public Properties + #region Public Properties - /// <summary> - /// Gets the status code for the close. - /// </summary> - /// <value> - /// A <see cref="ushort"/> that represents the status code for the close if any. - /// </value> - public ushort Code { - get { - return _code; - } - } + /// <summary> + /// Gets the status code for the close. + /// </summary> + /// <value> + /// A <see cref="ushort"/> that represents the status code for the close if any. + /// </value> + public ushort Code => _code; - /// <summary> - /// Gets the reason for the close. - /// </summary> - /// <value> - /// A <see cref="string"/> that represents the reason for the close if any. - /// </value> - public string Reason { - get { - return _reason; - } - } + /// <summary> + /// Gets the reason for the close. + /// </summary> + /// <value> + /// A <see cref="string"/> that represents the reason for the close if any. + /// </value> + public string Reason => _reason; - /// <summary> - /// Gets a value indicating whether the WebSocket connection has been closed cleanly. - /// </summary> - /// <value> - /// <c>true</c> if the WebSocket connection has been closed cleanly; otherwise, <c>false</c>. - /// </value> - public bool WasClean { - get { - return _clean; - } + /// <summary> + /// Gets a value indicating whether the WebSocket connection has been closed cleanly. + /// </summary> + /// <value> + /// <c>true</c> if the WebSocket connection has been closed cleanly; otherwise, <c>false</c>. + /// </value> + public bool WasClean + { + get => _clean; - internal set { - _clean = value; - } - } + internal set => _clean = value; + } - #endregion - } + #endregion + } } |
