diff options
Diffstat (limited to 'RSSDP/SsdpDevicePublisher.cs')
| -rw-r--r-- | RSSDP/SsdpDevicePublisher.cs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.cs index cee9b7f91..a44dd0c0c 100644 --- a/RSSDP/SsdpDevicePublisher.cs +++ b/RSSDP/SsdpDevicePublisher.cs @@ -41,11 +41,11 @@ namespace Rssdp.Infrastructure /// </summary> public SsdpDevicePublisher(ISsdpCommunicationsServer communicationsServer, ITimerFactory timerFactory, string osName, string osVersion) { - if (communicationsServer == null) throw new ArgumentNullException("communicationsServer"); - if (osName == null) throw new ArgumentNullException("osName"); - if (osName.Length == 0) throw new ArgumentException("osName cannot be an empty string.", "osName"); - if (osVersion == null) throw new ArgumentNullException("osVersion"); - if (osVersion.Length == 0) throw new ArgumentException("osVersion cannot be an empty string.", "osName"); + if (communicationsServer == null) throw new ArgumentNullException(nameof(communicationsServer)); + if (osName == null) throw new ArgumentNullException(nameof(osName)); + if (osName.Length == 0) throw new ArgumentException("osName cannot be an empty string.", nameof(osName)); + if (osVersion == null) throw new ArgumentNullException(nameof(osVersion)); + if (osVersion.Length == 0) throw new ArgumentException("osVersion cannot be an empty string.", nameof(osName)); _SupportPnpRootDevice = true; _timerFactory = timerFactory; @@ -81,7 +81,7 @@ namespace Rssdp.Infrastructure [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "t", Justification = "Capture task to local variable supresses compiler warning, but task is not really needed.")] public void AddDevice(SsdpRootDevice device) { - if (device == null) throw new ArgumentNullException("device"); + if (device == null) throw new ArgumentNullException(nameof(device)); ThrowIfDisposed(); @@ -116,7 +116,7 @@ namespace Rssdp.Infrastructure /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception> public async Task RemoveDevice(SsdpRootDevice device) { - if (device == null) throw new ArgumentNullException("device"); + if (device == null) throw new ArgumentNullException(nameof(device)); bool wasRemoved = false; TimeSpan minCacheTime = TimeSpan.Zero; @@ -418,7 +418,7 @@ namespace Rssdp.Infrastructure var values = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); - // If needed later for non-server devices, these headers will need to be dynamic + // If needed later for non-server devices, these headers will need to be dynamic values["HOST"] = "239.255.255.250:1900"; values["DATE"] = DateTime.UtcNow.ToString("r"); values["CACHE-CONTROL"] = "max-age = " + rootDevice.CacheLifetime.TotalSeconds; @@ -463,7 +463,7 @@ namespace Rssdp.Infrastructure var values = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); - // If needed later for non-server devices, these headers will need to be dynamic + // If needed later for non-server devices, these headers will need to be dynamic values["HOST"] = "239.255.255.250:1900"; values["DATE"] = DateTime.UtcNow.ToString("r"); values["SERVER"] = string.Format("{0}/{1} UPnP/1.0 RSSDP/{2}", _OSName, _OSVersion, ServerVersion); @@ -538,9 +538,9 @@ namespace Rssdp.Infrastructure //According to SSDP/UPnP spec, ignore message if missing these headers. // Edit: But some devices do it anyway //if (!e.Message.Headers.Contains("MX")) - // WriteTrace("Ignoring search request - missing MX header."); + // WriteTrace("Ignoring search request - missing MX header."); //else if (!e.Message.Headers.Contains("MAN")) - // WriteTrace("Ignoring search request - missing MAN header."); + // WriteTrace("Ignoring search request - missing MAN header."); //else ProcessSearchRequest(GetFirstHeaderValue(e.Message.Headers, "MX"), GetFirstHeaderValue(e.Message.Headers, "ST"), e.ReceivedFrom, e.LocalIpAddress, CancellationToken.None); } |
