mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 23:58:57 +00:00
ReSharper format: conform inline 'out' parameters.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -43,13 +43,12 @@ namespace SocketHttpListener.Net
|
||||
if (i < pairs.Length - 1)
|
||||
buffer.AppendFormat(", {0}", pairs[++i].Trim());
|
||||
|
||||
DateTime expires;
|
||||
if (!DateTime.TryParseExact(
|
||||
buffer.ToString(),
|
||||
new[] { "ddd, dd'-'MMM'-'yyyy HH':'mm':'ss 'GMT'", "r" },
|
||||
new CultureInfo("en-US"),
|
||||
DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal,
|
||||
out expires))
|
||||
out var expires))
|
||||
expires = DateTime.Now;
|
||||
|
||||
if (cookie != null && cookie.Expires == DateTime.MinValue)
|
||||
|
||||
@@ -277,8 +277,7 @@ namespace SocketHttpListener.Net
|
||||
public bool BindContext(HttpListenerContext context)
|
||||
{
|
||||
var req = context.Request;
|
||||
ListenerPrefix prefix;
|
||||
var listener = SearchListener(req.Url, out prefix);
|
||||
var listener = SearchListener(req.Url, out var prefix);
|
||||
if (listener == null)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -57,8 +57,7 @@ namespace SocketHttpListener.Net
|
||||
int root = p.IndexOf('/', colon, p.Length - colon);
|
||||
string portString = p.Substring(colon + 1, root - colon - 1);
|
||||
|
||||
int port;
|
||||
if (!int.TryParse(portString, out port) || port <= 0 || port >= 65536)
|
||||
if (!int.TryParse(portString, out var port) || port <= 0 || port >= 65536)
|
||||
{
|
||||
throw new HttpListenerException((int)HttpStatusCode.BadRequest, "net_invalid_port");
|
||||
}
|
||||
|
||||
@@ -232,8 +232,7 @@ namespace SocketHttpListener.Net
|
||||
{
|
||||
// http.sys only supports %uXXXX (4 hex-digits), even though unicode code points could have up to
|
||||
// 6 hex digits. Therefore we parse always 4 characters after %u and convert them to an int.
|
||||
int codePointValue;
|
||||
if (!int.TryParse(codePoint, NumberStyles.HexNumber, null, out codePointValue))
|
||||
if (!int.TryParse(codePoint, NumberStyles.HexNumber, null, out var codePointValue))
|
||||
{
|
||||
//if (NetEventSource.IsEnabled)
|
||||
// NetEventSource.Error(this, SR.Format(SR.net_log_listener_cant_convert_percent_value, codePoint));
|
||||
@@ -264,8 +263,7 @@ namespace SocketHttpListener.Net
|
||||
|
||||
private bool AddPercentEncodedOctetToRawOctetsList(Encoding encoding, string escapedCharacter)
|
||||
{
|
||||
byte encodedValue;
|
||||
if (!byte.TryParse(escapedCharacter, NumberStyles.HexNumber, null, out encodedValue))
|
||||
if (!byte.TryParse(escapedCharacter, NumberStyles.HexNumber, null, out var encodedValue))
|
||||
{
|
||||
//if (NetEventSource.IsEnabled) NetEventSource.Error(this, SR.Format(SR.net_log_listener_cant_convert_percent_value, escapedCharacter));
|
||||
return false;
|
||||
|
||||
@@ -208,8 +208,7 @@ namespace SocketHttpListener.Net
|
||||
if (!IsHeaderName(headerName))
|
||||
throw new ArgumentException("Invalid character in header");
|
||||
|
||||
HeaderInfo info;
|
||||
if (!headers.TryGetValue(headerName, out info))
|
||||
if (!headers.TryGetValue(headerName, out var info))
|
||||
return false;
|
||||
|
||||
var flag = response ? HeaderInfo.Response : HeaderInfo.Request;
|
||||
@@ -313,8 +312,7 @@ namespace SocketHttpListener.Net
|
||||
if (headerName == null)
|
||||
return false;
|
||||
|
||||
HeaderInfo info;
|
||||
return headers.TryGetValue(headerName, out info) && (info & HeaderInfo.MultiValue) != 0;
|
||||
return headers.TryGetValue(headerName, out var info) && (info & HeaderInfo.MultiValue) != 0;
|
||||
}
|
||||
|
||||
internal static bool IsHeaderValue(string value)
|
||||
|
||||
@@ -26,12 +26,11 @@ namespace SocketHttpListener.Net.WebSockets
|
||||
string origin = request.Headers[HttpKnownHeaderNames.Origin];
|
||||
|
||||
string[] secWebSocketProtocols = null;
|
||||
string outgoingSecWebSocketProtocolString;
|
||||
bool shouldSendSecWebSocketProtocolHeader =
|
||||
ProcessWebSocketProtocolHeader(
|
||||
request.Headers[HttpKnownHeaderNames.SecWebSocketProtocol],
|
||||
subProtocol,
|
||||
out outgoingSecWebSocketProtocolString);
|
||||
out var outgoingSecWebSocketProtocolString);
|
||||
|
||||
if (shouldSendSecWebSocketProtocolHeader)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user