mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-26 12:05:04 +01:00
ReSharper Reformat: Properties to expression bodied form.
This commit is contained in:
@@ -113,21 +113,9 @@ namespace Jellyfin.SocketSharp
|
||||
return form;
|
||||
}
|
||||
|
||||
public string Accept
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.IsNullOrEmpty(request.Headers["Accept"]) ? null : request.Headers["Accept"];
|
||||
}
|
||||
}
|
||||
public string Accept => string.IsNullOrEmpty(request.Headers["Accept"]) ? null : request.Headers["Accept"];
|
||||
|
||||
public string Authorization
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.IsNullOrEmpty(request.Headers["Authorization"]) ? null : request.Headers["Authorization"];
|
||||
}
|
||||
}
|
||||
public string Authorization => string.IsNullOrEmpty(request.Headers["Authorization"]) ? null : request.Headers["Authorization"];
|
||||
|
||||
protected bool validate_cookies, validate_query_string, validate_form;
|
||||
protected bool checked_cookies, checked_query_string, checked_form;
|
||||
@@ -410,30 +398,17 @@ namespace Jellyfin.SocketSharp
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
public override bool CanSeek
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get { return end - offset; }
|
||||
}
|
||||
public override bool CanSeek => true;
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override long Length => end - offset;
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return position - offset;
|
||||
}
|
||||
get => position - offset;
|
||||
set
|
||||
{
|
||||
if (value > Length)
|
||||
@@ -451,37 +426,13 @@ namespace Jellyfin.SocketSharp
|
||||
this.stream = new ReadSubStream(base_stream, offset, length);
|
||||
}
|
||||
|
||||
public string ContentType
|
||||
{
|
||||
get
|
||||
{
|
||||
return content_type;
|
||||
}
|
||||
}
|
||||
public string ContentType => content_type;
|
||||
|
||||
public int ContentLength
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)stream.Length;
|
||||
}
|
||||
}
|
||||
public int ContentLength => (int)stream.Length;
|
||||
|
||||
public string FileName
|
||||
{
|
||||
get
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
public string FileName => name;
|
||||
|
||||
public Stream InputStream
|
||||
{
|
||||
get
|
||||
{
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
public Stream InputStream => stream;
|
||||
}
|
||||
|
||||
class Helpers
|
||||
|
||||
@@ -85,13 +85,7 @@ namespace Jellyfin.SocketSharp
|
||||
/// Gets or sets the state.
|
||||
/// </summary>
|
||||
/// <value>The state.</value>
|
||||
public WebSocketState State
|
||||
{
|
||||
get
|
||||
{
|
||||
return WebSocket.ReadyState;
|
||||
}
|
||||
}
|
||||
public WebSocketState State => WebSocket.ReadyState;
|
||||
|
||||
/// <summary>
|
||||
/// Sends the async.
|
||||
|
||||
@@ -39,88 +39,38 @@ namespace Jellyfin.SocketSharp
|
||||
return string.IsNullOrEmpty(endHostUrl) ? null : endHostUrl.TrimEnd('/');
|
||||
}
|
||||
|
||||
public HttpListenerRequest HttpRequest
|
||||
{
|
||||
get { return request; }
|
||||
}
|
||||
public HttpListenerRequest HttpRequest => request;
|
||||
|
||||
public object OriginalRequest
|
||||
{
|
||||
get { return request; }
|
||||
}
|
||||
public object OriginalRequest => request;
|
||||
|
||||
public IResponse Response
|
||||
{
|
||||
get { return response; }
|
||||
}
|
||||
public IResponse Response => response;
|
||||
|
||||
public IHttpResponse HttpResponse
|
||||
{
|
||||
get { return response; }
|
||||
}
|
||||
public IHttpResponse HttpResponse => response;
|
||||
|
||||
public string OperationName { get; set; }
|
||||
|
||||
public object Dto { get; set; }
|
||||
|
||||
public string RawUrl
|
||||
{
|
||||
get { return request.RawUrl; }
|
||||
}
|
||||
public string RawUrl => request.RawUrl;
|
||||
|
||||
public string AbsoluteUri
|
||||
{
|
||||
get { return request.Url.AbsoluteUri.TrimEnd('/'); }
|
||||
}
|
||||
public string AbsoluteUri => request.Url.AbsoluteUri.TrimEnd('/');
|
||||
|
||||
public string UserHostAddress
|
||||
{
|
||||
get { return request.UserHostAddress; }
|
||||
}
|
||||
public string UserHostAddress => request.UserHostAddress;
|
||||
|
||||
public string XForwardedFor
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.IsNullOrEmpty(request.Headers["X-Forwarded-For"]) ? null : request.Headers["X-Forwarded-For"];
|
||||
}
|
||||
}
|
||||
public string XForwardedFor => string.IsNullOrEmpty(request.Headers["X-Forwarded-For"]) ? null : request.Headers["X-Forwarded-For"];
|
||||
|
||||
public int? XForwardedPort
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.IsNullOrEmpty(request.Headers["X-Forwarded-Port"]) ? (int?)null : int.Parse(request.Headers["X-Forwarded-Port"]);
|
||||
}
|
||||
}
|
||||
public int? XForwardedPort => string.IsNullOrEmpty(request.Headers["X-Forwarded-Port"]) ? (int?)null : int.Parse(request.Headers["X-Forwarded-Port"]);
|
||||
|
||||
public string XForwardedProtocol
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.IsNullOrEmpty(request.Headers["X-Forwarded-Proto"]) ? null : request.Headers["X-Forwarded-Proto"];
|
||||
}
|
||||
}
|
||||
public string XForwardedProtocol => string.IsNullOrEmpty(request.Headers["X-Forwarded-Proto"]) ? null : request.Headers["X-Forwarded-Proto"];
|
||||
|
||||
public string XRealIp
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.IsNullOrEmpty(request.Headers["X-Real-IP"]) ? null : request.Headers["X-Real-IP"];
|
||||
}
|
||||
}
|
||||
public string XRealIp => string.IsNullOrEmpty(request.Headers["X-Real-IP"]) ? null : request.Headers["X-Real-IP"];
|
||||
|
||||
private string remoteIp;
|
||||
public string RemoteIp
|
||||
{
|
||||
get
|
||||
{
|
||||
return remoteIp ??
|
||||
(remoteIp = (CheckBadChars(XForwardedFor)) ??
|
||||
(NormalizeIp(CheckBadChars(XRealIp)) ??
|
||||
(request.RemoteEndPoint != null ? NormalizeIp(request.RemoteEndPoint.Address.ToString()) : null)));
|
||||
}
|
||||
}
|
||||
public string RemoteIp =>
|
||||
remoteIp ??
|
||||
(remoteIp = (CheckBadChars(XForwardedFor)) ??
|
||||
(NormalizeIp(CheckBadChars(XRealIp)) ??
|
||||
(request.RemoteEndPoint != null ? NormalizeIp(request.RemoteEndPoint.Address.ToString()) : null)));
|
||||
|
||||
private static readonly char[] HttpTrimCharacters = new char[] { (char)0x09, (char)0xA, (char)0xB, (char)0xC, (char)0xD, (char)0x20 };
|
||||
|
||||
@@ -215,34 +165,20 @@ namespace Jellyfin.SocketSharp
|
||||
return ip;
|
||||
}
|
||||
|
||||
public bool IsSecureConnection
|
||||
{
|
||||
get { return request.IsSecureConnection || XForwardedProtocol == "https"; }
|
||||
}
|
||||
public bool IsSecureConnection => request.IsSecureConnection || XForwardedProtocol == "https";
|
||||
|
||||
public string[] AcceptTypes
|
||||
{
|
||||
get { return request.AcceptTypes; }
|
||||
}
|
||||
public string[] AcceptTypes => request.AcceptTypes;
|
||||
|
||||
private Dictionary<string, object> items;
|
||||
public Dictionary<string, object> Items
|
||||
{
|
||||
get { return items ?? (items = new Dictionary<string, object>()); }
|
||||
}
|
||||
public Dictionary<string, object> Items => items ?? (items = new Dictionary<string, object>());
|
||||
|
||||
private string responseContentType;
|
||||
public string ResponseContentType
|
||||
{
|
||||
get
|
||||
{
|
||||
return responseContentType
|
||||
?? (responseContentType = GetResponseContentType(this));
|
||||
}
|
||||
set
|
||||
{
|
||||
this.responseContentType = value;
|
||||
}
|
||||
get =>
|
||||
responseContentType
|
||||
?? (responseContentType = GetResponseContentType(this));
|
||||
set => this.responseContentType = value;
|
||||
}
|
||||
|
||||
public const string FormUrlEncoded = "application/x-www-form-urlencoded";
|
||||
@@ -434,58 +370,32 @@ namespace Jellyfin.SocketSharp
|
||||
}
|
||||
}
|
||||
|
||||
public string UserAgent
|
||||
{
|
||||
get { return request.UserAgent; }
|
||||
}
|
||||
public string UserAgent => request.UserAgent;
|
||||
|
||||
public QueryParamCollection Headers
|
||||
{
|
||||
get { return request.Headers; }
|
||||
}
|
||||
public QueryParamCollection Headers => request.Headers;
|
||||
|
||||
private QueryParamCollection queryString;
|
||||
public QueryParamCollection QueryString
|
||||
{
|
||||
get { return queryString ?? (queryString = MyHttpUtility.ParseQueryString(request.Url.Query)); }
|
||||
}
|
||||
public QueryParamCollection QueryString => queryString ?? (queryString = MyHttpUtility.ParseQueryString(request.Url.Query));
|
||||
|
||||
public bool IsLocal
|
||||
{
|
||||
get { return request.IsLocal; }
|
||||
}
|
||||
public bool IsLocal => request.IsLocal;
|
||||
|
||||
private string httpMethod;
|
||||
public string HttpMethod
|
||||
{
|
||||
get
|
||||
{
|
||||
return httpMethod
|
||||
?? (httpMethod = request.HttpMethod);
|
||||
}
|
||||
}
|
||||
public string HttpMethod =>
|
||||
httpMethod
|
||||
?? (httpMethod = request.HttpMethod);
|
||||
|
||||
public string Verb
|
||||
{
|
||||
get { return HttpMethod; }
|
||||
}
|
||||
public string Verb => HttpMethod;
|
||||
|
||||
public string ContentType
|
||||
{
|
||||
get { return request.ContentType; }
|
||||
}
|
||||
public string ContentType => request.ContentType;
|
||||
|
||||
public Encoding contentEncoding;
|
||||
public Encoding ContentEncoding
|
||||
{
|
||||
get { return contentEncoding ?? request.ContentEncoding; }
|
||||
set { contentEncoding = value; }
|
||||
get => contentEncoding ?? request.ContentEncoding;
|
||||
set => contentEncoding = value;
|
||||
}
|
||||
|
||||
public Uri UrlReferrer
|
||||
{
|
||||
get { return request.UrlReferrer; }
|
||||
}
|
||||
public Uri UrlReferrer => request.UrlReferrer;
|
||||
|
||||
public static Encoding GetEncoding(string contentTypeHeader)
|
||||
{
|
||||
@@ -501,15 +411,9 @@ namespace Jellyfin.SocketSharp
|
||||
}
|
||||
}
|
||||
|
||||
public Stream InputStream
|
||||
{
|
||||
get { return request.InputStream; }
|
||||
}
|
||||
public Stream InputStream => request.InputStream;
|
||||
|
||||
public long ContentLength
|
||||
{
|
||||
get { return request.ContentLength64; }
|
||||
}
|
||||
public long ContentLength => request.ContentLength64;
|
||||
|
||||
private IHttpFile[] httpFiles;
|
||||
public IHttpFile[] Files
|
||||
|
||||
@@ -31,27 +31,24 @@ namespace Jellyfin.SocketSharp
|
||||
|
||||
public IRequest Request { get; private set; }
|
||||
public Dictionary<string, object> Items { get; private set; }
|
||||
public object OriginalResponse
|
||||
{
|
||||
get { return _response; }
|
||||
}
|
||||
public object OriginalResponse => _response;
|
||||
|
||||
public int StatusCode
|
||||
{
|
||||
get { return this._response.StatusCode; }
|
||||
set { this._response.StatusCode = value; }
|
||||
get => this._response.StatusCode;
|
||||
set => this._response.StatusCode = value;
|
||||
}
|
||||
|
||||
public string StatusDescription
|
||||
{
|
||||
get { return this._response.StatusDescription; }
|
||||
set { this._response.StatusDescription = value; }
|
||||
get => this._response.StatusDescription;
|
||||
set => this._response.StatusDescription = value;
|
||||
}
|
||||
|
||||
public string ContentType
|
||||
{
|
||||
get { return _response.ContentType; }
|
||||
set { _response.ContentType = value; }
|
||||
get => _response.ContentType;
|
||||
set => _response.ContentType = value;
|
||||
}
|
||||
|
||||
//public ICookies Cookies { get; set; }
|
||||
@@ -67,13 +64,7 @@ namespace Jellyfin.SocketSharp
|
||||
_response.AddHeader(name, value);
|
||||
}
|
||||
|
||||
public QueryParamCollection Headers
|
||||
{
|
||||
get
|
||||
{
|
||||
return _response.Headers;
|
||||
}
|
||||
}
|
||||
public QueryParamCollection Headers => _response.Headers;
|
||||
|
||||
public string GetHeader(string name)
|
||||
{
|
||||
@@ -85,10 +76,7 @@ namespace Jellyfin.SocketSharp
|
||||
_response.Redirect(url);
|
||||
}
|
||||
|
||||
public Stream OutputStream
|
||||
{
|
||||
get { return _response.OutputStream; }
|
||||
}
|
||||
public Stream OutputStream => _response.OutputStream;
|
||||
|
||||
public void Close()
|
||||
{
|
||||
@@ -179,8 +167,8 @@ namespace Jellyfin.SocketSharp
|
||||
|
||||
public bool SendChunked
|
||||
{
|
||||
get { return _response.SendChunked; }
|
||||
set { _response.SendChunked = value; }
|
||||
get => _response.SendChunked;
|
||||
set => _response.SendChunked = value;
|
||||
}
|
||||
|
||||
public bool KeepAlive { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user