diff --git a/websocket-sharp/Net/CookieCollection.cs b/websocket-sharp/Net/CookieCollection.cs index 8db5ca17..a4caada9 100644 --- a/websocket-sharp/Net/CookieCollection.cs +++ b/websocket-sharp/Net/CookieCollection.cs @@ -148,12 +148,12 @@ namespace WebSocketSharp.Net /// /// is out of allowable range of indexes for the collection. /// - public Cookie this [int index] { + public Cookie this[int index] { get { if (index < 0 || index >= _list.Count) throw new ArgumentOutOfRangeException ("index"); - return _list [index]; + return _list[index]; } } @@ -170,7 +170,7 @@ namespace WebSocketSharp.Net /// /// is . /// - public Cookie this [string name] { + public Cookie this[string name] { get { if (name == null) throw new ArgumentNullException ("name"); @@ -219,15 +219,15 @@ namespace WebSocketSharp.Net var cookies = new CookieCollection (); Cookie cookie = null; - var version = 0; + var ver = 0; var pairs = splitCookieHeaderValue (value); - for (int i = 0; i < pairs.Length; i++) { - var pair = pairs [i].Trim (); + for (var i = 0; i < pairs.Length; i++) { + var pair = pairs[i].Trim (); if (pair.Length == 0) continue; if (pair.StartsWith ("$version", StringComparison.InvariantCultureIgnoreCase)) { - version = Int32.Parse (pair.GetValue ('=', true)); + ver = Int32.Parse (pair.GetValue ('=', true)); } else if (pair.StartsWith ("$path", StringComparison.InvariantCultureIgnoreCase)) { if (cookie != null) @@ -265,8 +265,8 @@ namespace WebSocketSharp.Net } cookie = new Cookie (name, val); - if (version != 0) - cookie.Version = version; + if (ver != 0) + cookie.Version = ver; } } @@ -282,8 +282,8 @@ namespace WebSocketSharp.Net Cookie cookie = null; var pairs = splitCookieHeaderValue (value); - for (int i = 0; i < pairs.Length; i++) { - var pair = pairs [i].Trim (); + for (var i = 0; i < pairs.Length; i++) { + var pair = pairs[i].Trim (); if (pair.Length == 0) continue; @@ -292,14 +292,14 @@ namespace WebSocketSharp.Net cookie.Version = Int32.Parse (pair.GetValue ('=', true)); } else if (pair.StartsWith ("expires", StringComparison.InvariantCultureIgnoreCase)) { - var buffer = new StringBuilder (pair.GetValue ('='), 32); + var buff = new StringBuilder (pair.GetValue ('='), 32); if (i < pairs.Length - 1) - buffer.AppendFormat (", {0}", pairs [++i].Trim ()); + buff.AppendFormat (", {0}", pairs[++i].Trim ()); DateTime expires; if (!DateTime.TryParseExact ( - buffer.ToString (), - new [] { "ddd, dd'-'MMM'-'yyyy HH':'mm':'ss 'GMT'", "r" }, + buff.ToString (), + new[] { "ddd, dd'-'MMM'-'yyyy HH':'mm':'ss 'GMT'", "r" }, CultureInfo.CreateSpecificCulture ("en-US"), DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out expires)) @@ -384,21 +384,21 @@ namespace WebSocketSharp.Net var name = cookie.Name; var path = cookie.Path; var domain = cookie.Domain; - var version = cookie.Version; + var ver = cookie.Version; - for (int i = _list.Count - 1; i >= 0; i--) { - var c = _list [i]; + for (var i = _list.Count - 1; i >= 0; i--) { + var c = _list[i]; if (c.Name.Equals (name, StringComparison.InvariantCultureIgnoreCase) && c.Path.Equals (path, StringComparison.InvariantCulture) && c.Domain.Equals (domain, StringComparison.InvariantCultureIgnoreCase) && - c.Version == version) + c.Version == ver) return i; } return -1; } - private static string [] splitCookieHeaderValue (string value) + private static string[] splitCookieHeaderValue (string value) { return new List (value.SplitHeaderValue (',', ';')).ToArray (); } @@ -425,7 +425,7 @@ namespace WebSocketSharp.Net } if (!cookie.Expired) { - _list [pos] = cookie; + _list[pos] = cookie; return; } @@ -468,7 +468,7 @@ namespace WebSocketSharp.Net return; } - _list [pos] = cookie; + _list[pos] = cookie; } /// @@ -567,7 +567,7 @@ namespace WebSocketSharp.Net /// The number of elements in the collection is greater than the available space from /// to the end of the destination . /// - public void CopyTo (Cookie [] array, int index) + public void CopyTo (Cookie[] array, int index) { if (array == null) throw new ArgumentNullException ("array");