diff options
| author | LogicalPhallacy <44458166+LogicalPhallacy@users.noreply.github.com> | 2019-01-23 00:31:35 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-23 00:31:35 -0800 |
| commit | 404bd04cbc17dc8c8bf4a5c9aa3ca9c5cd85aa68 (patch) | |
| tree | 3d267c6ceef9439a034c113095e10e4d619e7c70 /MediaBrowser.Model/Net | |
| parent | 8ff89fdc0c30f595a171ffc550f907ef22b6212a (diff) | |
| parent | e05e002b8bb4d13eb2b80b56a0aad8903ddb701e (diff) | |
Merge pull request #8 from jellyfin/master
rebase to latest master
Diffstat (limited to 'MediaBrowser.Model/Net')
| -rw-r--r-- | MediaBrowser.Model/Net/EndPointInfo.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/HttpException.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/HttpResponse.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/IAcceptSocket.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/ISocket.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/ISocketFactory.cs | 16 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/IpAddressInfo.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/IpEndPointInfo.cs | 1 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/MimeTypes.cs | 28 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/NetworkShare.cs | 1 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/NetworkShareType.cs | 1 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/SocketReceiveResult.cs | 19 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/WebSocketMessage.cs | 1 |
13 files changed, 40 insertions, 47 deletions
diff --git a/MediaBrowser.Model/Net/EndPointInfo.cs b/MediaBrowser.Model/Net/EndPointInfo.cs index 5a158e785..b73799ea8 100644 --- a/MediaBrowser.Model/Net/EndPointInfo.cs +++ b/MediaBrowser.Model/Net/EndPointInfo.cs @@ -1,4 +1,4 @@ -namespace MediaBrowser.Model.Net +namespace MediaBrowser.Model.Net { public class EndPointInfo { diff --git a/MediaBrowser.Model/Net/HttpException.cs b/MediaBrowser.Model/Net/HttpException.cs index 698b1bc7e..16253ed6c 100644 --- a/MediaBrowser.Model/Net/HttpException.cs +++ b/MediaBrowser.Model/Net/HttpException.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Net; namespace MediaBrowser.Model.Net @@ -28,7 +28,7 @@ namespace MediaBrowser.Model.Net public HttpException(string message, Exception innerException) : base(message, innerException) { - + } /// <summary> diff --git a/MediaBrowser.Model/Net/HttpResponse.cs b/MediaBrowser.Model/Net/HttpResponse.cs index f4bd8e681..286b1c0af 100644 --- a/MediaBrowser.Model/Net/HttpResponse.cs +++ b/MediaBrowser.Model/Net/HttpResponse.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Net; diff --git a/MediaBrowser.Model/Net/IAcceptSocket.cs b/MediaBrowser.Model/Net/IAcceptSocket.cs index af5a1fcfb..2b21d3e66 100644 --- a/MediaBrowser.Model/Net/IAcceptSocket.cs +++ b/MediaBrowser.Model/Net/IAcceptSocket.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Model.Net { diff --git a/MediaBrowser.Model/Net/ISocket.cs b/MediaBrowser.Model/Net/ISocket.cs index 6a6781026..992ccb49b 100644 --- a/MediaBrowser.Model/Net/ISocket.cs +++ b/MediaBrowser.Model/Net/ISocket.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System; using System.Threading; using System.Threading.Tasks; @@ -25,4 +23,4 @@ namespace MediaBrowser.Model.Net /// </summary> Task SendToAsync(byte[] buffer, int offset, int bytes, IpEndPointInfo endPoint, CancellationToken cancellationToken); } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/Net/ISocketFactory.cs b/MediaBrowser.Model/Net/ISocketFactory.cs index 6a4b99600..69fe134bc 100644 --- a/MediaBrowser.Model/Net/ISocketFactory.cs +++ b/MediaBrowser.Model/Net/ISocketFactory.cs @@ -1,4 +1,3 @@ - using System.IO; namespace MediaBrowser.Model.Net @@ -7,14 +6,13 @@ namespace MediaBrowser.Model.Net /// Implemented by components that can create a platform specific UDP socket implementation, and wrap it in the cross platform <see cref="ISocket"/> interface. /// </summary> public interface ISocketFactory - { - - /// <summary> - /// Createa a new unicast socket using the specified local port number. - /// </summary> - /// <param name="localPort">The local port to bind to.</param> - /// <returns>A <see cref="ISocket"/> implementation.</returns> - ISocket CreateUdpSocket(int localPort); + { + /// <summary> + /// Createa a new unicast socket using the specified local port number. + /// </summary> + /// <param name="localPort">The local port to bind to.</param> + /// <returns>A <see cref="ISocket"/> implementation.</returns> + ISocket CreateUdpSocket(int localPort); ISocket CreateUdpBroadcastSocket(int localPort); diff --git a/MediaBrowser.Model/Net/IpAddressInfo.cs b/MediaBrowser.Model/Net/IpAddressInfo.cs index 520f8fb54..7a278d4d4 100644 --- a/MediaBrowser.Model/Net/IpAddressInfo.cs +++ b/MediaBrowser.Model/Net/IpAddressInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace MediaBrowser.Model.Net { @@ -23,7 +23,7 @@ namespace MediaBrowser.Model.Net return string.Equals(address.Address, Address, StringComparison.OrdinalIgnoreCase); } - public override String ToString() + public override string ToString() { return Address; } diff --git a/MediaBrowser.Model/Net/IpEndPointInfo.cs b/MediaBrowser.Model/Net/IpEndPointInfo.cs index b5cadc429..f8c125144 100644 --- a/MediaBrowser.Model/Net/IpEndPointInfo.cs +++ b/MediaBrowser.Model/Net/IpEndPointInfo.cs @@ -1,4 +1,3 @@ -using System; using System.Globalization; namespace MediaBrowser.Model.Net diff --git a/MediaBrowser.Model/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.cs index d66d62fea..fe13413e2 100644 --- a/MediaBrowser.Model/Net/MimeTypes.cs +++ b/MediaBrowser.Model/Net/MimeTypes.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Model.Extensions; using System; using System.Collections.Generic; using System.IO; using System.Linq; +using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.Net { @@ -48,7 +48,7 @@ namespace MediaBrowser.Model.Net private static Dictionary<string, string> GetVideoFileExtensionsDictionary() { - Dictionary<string, string> dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); + var dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); foreach (string ext in VideoFileExtensions) { @@ -65,7 +65,7 @@ namespace MediaBrowser.Model.Net private static Dictionary<string, string> GetMimeTypeLookup() { - Dictionary<string, string> dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); + var dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); dict.Add(".jpg", "image/jpeg"); dict.Add(".jpeg", "image/jpeg"); @@ -127,13 +127,12 @@ namespace MediaBrowser.Model.Net { if (string.IsNullOrEmpty(path)) { - throw new ArgumentNullException("path"); + throw new ArgumentNullException(nameof(path)); } var ext = Path.GetExtension(path) ?? string.Empty; - string result; - if (MimeTypeLookup.TryGetValue(ext, out result)) + if (MimeTypeLookup.TryGetValue(ext, out string result)) { return result; } @@ -183,6 +182,10 @@ namespace MediaBrowser.Model.Net { return "text/plain"; } + if (StringHelper.EqualsIgnoreCase(ext, ".log")) + { + return "text/plain"; + } if (StringHelper.EqualsIgnoreCase(ext, ".xml")) { return "application/xml"; @@ -228,10 +231,10 @@ namespace MediaBrowser.Model.Net if (StringHelper.EqualsIgnoreCase(ext, ".oga")) { return "audio/ogg"; - } - if (StringHelper.EqualsIgnoreCase(ext, ".opus")) - { - return "audio/ogg"; + } + if (StringHelper.EqualsIgnoreCase(ext, ".opus")) + { + return "audio/ogg"; } if (StringHelper.EqualsIgnoreCase(ext, ".ac3")) { @@ -329,14 +332,13 @@ namespace MediaBrowser.Model.Net { if (string.IsNullOrEmpty(mimeType)) { - throw new ArgumentNullException("mimeType"); + throw new ArgumentNullException(nameof(mimeType)); } // handle text/html; charset=UTF-8 mimeType = mimeType.Split(';')[0]; - string result; - if (ExtensionLookup.TryGetValue(mimeType, out result)) + if (ExtensionLookup.TryGetValue(mimeType, out string result)) { return result; } diff --git a/MediaBrowser.Model/Net/NetworkShare.cs b/MediaBrowser.Model/Net/NetworkShare.cs index 5ce84eeed..1f61414fc 100644 --- a/MediaBrowser.Model/Net/NetworkShare.cs +++ b/MediaBrowser.Model/Net/NetworkShare.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Model.Net { public class NetworkShare diff --git a/MediaBrowser.Model/Net/NetworkShareType.cs b/MediaBrowser.Model/Net/NetworkShareType.cs index 41dc9003e..bf2d092a6 100644 --- a/MediaBrowser.Model/Net/NetworkShareType.cs +++ b/MediaBrowser.Model/Net/NetworkShareType.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Model.Net { /// <summary> diff --git a/MediaBrowser.Model/Net/SocketReceiveResult.cs b/MediaBrowser.Model/Net/SocketReceiveResult.cs index 483e2297b..8c394f7c7 100644 --- a/MediaBrowser.Model/Net/SocketReceiveResult.cs +++ b/MediaBrowser.Model/Net/SocketReceiveResult.cs @@ -1,20 +1,19 @@ - namespace MediaBrowser.Model.Net { /// <summary> /// Used by the sockets wrapper to hold raw data received from a UDP socket. /// </summary> public sealed class SocketReceiveResult - { - /// <summary> - /// The buffer to place received data into. - /// </summary> - public byte[] Buffer { get; set; } + { + /// <summary> + /// The buffer to place received data into. + /// </summary> + public byte[] Buffer { get; set; } - /// <summary> - /// The number of bytes received. - /// </summary> - public int ReceivedBytes { get; set; } + /// <summary> + /// The number of bytes received. + /// </summary> + public int ReceivedBytes { get; set; } /// <summary> /// The <see cref="IpEndPointInfo"/> the data was received from. diff --git a/MediaBrowser.Model/Net/WebSocketMessage.cs b/MediaBrowser.Model/Net/WebSocketMessage.cs index c049a96ef..c763216f1 100644 --- a/MediaBrowser.Model/Net/WebSocketMessage.cs +++ b/MediaBrowser.Model/Net/WebSocketMessage.cs @@ -1,4 +1,3 @@ - namespace MediaBrowser.Model.Net { /// <summary> |
