/// Initializes a new instance of the <see cref="SecurityException"/> class.
/// Initializes a new instance of the <see cref="SecurityException"/> class.
/// </summary>
/// </summary>
/// <param name="message">The message that describes the error</param>
/// <param name="message">The message that describes the error.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
/// Returns true if the device was discovered due to an alive notification, or a search and was not already in the cache. Returns false if the item came from the cache but matched the current search request.
/// Returns true if the device was discovered due to an alive notification, or a search and was not already in the cache. Returns false if the item came from the cache but matched the current search request.
/// Returns true if the device is considered unavailable because it's cached information expired before a new alive notification or search result was received. Returns false if the device is unavailable because it sent an explicit notification of it's unavailability.
/// Returns true if the device is considered unavailable because it's cached information expired before a new alive notification or search result was received. Returns false if the device is unavailable because it sent an explicit notification of it's unavailability.
/// Sets or returns the type of notification, being either a uuid, device type, service type or upnp:rootdevice.
/// Sets or returns the type of notification, being either a uuid, device type, service type or upnp:rootdevice.
/// </summary>
/// </summary>
@ -60,10 +53,6 @@ namespace Rssdp
/// </summary>
/// </summary>
publicHttpHeadersResponseHeaders{get;set;}
publicHttpHeadersResponseHeaders{get;set;}
#endregion
#region Public Methods
/// <summary>
/// <summary>
/// Returns true if this device information has expired, based on the current date/time, and the <see cref="CacheLifetime"/> & <see cref="AsAt"/> properties.
/// Returns true if this device information has expired, based on the current date/time, and the <see cref="CacheLifetime"/> & <see cref="AsAt"/> properties.
if(data.Length==0)thrownewArgumentException("data cannot be an empty string.",nameof(data));
{
if(!LineTerminators.Any(data.Contains))thrownewArgumentException("data is not a valid request, it does not contain any CRLF/LF terminators.",nameof(data));
thrownewArgumentNullException(nameof(data));
}
if(data.Length==0)
{
thrownewArgumentException("data cannot be an empty string.",nameof(data));
}
if(!LineTerminators.Any(data.Contains))
{
thrownewArgumentException("data is not a valid request, it does not contain any CRLF/LF terminators.",nameof(data));
if(versionSeparatorIndex<=0||versionSeparatorIndex==versionData.Length)thrownewArgumentException("request header line is invalid. Http Version not supplied or incorrect format.",nameof(versionData));
/// Gets or sets a boolean value indicating whether or not this instance is shared amongst multiple <see cref="SsdpDeviceLocatorBase"/> and/or <see cref="ISsdpDevicePublisher"/> instances.
/// Gets or sets a boolean value indicating whether or not this instance is shared amongst multiple <see cref="SsdpDeviceLocatorBase"/> and/or <see cref="ISsdpDevicePublisher"/> instances.
/// </summary>
/// </summary>
@ -59,7 +48,5 @@ namespace Rssdp.Infrastructure
/// <para>If true, disposing an instance of a <see cref="SsdpDeviceLocatorBase"/>or a <see cref="ISsdpDevicePublisher"/> will not dispose this comms server instance. The calling code is responsible for managing the lifetime of the server.</para>
/// <para>If true, disposing an instance of a <see cref="SsdpDeviceLocatorBase"/>or a <see cref="ISsdpDevicePublisher"/> will not dispose this comms server instance. The calling code is responsible for managing the lifetime of the server.</para>
/// Sets or returns a string containing the filter for notifications. Notifications not matching the filter will not raise the <see cref="DeviceAvailable"/> or <see cref="DeviceUnavailable"/> events.
/// Sets or returns a string containing the filter for notifications. Notifications not matching the filter will not raise the <see cref="DeviceAvailable"/> or <see cref="DeviceUnavailable"/> events.
/// </summary>
/// </summary>
@ -58,12 +51,6 @@ namespace Rssdp.Infrastructure
set;
set;
}
}
#endregion
#region Methods
#region SearchAsync Overloads
/// <summary>
/// <summary>
/// Aynchronously performs a search for all devices using the default search timeout, and returns an awaitable task that can be used to retrieve the results.
/// Aynchronously performs a search for all devices using the default search timeout, and returns an awaitable task that can be used to retrieve the results.
/// </summary>
/// </summary>
@ -108,8 +95,6 @@ namespace Rssdp.Infrastructure
/// <returns>A task whose result is an <see cref="System.Collections.Generic.IEnumerable{T}"/> of <see cref="DiscoveredSsdpDevice" /> instances, representing all found devices.</returns>
/// <returns>A task whose result is an <see cref="System.Collections.Generic.IEnumerable{T}"/> of <see cref="DiscoveredSsdpDevice" /> instances, representing all found devices.</returns>
/// Gets or sets a boolean value indicating whether or not this instance is shared amongst multiple <see cref="SsdpDeviceLocatorBase"/> and/or <see cref="ISsdpDevicePublisher"/> instances.
/// Gets or sets a boolean value indicating whether or not this instance is shared amongst multiple <see cref="SsdpDeviceLocatorBase"/> and/or <see cref="ISsdpDevicePublisher"/> instances.
/// Derived type constructor, allows constructing a device with no parent. Should only be used from derived types that are or inherit from <see cref="SsdpRootDevice"/>.
/// Derived type constructor, allows constructing a device with no parent. Should only be used from derived types that are or inherit from <see cref="SsdpRootDevice"/>.
if(device.RootDevice!=null&&device.RootDevice!=this.ToRootDevice())thrownewInvalidOperationException("This device is already associated with a different root device (has been added as a child in another branch).");
{
if(device==this)thrownewInvalidOperationException("Can't add device to itself.");
if(searchWaitTime.TotalSeconds>0&&searchWaitTime.TotalSeconds<=1)thrownewArgumentException("searchWaitTime must be zero (if you are not using the result and relying entirely in the events), or greater than one second.");
}
if(searchTarget.Length==0)
{
thrownewArgumentException("searchTarget cannot be an empty string.",nameof(searchTarget));
}
if(searchWaitTime.TotalSeconds<0)
{
thrownewArgumentException("searchWaitTime must be a positive time.");
thrownewArgumentException("searchWaitTime must be zero (if you are not using the result and relying entirely in the events), or greater than one second.");
/// Sets or returns a string containing the filter for notifications. Notifications not matching the filter will not raise the <see cref="ISsdpDeviceLocator.DeviceAvailable"/> or <see cref="ISsdpDeviceLocator.DeviceUnavailable"/> events.
/// Sets or returns a string containing the filter for notifications. Notifications not matching the filter will not raise the <see cref="ISsdpDeviceLocator.DeviceAvailable"/> or <see cref="ISsdpDeviceLocator.DeviceUnavailable"/> events.
thrownewArgumentException("osName cannot be an empty string.",nameof(osName));
}
if(osVersion==null)
{
thrownewArgumentNullException(nameof(osVersion));
}
if(osVersion.Length==0)
{
thrownewArgumentException("osVersion cannot be an empty string.",nameof(osName));
}
_SupportPnpRootDevice=true;
_SupportPnpRootDevice=true;
_Devices=newList<SsdpRootDevice>();
_Devices=newList<SsdpRootDevice>();
@ -82,7 +105,10 @@ 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.")]
[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.")]