aboutsummaryrefslogtreecommitdiff
path: root/SocketHttpListener/Ext.cs
diff options
context:
space:
mode:
authorAndrew Rabert <6550543+nvllsvm@users.noreply.github.com>2019-01-22 18:13:47 -0500
committerGitHub <noreply@github.com>2019-01-22 18:13:47 -0500
commit28483bdb54be96ae83e0fded097f534d7e26ba1e (patch)
treee7f4b92326417ebf55eecdf68a01d2c3b9e660d7 /SocketHttpListener/Ext.cs
parent920c39454c05e979eabe81877269cd4517a03ccf (diff)
parent8106c8393b711a7e1d40487e3caf2b014decbe28 (diff)
Merge pull request #651 from jellyfin/release-10.1.0
Release 10.1.0
Diffstat (limited to 'SocketHttpListener/Ext.cs')
-rw-r--r--SocketHttpListener/Ext.cs33
1 files changed, 16 insertions, 17 deletions
diff --git a/SocketHttpListener/Ext.cs b/SocketHttpListener/Ext.cs
index 125775180..b051b6718 100644
--- a/SocketHttpListener/Ext.cs
+++ b/SocketHttpListener/Ext.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Collections.Specialized;
using System.IO;
using System.IO.Compression;
using System.Net;
@@ -149,7 +148,7 @@ namespace SocketHttpListener
internal static string CheckIfValidControlData(this byte[] data, string paramName)
{
return data.Length > 125
- ? String.Format("'{0}' length must be less.", paramName)
+ ? string.Format("'{0}' length must be less.", paramName)
: null;
}
@@ -222,7 +221,7 @@ namespace SocketHttpListener
internal static bool EqualsWith(this int value, char c, Action<int> action)
{
if (value < 0 || value > 255)
- throw new ArgumentOutOfRangeException("value");
+ throw new ArgumentOutOfRangeException(nameof(value));
action(value);
return value == c - 0;
@@ -248,7 +247,7 @@ namespace SocketHttpListener
? "WebSocket server got an internal error."
: code == CloseStatusCode.TlsHandshakeFailure
? "An error has occurred while handshaking."
- : String.Empty;
+ : string.Empty;
}
internal static string GetNameInternal(this string nameAndValue, string separator)
@@ -329,7 +328,7 @@ namespace SocketHttpListener
{
return value.IsToken()
? value
- : String.Format("\"{0}\"", value.Replace("\"", "\\\""));
+ : string.Format("\"{0}\"", value.Replace("\"", "\\\""));
}
internal static byte[] ReadBytes(this Stream stream, int length)
@@ -441,7 +440,8 @@ namespace SocketHttpListener
continue;
}
}
- else {
+ else
+ {
}
buffer.Append(c);
@@ -484,13 +484,13 @@ namespace SocketHttpListener
this CompressionMethod method, params string[] parameters)
{
if (method == CompressionMethod.None)
- return String.Empty;
+ return string.Empty;
- var m = String.Format("permessage-{0}", method.ToString().ToLower());
+ var m = string.Format("permessage-{0}", method.ToString().ToLower());
if (parameters == null || parameters.Length == 0)
return m;
- return String.Format("{0}; {1}", m, parameters.ToString("; "));
+ return string.Format("{0}; {1}", m, parameters.ToString("; "));
}
internal static List<TSource> ToList<TSource>(this IEnumerable<TSource> source)
@@ -715,7 +715,7 @@ namespace SocketHttpListener
case 507: return "Insufficient Storage";
}
- return String.Empty;
+ return string.Empty;
}
/// <summary>
@@ -855,7 +855,7 @@ namespace SocketHttpListener
public static byte[] ToHostOrder(this byte[] src, ByteOrder srcOrder)
{
if (src == null)
- throw new ArgumentNullException("src");
+ throw new ArgumentNullException(nameof(src));
return src.Length > 1 && !srcOrder.IsHostOrder()
? src.Reverse()
@@ -886,14 +886,14 @@ namespace SocketHttpListener
public static string ToString<T>(this T[] array, string separator)
{
if (array == null)
- throw new ArgumentNullException("array");
+ throw new ArgumentNullException(nameof(array));
var len = array.Length;
if (len == 0)
- return String.Empty;
+ return string.Empty;
if (separator == null)
- separator = String.Empty;
+ separator = string.Empty;
var buff = new StringBuilder(64);
(len - 1).Times(i => buff.AppendFormat("{0}{1}", array[i].ToString(), separator));
@@ -932,9 +932,8 @@ namespace SocketHttpListener
/// </param>
public static Uri ToUri(this string uriString)
{
- Uri res;
return Uri.TryCreate(
- uriString, uriString.MaybeUri() ? UriKind.Absolute : UriKind.Relative, out res)
+ uriString, uriString.MaybeUri() ? UriKind.Absolute : UriKind.Relative, out var res)
? res
: null;
}
@@ -958,4 +957,4 @@ namespace SocketHttpListener
#endregion
}
-} \ No newline at end of file
+}