diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2019-01-13 12:14:53 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-13 12:14:53 -0500 |
| commit | 9dcaafe700b7130b49bafbadf0d47b37c6ecf53b (patch) | |
| tree | 6ca1b2b3decac1a86b886dafd2645954a13601fd /Emby.Server.Implementations/Net/SocketFactory.cs | |
| parent | 17d8de4962ea9d78f6ddb557fe26465be1944b38 (diff) | |
| parent | b936c439321b55bf89c99dac96fc78cefe752e84 (diff) | |
Merge pull request #458 from EraYaN/code-cleanup
Clean up several minor issues and add TODOs
Diffstat (limited to 'Emby.Server.Implementations/Net/SocketFactory.cs')
| -rw-r--r-- | Emby.Server.Implementations/Net/SocketFactory.cs | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/Emby.Server.Implementations/Net/SocketFactory.cs b/Emby.Server.Implementations/Net/SocketFactory.cs index 515f99f3c..51d08bd6f 100644 --- a/Emby.Server.Implementations/Net/SocketFactory.cs +++ b/Emby.Server.Implementations/Net/SocketFactory.cs @@ -23,7 +23,7 @@ namespace Emby.Server.Implementations.Net { if (logger == null) { - throw new ArgumentNullException("logger"); + throw new ArgumentNullException(nameof(logger)); } _logger = logger; @@ -31,7 +31,7 @@ namespace Emby.Server.Implementations.Net public ISocket CreateTcpSocket(IpAddressInfo remoteAddress, int remotePort) { - if (remotePort < 0) throw new ArgumentException("remotePort cannot be less than zero.", "remotePort"); + if (remotePort < 0) throw new ArgumentException("remotePort cannot be less than zero.", nameof(remotePort)); var addressFamily = remoteAddress.AddressFamily == IpAddressFamily.InterNetwork ? AddressFamily.InterNetwork @@ -67,7 +67,7 @@ namespace Emby.Server.Implementations.Net /// <param name="localPort">An integer specifying the local port to bind the acceptSocket to.</param> public ISocket CreateUdpSocket(int localPort) { - if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", "localPort"); + if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort)); var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp); try @@ -86,7 +86,7 @@ namespace Emby.Server.Implementations.Net public ISocket CreateUdpBroadcastSocket(int localPort) { - if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", "localPort"); + if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort)); var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp); try @@ -111,7 +111,7 @@ namespace Emby.Server.Implementations.Net /// <returns>An implementation of the <see cref="ISocket"/> interface used by RSSDP components to perform acceptSocket operations.</returns> public ISocket CreateSsdpUdpSocket(IpAddressInfo localIpAddress, int localPort) { - if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", "localPort"); + if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort)); var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp); try @@ -142,10 +142,10 @@ namespace Emby.Server.Implementations.Net /// <returns></returns> public ISocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort) { - if (ipAddress == null) throw new ArgumentNullException("ipAddress"); - if (ipAddress.Length == 0) throw new ArgumentException("ipAddress cannot be an empty string.", "ipAddress"); - if (multicastTimeToLive <= 0) throw new ArgumentException("multicastTimeToLive cannot be zero or less.", "multicastTimeToLive"); - if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", "localPort"); + if (ipAddress == null) throw new ArgumentNullException(nameof(ipAddress)); + if (ipAddress.Length == 0) throw new ArgumentException("ipAddress cannot be an empty string.", nameof(ipAddress)); + if (multicastTimeToLive <= 0) throw new ArgumentException("multicastTimeToLive cannot be zero or less.", nameof(multicastTimeToLive)); + if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort)); var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp); @@ -212,26 +212,18 @@ namespace Emby.Server.Implementations.Net { } - public override bool CanRead - { - get { return true; } - } - public override bool CanSeek - { - get { return false; } - } - public override bool CanWrite - { - get { return true; } - } - public override long Length - { - get { throw new NotImplementedException(); } - } + public override bool CanRead => true; + + public override bool CanSeek => false; + + public override bool CanWrite => true; + + public override long Length => throw new NotImplementedException(); + public override long Position { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); } public override void Write(byte[] buffer, int offset, int count) |
