From 0082b2d19132be2ad2a587dfe6d0f847206d3d7e Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 18 Oct 2014 15:22:38 +0900 Subject: [PATCH] Refactored HttpListenerPrefixCollection.cs --- .../Net/HttpListenerPrefixCollection.cs | 72 ++++++++----------- 1 file changed, 28 insertions(+), 44 deletions(-) diff --git a/websocket-sharp/Net/HttpListenerPrefixCollection.cs b/websocket-sharp/Net/HttpListenerPrefixCollection.cs index 170ac3c8..36ced9ea 100644 --- a/websocket-sharp/Net/HttpListenerPrefixCollection.cs +++ b/websocket-sharp/Net/HttpListenerPrefixCollection.cs @@ -82,7 +82,7 @@ namespace WebSocketSharp.Net #region Public Properties /// - /// Gets the number of prefixes contained in the . + /// Gets the number of prefixes in the collection. /// /// /// An that represents the number of prefixes. @@ -94,8 +94,7 @@ namespace WebSocketSharp.Net } /// - /// Gets a value indicating whether the access to the - /// is read-only. + /// Gets a value indicating whether the access to the collection is read-only. /// /// /// Always returns false. @@ -107,8 +106,7 @@ namespace WebSocketSharp.Net } /// - /// Gets a value indicating whether the access to the - /// is synchronized. + /// Gets a value indicating whether the access to the collection is synchronized. /// /// /// Always returns false. @@ -124,13 +122,11 @@ namespace WebSocketSharp.Net #region Public Methods /// - /// Adds the specified to - /// the . + /// Adds the specified to the collection. /// /// /// A that represents the URI prefix to add. The prefix must be - /// a well-formed URI prefix with http or https scheme, and must be terminated with - /// a "/". + /// a well-formed URI prefix with http or https scheme, and must end with a '/'. /// /// /// is . @@ -139,8 +135,7 @@ namespace WebSocketSharp.Net /// is invalid. /// /// - /// The associated with - /// this is closed. + /// The associated with this collection is closed. /// public void Add (string uriPrefix) { @@ -155,11 +150,10 @@ namespace WebSocketSharp.Net } /// - /// Removes all URI prefixes from the . + /// Removes all URI prefixes from the collection. /// /// - /// The associated with - /// this is closed. + /// The associated with this collection is closed. /// public void Clear () { @@ -170,12 +164,12 @@ namespace WebSocketSharp.Net } /// - /// Returns a value indicating whether the contains - /// the specified . + /// Returns a value indicating whether the collection contains the specified + /// . /// /// - /// true if the contains - /// ; otherwise, false. + /// true if the collection contains ; + /// otherwise, false. /// /// /// A that represents the URI prefix to test. @@ -184,8 +178,7 @@ namespace WebSocketSharp.Net /// is . /// /// - /// The associated with - /// this is closed. + /// The associated with this collection is closed. /// public bool Contains (string uriPrefix) { @@ -197,20 +190,17 @@ namespace WebSocketSharp.Net } /// - /// Copies the contents of the to - /// the specified . + /// Copies the contents of the collection to the specified . /// /// - /// An that receives the URI prefix strings in - /// the . + /// An that receives the URI prefix strings in the collection. /// /// /// An that represents the zero-based index in /// at which copying begins. /// /// - /// The associated with - /// this is closed. + /// The associated with this collection is closed. /// public void CopyTo (Array array, int offset) { @@ -219,22 +209,19 @@ namespace WebSocketSharp.Net } /// - /// Copies the contents of the to - /// the specified array of . + /// Copies the contents of the collection to the specified array of . /// /// - /// An array of that receives the URI prefix strings in - /// the . + /// An array of that receives the URI prefix strings in the collection. /// /// /// An that represents the zero-based index in /// at which copying begins. /// /// - /// The associated with - /// this is closed. + /// The associated with this collection is closed. /// - public void CopyTo (string [] array, int offset) + public void CopyTo (string[] array, int offset) { _listener.CheckDisposed (); _prefixes.CopyTo (array, offset); @@ -245,7 +232,7 @@ namespace WebSocketSharp.Net /// /// /// An instance used to iterate - /// through the . + /// through the collection. /// public IEnumerator GetEnumerator () { @@ -253,8 +240,7 @@ namespace WebSocketSharp.Net } /// - /// Removes the specified from the list of prefixes in - /// the . + /// Removes the specified from the collection. /// /// /// true if is successfully found and removed; @@ -267,8 +253,7 @@ namespace WebSocketSharp.Net /// is . /// /// - /// The associated with - /// this is closed. + /// The associated with this collection is closed. /// public bool Remove (string uriPrefix) { @@ -276,23 +261,22 @@ namespace WebSocketSharp.Net if (uriPrefix == null) throw new ArgumentNullException ("uriPrefix"); - var result = _prefixes.Remove (uriPrefix); - if (result && _listener.IsListening) + var res = _prefixes.Remove (uriPrefix); + if (res && _listener.IsListening) EndPointManager.RemovePrefix (uriPrefix, _listener); - return result; + return res; } #endregion - #region Explicit Interface Implementation + #region Explicit Interface Implementations /// /// Gets the enumerator used to iterate through the . /// /// - /// An instance used to iterate through - /// the . + /// An instance used to iterate through the collection. /// IEnumerator IEnumerable.GetEnumerator () {