ReSharper conform to 'var' settings

This commit is contained in:
Erwin de Haan
2019-01-13 21:37:13 +01:00
parent a36658f6f0
commit 65bd052f3e
199 changed files with 1063 additions and 1063 deletions

View File

@@ -7,7 +7,7 @@ using MediaBrowser.Model.Net;
namespace Rssdp
{
/// <summary>
/// Event arguments for the <see cref="Rssdp.Infrastructure.SsdpDeviceLocatorBase.DeviceAvailable"/> event.
/// Event arguments for the <see cref="Infrastructure.SsdpDeviceLocatorBase.DeviceAvailable"/> event.
/// </summary>
public sealed class DeviceAvailableEventArgs : EventArgs
{
@@ -18,17 +18,17 @@ namespace Rssdp
private readonly DiscoveredSsdpDevice _DiscoveredDevice;
private readonly bool _IsNewlyDiscovered;
#endregion
#endregion
#region Constructors
#region Constructors
/// <summary>
/// Full constructor.
/// </summary>
/// <param name="discoveredDevice">A <see cref="DiscoveredSsdpDevice"/> instance representing the available device.</param>
/// <param name="isNewlyDiscovered">A boolean value indicating whether or not this device came from the cache. See <see cref="IsNewlyDiscovered"/> for more detail.</param>
/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="discoveredDevice"/> parameter is null.</exception>
public DeviceAvailableEventArgs(DiscoveredSsdpDevice discoveredDevice, bool isNewlyDiscovered)
/// <summary>
/// Full constructor.
/// </summary>
/// <param name="discoveredDevice">A <see cref="DiscoveredSsdpDevice"/> instance representing the available device.</param>
/// <param name="isNewlyDiscovered">A boolean value indicating whether or not this device came from the cache. See <see cref="IsNewlyDiscovered"/> for more detail.</param>
/// <exception cref="ArgumentNullException">Thrown if the <paramref name="discoveredDevice"/> parameter is null.</exception>
public DeviceAvailableEventArgs(DiscoveredSsdpDevice discoveredDevice, bool isNewlyDiscovered)
{
if (discoveredDevice == null) throw new ArgumentNullException(nameof(discoveredDevice));
@@ -48,10 +48,10 @@ namespace Rssdp
get { return _IsNewlyDiscovered; }
}
/// <summary>
/// A reference to a <see cref="Rssdp.DiscoveredSsdpDevice"/> instance containing the discovered details and allowing access to the full device description.
/// </summary>
public DiscoveredSsdpDevice DiscoveredDevice
/// <summary>
/// A reference to a <see cref="DiscoveredSsdpDevice"/> instance containing the discovered details and allowing access to the full device description.
/// </summary>
public DiscoveredSsdpDevice DiscoveredDevice
{
get { return _DiscoveredDevice; }
}

View File

@@ -22,7 +22,7 @@ namespace Rssdp
/// Constructs a new instance for the specified <see cref="SsdpDevice"/>.
/// </summary>
/// <param name="device">The <see cref="SsdpDevice"/> associated with the event this argument class is being used for.</param>
/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
/// <exception cref="ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
public DeviceEventArgs(SsdpDevice device)
{
if (device == null) throw new ArgumentNullException(nameof(device));

View File

@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Rssdp
{
/// <summary>
/// Event arguments for the <see cref="Rssdp.Infrastructure.SsdpDeviceLocatorBase.DeviceUnavailable"/> event.
/// Event arguments for the <see cref="Infrastructure.SsdpDeviceLocatorBase.DeviceUnavailable"/> event.
/// </summary>
public sealed class DeviceUnavailableEventArgs : EventArgs
{
@@ -25,7 +25,7 @@ namespace Rssdp
/// </summary>
/// <param name="discoveredDevice">A <see cref="DiscoveredSsdpDevice"/> instance representing the device that has become unavailable.</param>
/// <param name="expired">A boolean value indicating whether this device is unavailable because it expired, or because it explicitly sent a byebye notification.. See <see cref="Expired"/> for more detail.</param>
/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="discoveredDevice"/> parameter is null.</exception>
/// <exception cref="ArgumentNullException">Thrown if the <paramref name="discoveredDevice"/> parameter is null.</exception>
public DeviceUnavailableEventArgs(DiscoveredSsdpDevice discoveredDevice, bool expired)
{
if (discoveredDevice == null) throw new ArgumentNullException(nameof(discoveredDevice));
@@ -47,7 +47,7 @@ namespace Rssdp
}
/// <summary>
/// A reference to a <see cref="Rssdp.DiscoveredSsdpDevice"/> instance containing the discovery details of the removed device.
/// A reference to a <see cref="DiscoveredSsdpDevice"/> instance containing the discovery details of the removed device.
/// </summary>
public DiscoveredSsdpDevice DiscoveredDevice
{

View File

@@ -11,7 +11,7 @@ namespace Rssdp
/// Represents a discovered device, containing basic information about the device and the location of it's full device description document. Also provides convenience methods for retrieving the device description document.
/// </summary>
/// <seealso cref="SsdpDevice"/>
/// <seealso cref="Rssdp.Infrastructure.ISsdpDeviceLocator"/>
/// <seealso cref="Infrastructure.ISsdpDeviceLocator"/>
public sealed class DiscoveredSsdpDevice
{

View File

@@ -20,10 +20,10 @@ namespace Rssdp.Infrastructure
protected abstract void Dispose(bool disposing);
/// <summary>
/// Throws and <see cref="System.ObjectDisposedException"/> if the <see cref="IsDisposed"/> property is true.
/// Throws and <see cref="ObjectDisposedException"/> if the <see cref="IsDisposed"/> property is true.
/// </summary>
/// <seealso cref="IsDisposed"/>
/// <exception cref="System.ObjectDisposedException">Thrown if the <see cref="IsDisposed"/> property is true.</exception>
/// <exception cref="ObjectDisposedException">Thrown if the <see cref="IsDisposed"/> property is true.</exception>
/// <seealso cref="Dispose()"/>
protected virtual void ThrowIfDisposed()
{

View File

@@ -26,19 +26,19 @@ namespace Rssdp.Infrastructure
private static byte[] EmptyByteArray = new byte[]{};
/// <summary>
/// Parses the <paramref name="data"/> provided into either a <see cref="System.Net.Http.HttpRequestMessage"/> or <see cref="System.Net.Http.HttpResponseMessage"/> object.
/// Parses the <paramref name="data"/> provided into either a <see cref="HttpRequestMessage"/> or <see cref="HttpResponseMessage"/> object.
/// </summary>
/// <param name="data">A string containing the HTTP message to parse.</param>
/// <returns>Either a <see cref="System.Net.Http.HttpRequestMessage"/> or <see cref="System.Net.Http.HttpResponseMessage"/> object containing the parsed data.</returns>
/// <returns>Either a <see cref="HttpRequestMessage"/> or <see cref="HttpResponseMessage"/> object containing the parsed data.</returns>
public abstract T Parse(string data);
/// <summary>
/// Parses a string containing either an HTTP request or response into a <see cref="System.Net.Http.HttpRequestMessage"/> or <see cref="System.Net.Http.HttpResponseMessage"/> object.
/// Parses a string containing either an HTTP request or response into a <see cref="HttpRequestMessage"/> or <see cref="HttpResponseMessage"/> object.
/// </summary>
/// <param name="message">A <see cref="System.Net.Http.HttpRequestMessage"/> or <see cref="System.Net.Http.HttpResponseMessage"/> object representing the parsed message.</param>
/// <param name="message">A <see cref="HttpRequestMessage"/> or <see cref="HttpResponseMessage"/> object representing the parsed message.</param>
/// <param name="headers">A reference to the <see cref="System.Net.Http.Headers.HttpHeaders"/> collection for the <paramref name="message"/> object.</param>
/// <param name="data">A string containing the data to be parsed.</param>
/// <returns>An <see cref="System.Net.Http.HttpContent"/> object containing the content of the parsed message.</returns>
/// <returns>An <see cref="HttpContent"/> object containing the content of the parsed message.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times", Justification = "Honestly, it's fine. MemoryStream doesn't mind.")]
protected virtual void Parse(T message, System.Net.Http.Headers.HttpHeaders headers, string data)
{
@@ -61,7 +61,7 @@ namespace Rssdp.Infrastructure
/// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the <paramref name="message"/>.
/// </summary>
/// <param name="data">The first line of the HTTP message to be parsed.</param>
/// <param name="message">Either a <see cref="System.Net.Http.HttpResponseMessage"/> or <see cref="System.Net.Http.HttpRequestMessage"/> to assign the parsed values to.</param>
/// <param name="message">Either a <see cref="HttpResponseMessage"/> or <see cref="HttpRequestMessage"/> to assign the parsed values to.</param>
protected abstract void ParseStatusLine(string data, T message);
/// <summary>

View File

@@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace Rssdp.Infrastructure
{
/// <summary>
/// Parses a string into a <see cref="System.Net.Http.HttpRequestMessage"/> or throws an exception.
/// Parses a string into a <see cref="HttpRequestMessage"/> or throws an exception.
/// </summary>
public sealed class HttpRequestParser : HttpParserBase<HttpRequestMessage>
{
@@ -26,17 +26,17 @@ namespace Rssdp.Infrastructure
#region Public Methods
/// <summary>
/// Parses the specified data into a <see cref="System.Net.Http.HttpRequestMessage"/> instance.
/// Parses the specified data into a <see cref="HttpRequestMessage"/> instance.
/// </summary>
/// <param name="data">A string containing the data to parse.</param>
/// <returns>A <see cref="System.Net.Http.HttpRequestMessage"/> instance containing the parsed data.</returns>
public override System.Net.Http.HttpRequestMessage Parse(string data)
/// <returns>A <see cref="HttpRequestMessage"/> instance containing the parsed data.</returns>
public override HttpRequestMessage Parse(string data)
{
System.Net.Http.HttpRequestMessage retVal = null;
HttpRequestMessage retVal = null;
try
{
retVal = new System.Net.Http.HttpRequestMessage();
retVal = new HttpRequestMessage();
Parse(retVal, retVal.Headers, data);
@@ -57,7 +57,7 @@ namespace Rssdp.Infrastructure
/// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the <paramref name="message"/>.
/// </summary>
/// <param name="data">The first line of the HTTP message to be parsed.</param>
/// <param name="message">Either a <see cref="System.Net.Http.HttpResponseMessage"/> or <see cref="System.Net.Http.HttpRequestMessage"/> to assign the parsed values to.</param>
/// <param name="message">Either a <see cref="HttpResponseMessage"/> or <see cref="HttpRequestMessage"/> to assign the parsed values to.</param>
protected override void ParseStatusLine(string data, HttpRequestMessage message)
{
if (data == null) throw new ArgumentNullException(nameof(data));

View File

@@ -9,9 +9,9 @@ using System.Threading.Tasks;
namespace Rssdp.Infrastructure
{
/// <summary>
/// Parses a string into a <see cref="System.Net.Http.HttpResponseMessage"/> or throws an exception.
/// Parses a string into a <see cref="HttpResponseMessage"/> or throws an exception.
/// </summary>
public sealed class HttpResponseParser : HttpParserBase<System.Net.Http.HttpResponseMessage>
public sealed class HttpResponseParser : HttpParserBase<HttpResponseMessage>
{
#region Fields & Constants
@@ -26,16 +26,16 @@ namespace Rssdp.Infrastructure
#region Public Methods
/// <summary>
/// Parses the specified data into a <see cref="System.Net.Http.HttpResponseMessage"/> instance.
/// Parses the specified data into a <see cref="HttpResponseMessage"/> instance.
/// </summary>
/// <param name="data">A string containing the data to parse.</param>
/// <returns>A <see cref="System.Net.Http.HttpResponseMessage"/> instance containing the parsed data.</returns>
/// <returns>A <see cref="HttpResponseMessage"/> instance containing the parsed data.</returns>
public override HttpResponseMessage Parse(string data)
{
System.Net.Http.HttpResponseMessage retVal = null;
HttpResponseMessage retVal = null;
try
{
retVal = new System.Net.Http.HttpResponseMessage();
retVal = new HttpResponseMessage();
Parse(retVal, retVal.Headers, data);
@@ -68,7 +68,7 @@ namespace Rssdp.Infrastructure
/// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the <paramref name="message"/>.
/// </summary>
/// <param name="data">The first line of the HTTP message to be parsed.</param>
/// <param name="message">Either a <see cref="System.Net.Http.HttpResponseMessage"/> or <see cref="System.Net.Http.HttpRequestMessage"/> to assign the parsed values to.</param>
/// <param name="message">Either a <see cref="HttpResponseMessage"/> or <see cref="HttpRequestMessage"/> to assign the parsed values to.</param>
protected override void ParseStatusLine(string data, HttpResponseMessage message)
{
if (data == null) throw new ArgumentNullException(nameof(data));

View File

@@ -128,7 +128,7 @@ namespace Rssdp.Infrastructure
/// <remarks>
/// <para>Does nothing if this instance is not already listening for notifications.</para>
/// </remarks>
/// <exception cref="System.ObjectDisposedException">Throw if the <see cref="DisposableManagedObjectBase.IsDisposed"/> property is true.</exception>
/// <exception cref="ObjectDisposedException">Throw if the <see cref="DisposableManagedObjectBase.IsDisposed"/> property is true.</exception>
/// <seealso cref="StartListeningForNotifications"/>
/// <seealso cref="DeviceAvailable"/>
/// <seealso cref="DeviceUnavailable"/>

View File

@@ -17,14 +17,14 @@ namespace Rssdp.Infrastructure
/// Adds a device (and it's children) to the list of devices being published by this server, making them discoverable to SSDP clients.
/// </summary>
/// <param name="device">The <see cref="SsdpRootDevice"/> instance to add.</param>
/// <returns>An awaitable <see cref="System.Threading.Tasks.Task"/>.</returns>
/// <returns>An awaitable <see cref="Task"/>.</returns>
void AddDevice(SsdpRootDevice device);
/// <summary>
/// Removes a device (and it's children) from the list of devices being published by this server, making them undiscoverable.
/// </summary>
/// <param name="device">The <see cref="SsdpRootDevice"/> instance to add.</param>
/// <returns>An awaitable <see cref="System.Threading.Tasks.Task"/>.</returns>
/// <returns>An awaitable <see cref="Task"/>.</returns>
Task RemoveDevice(SsdpRootDevice device);
/// <summary>

View File

@@ -73,7 +73,7 @@ namespace Rssdp.Infrastructure
/// <summary>
/// Minimum constructor.
/// </summary>
/// <exception cref="System.ArgumentNullException">The <paramref name="socketFactory"/> argument is null.</exception>
/// <exception cref="ArgumentNullException">The <paramref name="socketFactory"/> argument is null.</exception>
public SsdpCommunicationsServer(ISocketFactory socketFactory, INetworkManager networkManager, ILogger logger, bool enableMultiSocketBinding)
: this(socketFactory, 0, SsdpConstants.SsdpDefaultMulticastTimeToLive, networkManager, logger, enableMultiSocketBinding)
{
@@ -82,8 +82,8 @@ namespace Rssdp.Infrastructure
/// <summary>
/// Full constructor.
/// </summary>
/// <exception cref="System.ArgumentNullException">The <paramref name="socketFactory"/> argument is null.</exception>
/// <exception cref="System.ArgumentOutOfRangeException">The <paramref name="multicastTimeToLive"/> argument is less than or equal to zero.</exception>
/// <exception cref="ArgumentNullException">The <paramref name="socketFactory"/> argument is null.</exception>
/// <exception cref="ArgumentOutOfRangeException">The <paramref name="multicastTimeToLive"/> argument is less than or equal to zero.</exception>
public SsdpCommunicationsServer(ISocketFactory socketFactory, int localPort, int multicastTimeToLive, INetworkManager networkManager, ILogger logger, bool enableMultiSocketBinding)
{
if (socketFactory == null) throw new ArgumentNullException(nameof(socketFactory));
@@ -111,7 +111,7 @@ namespace Rssdp.Infrastructure
/// <summary>
/// Causes the server to begin listening for multicast messages, being SSDP search requests and notifications.
/// </summary>
/// <exception cref="System.ObjectDisposedException">Thrown if the <see cref="DisposableManagedObjectBase.IsDisposed"/> property is true (because <seealso cref="DisposableManagedObjectBase.Dispose()" /> has been called previously).</exception>
/// <exception cref="ObjectDisposedException">Thrown if the <see cref="DisposableManagedObjectBase.IsDisposed"/> property is true (because <seealso cref="DisposableManagedObjectBase.Dispose()" /> has been called previously).</exception>
public void BeginListeningForBroadcasts()
{
ThrowIfDisposed();
@@ -138,7 +138,7 @@ namespace Rssdp.Infrastructure
/// <summary>
/// Causes the server to stop listening for multicast messages, being SSDP search requests and notifications.
/// </summary>
/// <exception cref="System.ObjectDisposedException">Thrown if the <see cref="DisposableManagedObjectBase.IsDisposed"/> property is true (because <seealso cref="DisposableManagedObjectBase.Dispose()" /> has been called previously).</exception>
/// <exception cref="ObjectDisposedException">Thrown if the <see cref="DisposableManagedObjectBase.IsDisposed"/> property is true (because <seealso cref="DisposableManagedObjectBase.Dispose()" /> has been called previously).</exception>
public void StopListeningForBroadcasts()
{
lock (_BroadcastListenSocketSynchroniser)
@@ -269,7 +269,7 @@ namespace Rssdp.Infrastructure
/// <summary>
/// Stops listening for search responses on the local, unicast socket.
/// </summary>
/// <exception cref="System.ObjectDisposedException">Thrown if the <see cref="DisposableManagedObjectBase.IsDisposed"/> property is true (because <seealso cref="DisposableManagedObjectBase.Dispose()" /> has been called previously).</exception>
/// <exception cref="ObjectDisposedException">Thrown if the <see cref="DisposableManagedObjectBase.IsDisposed"/> property is true (because <seealso cref="DisposableManagedObjectBase.Dispose()" /> has been called previously).</exception>
public void StopListeningForResponses()
{
lock (_SendSocketSynchroniser)

View File

@@ -276,8 +276,8 @@ namespace Rssdp
/// <para>If the device is already a member of the <see cref="Devices"/> collection, this method does nothing.</para>
/// <para>Also sets the <see cref="SsdpEmbeddedDevice.RootDevice"/> property of the added device and all descendant devices to the relevant <see cref="SsdpRootDevice"/> instance.</para>
/// </remarks>
/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
/// <exception cref="System.InvalidOperationException">Thrown if the <paramref name="device"/> is already associated with a different <see cref="SsdpRootDevice"/> instance than used in this tree. Can occur if you try to add the same device instance to more than one tree. Also thrown if you try to add a device to itself.</exception>
/// <exception cref="ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
/// <exception cref="InvalidOperationException">Thrown if the <paramref name="device"/> is already associated with a different <see cref="SsdpRootDevice"/> instance than used in this tree. Can occur if you try to add the same device instance to more than one tree. Also thrown if you try to add a device to itself.</exception>
/// <seealso cref="DeviceAdded"/>
public void AddDevice(SsdpEmbeddedDevice device)
{
@@ -305,7 +305,7 @@ namespace Rssdp
/// <para>If the device is not a member of the <see cref="Devices"/> collection, this method does nothing.</para>
/// <para>Also sets the <see cref="SsdpEmbeddedDevice.RootDevice"/> property to null for the removed device and all descendant devices.</para>
/// </remarks>
/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
/// <exception cref="ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
/// <seealso cref="DeviceRemoved"/>
public void RemoveDevice(SsdpEmbeddedDevice device)
{

View File

@@ -185,7 +185,7 @@ namespace Rssdp.Infrastructure
/// <seealso cref="StopListeningForNotifications"/>
/// <seealso cref="DeviceAvailable"/>
/// <seealso cref="DeviceUnavailable"/>
/// <exception cref="System.ObjectDisposedException">Throw if the <see cref="DisposableManagedObjectBase.IsDisposed"/> ty is true.</exception>
/// <exception cref="ObjectDisposedException">Throw if the <see cref="DisposableManagedObjectBase.IsDisposed"/> ty is true.</exception>
public void StartListeningForNotifications()
{
ThrowIfDisposed();
@@ -204,7 +204,7 @@ namespace Rssdp.Infrastructure
/// <seealso cref="StartListeningForNotifications"/>
/// <seealso cref="DeviceAvailable"/>
/// <seealso cref="DeviceUnavailable"/>
/// <exception cref="System.ObjectDisposedException">Throw if the <see cref="DisposableManagedObjectBase.IsDisposed"/> property is true.</exception>
/// <exception cref="ObjectDisposedException">Throw if the <see cref="DisposableManagedObjectBase.IsDisposed"/> property is true.</exception>
public void StopListeningForNotifications()
{
ThrowIfDisposed();

View File

@@ -76,8 +76,8 @@ namespace Rssdp.Infrastructure
/// <para>This method ignores duplicate device adds (if the same device instance is added multiple times, the second and subsequent add calls do nothing).</para>
/// </remarks>
/// <param name="device">The <see cref="SsdpDevice"/> instance to add.</param>
/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
/// <exception cref="System.InvalidOperationException">Thrown if the <paramref name="device"/> contains property values that are not acceptable to the UPnP 1.0 specification.</exception>
/// <exception cref="ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
/// <exception cref="InvalidOperationException">Thrown if the <paramref name="device"/> contains property values that are not acceptable to the UPnP 1.0 specification.</exception>
[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)
{
@@ -85,7 +85,7 @@ namespace Rssdp.Infrastructure
ThrowIfDisposed();
TimeSpan minCacheTime = TimeSpan.Zero;
var minCacheTime = TimeSpan.Zero;
bool wasAdded = false;
lock (_Devices)
{
@@ -113,13 +113,13 @@ namespace Rssdp.Infrastructure
/// <para>This method does nothing if the device was not found in the collection.</para>
/// </remarks>
/// <param name="device">The <see cref="SsdpDevice"/> instance to add.</param>
/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
/// <exception cref="ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
public async Task RemoveDevice(SsdpRootDevice device)
{
if (device == null) throw new ArgumentNullException(nameof(device));
bool wasRemoved = false;
TimeSpan minCacheTime = TimeSpan.Zero;
var minCacheTime = TimeSpan.Zero;
lock (_Devices)
{
if (_Devices.Contains(device))