remove regions
This commit is contained in:
parent
8de6452967
commit
8e3d874802
|
@ -19,8 +19,6 @@ namespace Emby.Dlna.PlayTo
|
|||
{
|
||||
public class Device : IDisposable
|
||||
{
|
||||
#region Fields & Properties
|
||||
|
||||
private Timer _timer;
|
||||
|
||||
public DeviceInfo Properties { get; set; }
|
||||
|
@ -53,10 +51,10 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
public bool IsStopped => TransportState == TRANSPORTSTATE.STOPPED;
|
||||
|
||||
#endregion
|
||||
|
||||
private readonly IHttpClient _httpClient;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IServerConfigurationManager _config;
|
||||
|
||||
public Action OnDeviceUnavailable { get; set; }
|
||||
|
@ -142,8 +140,6 @@ namespace Emby.Dlna.PlayTo
|
|||
}
|
||||
}
|
||||
|
||||
#region Commanding
|
||||
|
||||
public Task VolumeDown(CancellationToken cancellationToken)
|
||||
{
|
||||
var sendVolume = Math.Max(Volume - 5, 0);
|
||||
|
@ -402,11 +398,8 @@ namespace Emby.Dlna.PlayTo
|
|||
RestartTimer(true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Get data
|
||||
|
||||
private int _connectFailureCount;
|
||||
|
||||
private async void TimerCallback(object sender)
|
||||
{
|
||||
if (_disposed)
|
||||
|
@ -870,10 +863,6 @@ namespace Emby.Dlna.PlayTo
|
|||
return new string[4];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region From XML
|
||||
|
||||
private async Task<TransportCommands> GetAVProtocolAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
if (AvCommands != null)
|
||||
|
@ -1068,8 +1057,6 @@ namespace Emby.Dlna.PlayTo
|
|||
return new Device(deviceProperties, httpClient, logger, config);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||
private static DeviceIcon CreateIcon(XElement element)
|
||||
{
|
||||
|
@ -1193,8 +1180,6 @@ namespace Emby.Dlna.PlayTo
|
|||
});
|
||||
}
|
||||
|
||||
#region IDisposable
|
||||
|
||||
bool _disposed;
|
||||
|
||||
public void Dispose()
|
||||
|
@ -1221,8 +1206,6 @@ namespace Emby.Dlna.PlayTo
|
|||
_disposed = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} - {1}", Properties.Name, Properties.BaseUrl);
|
||||
|
|
|
@ -224,8 +224,6 @@ namespace MediaBrowser.Controller.Library
|
|||
|
||||
public string CollectionType { get; set; }
|
||||
|
||||
#region Equality Overrides
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified <see cref="object" /> is equal to this instance.
|
||||
/// </summary>
|
||||
|
@ -260,8 +258,5 @@ namespace MediaBrowser.Controller.Library
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ namespace MediaBrowser.Controller.Library
|
|||
_stopwatch = new Stopwatch();
|
||||
_stopwatch.Start();
|
||||
}
|
||||
#region IDisposable Members
|
||||
|
||||
/// <summary>
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||
|
@ -71,7 +70,5 @@ namespace MediaBrowser.Controller.Library
|
|||
_logger.LogInformation(message);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,15 +10,10 @@ namespace Rssdp
|
|||
{
|
||||
public IPAddress LocalIpAddress { get; set; }
|
||||
|
||||
#region Fields
|
||||
|
||||
private readonly DiscoveredSsdpDevice _DiscoveredDevice;
|
||||
|
||||
private readonly bool _IsNewlyDiscovered;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Full constructor.
|
||||
/// </summary>
|
||||
|
@ -33,10 +28,6 @@ namespace Rssdp
|
|||
_IsNewlyDiscovered = isNewlyDiscovered;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
|
@ -52,7 +43,5 @@ namespace Rssdp
|
|||
{
|
||||
get { return _DiscoveredDevice; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,15 +7,8 @@ namespace Rssdp
|
|||
/// </summary>
|
||||
public sealed class DeviceEventArgs : EventArgs
|
||||
{
|
||||
|
||||
#region Fields
|
||||
|
||||
private readonly SsdpDevice _Device;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance for the specified <see cref="SsdpDevice"/>.
|
||||
/// </summary>
|
||||
|
@ -28,10 +21,6 @@ namespace Rssdp
|
|||
_Device = device;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <see cref="SsdpDevice"/> instance the event being raised for.
|
||||
/// </summary>
|
||||
|
@ -39,7 +28,5 @@ namespace Rssdp
|
|||
{
|
||||
get { return _Device; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,16 +7,10 @@ namespace Rssdp
|
|||
/// </summary>
|
||||
public sealed class DeviceUnavailableEventArgs : EventArgs
|
||||
{
|
||||
|
||||
#region Fields
|
||||
|
||||
private readonly DiscoveredSsdpDevice _DiscoveredDevice;
|
||||
|
||||
private readonly bool _Expired;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Full constructor.
|
||||
/// </summary>
|
||||
|
@ -31,10 +25,6 @@ namespace Rssdp
|
|||
_Expired = expired;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
|
@ -50,7 +40,5 @@ namespace Rssdp
|
|||
{
|
||||
get { return _DiscoveredDevice; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,15 +10,8 @@ namespace Rssdp
|
|||
/// <seealso cref="Infrastructure.ISsdpDeviceLocator"/>
|
||||
public sealed class DiscoveredSsdpDevice
|
||||
{
|
||||
|
||||
#region Fields
|
||||
|
||||
private DateTimeOffset _AsAt;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Sets or returns the type of notification, being either a uuid, device type, service type or upnp:rootdevice.
|
||||
/// </summary>
|
||||
|
@ -60,10 +53,6 @@ namespace Rssdp
|
|||
/// </summary>
|
||||
public HttpHeaders ResponseHeaders { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this device information has expired, based on the current date/time, and the <see cref="CacheLifetime"/> & <see cref="AsAt"/> properties.
|
||||
/// </summary>
|
||||
|
@ -73,10 +62,6 @@ namespace Rssdp
|
|||
return this.CacheLifetime == TimeSpan.Zero || this.AsAt.Add(this.CacheLifetime) <= DateTimeOffset.Now;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Overrides
|
||||
|
||||
/// <summary>
|
||||
/// Returns the device's <see cref="Usn"/> value.
|
||||
/// </summary>
|
||||
|
@ -85,7 +70,5 @@ namespace Rssdp
|
|||
{
|
||||
return this.Usn;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,6 @@ namespace Rssdp.Infrastructure
|
|||
/// </summary>
|
||||
public abstract class DisposableManagedObjectBase : IDisposable
|
||||
{
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Override this method and dispose any objects you own the lifetime of if disposing is true;
|
||||
/// </summary>
|
||||
|
@ -29,10 +26,6 @@ namespace Rssdp.Infrastructure
|
|||
if (this.IsDisposed) throw new ObjectDisposedException(this.GetType().FullName);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Sets or returns a boolean indicating whether or not this instance has been disposed.
|
||||
/// </summary>
|
||||
|
@ -42,9 +35,6 @@ namespace Rssdp.Infrastructure
|
|||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public string BuildMessage(string header, Dictionary<string, string> values)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
|
@ -63,8 +53,6 @@ namespace Rssdp.Infrastructure
|
|||
return builder.ToString();
|
||||
}
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
/// <summary>
|
||||
/// Disposes this object instance and all internally managed resources.
|
||||
/// </summary>
|
||||
|
@ -79,7 +67,5 @@ namespace Rssdp.Infrastructure
|
|||
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,16 +11,9 @@ namespace Rssdp.Infrastructure
|
|||
/// <typeparam name="T"></typeparam>
|
||||
public abstract class HttpParserBase<T> where T : new()
|
||||
{
|
||||
|
||||
#region Fields
|
||||
|
||||
private readonly string[] LineTerminators = new string[] { "\r\n", "\n" };
|
||||
private readonly char[] SeparatorCharacters = new char[] { ',', ';' };
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Parses the <paramref name="data"/> provided into either a <see cref="HttpRequestMessage"/> or <see cref="HttpResponseMessage"/> object.
|
||||
/// </summary>
|
||||
|
@ -81,10 +74,6 @@ namespace Rssdp.Infrastructure
|
|||
return Version.Parse(versionData.Substring(versionSeparatorIndex + 1));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Parses a line from an HTTP request or response message containing a header name and value pair.
|
||||
/// </summary>
|
||||
|
@ -202,8 +191,5 @@ namespace Rssdp.Infrastructure
|
|||
else
|
||||
return trimmedSegment;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,17 +9,10 @@ namespace Rssdp.Infrastructure
|
|||
/// </summary>
|
||||
public sealed class HttpRequestParser : HttpParserBase<HttpRequestMessage>
|
||||
{
|
||||
|
||||
#region Fields & Constants
|
||||
|
||||
private readonly string[] ContentHeaderNames = new string[]
|
||||
{
|
||||
"Allow", "Content-Disposition", "Content-Encoding", "Content-Language", "Content-Length", "Content-Location", "Content-MD5", "Content-Range", "Content-Type", "Expires", "Last-Modified"
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
{
|
||||
"Allow", "Content-Disposition", "Content-Encoding", "Content-Language", "Content-Length", "Content-Location", "Content-MD5", "Content-Range", "Content-Type", "Expires", "Last-Modified"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Parses the specified data into a <see cref="HttpRequestMessage"/> instance.
|
||||
|
@ -45,10 +38,6 @@ namespace Rssdp.Infrastructure
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Overrides
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
|
@ -83,7 +72,5 @@ namespace Rssdp.Infrastructure
|
|||
{
|
||||
return ContentHeaderNames.Contains(headerName, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,17 +10,10 @@ namespace Rssdp.Infrastructure
|
|||
/// </summary>
|
||||
public sealed class HttpResponseParser : HttpParserBase<HttpResponseMessage>
|
||||
{
|
||||
|
||||
#region Fields & Constants
|
||||
|
||||
private readonly string[] ContentHeaderNames = new string[]
|
||||
{
|
||||
"Allow", "Content-Disposition", "Content-Encoding", "Content-Language", "Content-Length", "Content-Location", "Content-MD5", "Content-Range", "Content-Type", "Expires", "Last-Modified"
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
{
|
||||
"Allow", "Content-Disposition", "Content-Encoding", "Content-Language", "Content-Length", "Content-Location", "Content-MD5", "Content-Range", "Content-Type", "Expires", "Last-Modified"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Parses the specified data into a <see cref="HttpResponseMessage"/> instance.
|
||||
|
@ -47,10 +40,6 @@ namespace Rssdp.Infrastructure
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Overrides Methods
|
||||
|
||||
/// <summary>
|
||||
/// Returns a boolean indicating whether the specified HTTP header name represents a content header (true), or a message header (false).
|
||||
/// </summary>
|
||||
|
@ -87,7 +76,5 @@ namespace Rssdp.Infrastructure
|
|||
message.ReasonPhrase = parts[2].Trim();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,6 @@ namespace Rssdp.Infrastructure
|
|||
/// </summary>
|
||||
public interface ISsdpCommunicationsServer : IDisposable
|
||||
{
|
||||
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a HTTPU request message is received by a socket (unicast or multicast).
|
||||
/// </summary>
|
||||
|
@ -23,10 +20,6 @@ namespace Rssdp.Infrastructure
|
|||
/// </summary>
|
||||
event EventHandler<ResponseReceivedEventArgs> ResponseReceived;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Causes the server to begin listening for multicast messages, being SSDP search requests and notifications.
|
||||
/// </summary>
|
||||
|
@ -48,10 +41,6 @@ namespace Rssdp.Infrastructure
|
|||
Task SendMulticastMessage(string message, IPAddress fromLocalIpAddress, CancellationToken cancellationToken);
|
||||
Task SendMulticastMessage(string message, int sendCount, IPAddress fromLocalIpAddress, CancellationToken cancellationToken);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
|
@ -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>
|
||||
/// </remarks>
|
||||
bool IsShared { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,6 @@ namespace Rssdp.Infrastructure
|
|||
/// <seealso cref="ISsdpDevicePublisher"/>
|
||||
public interface ISsdpDeviceLocator
|
||||
{
|
||||
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Event raised when a device becomes available or is found by a search request.
|
||||
/// </summary>
|
||||
|
@ -34,10 +31,6 @@ namespace Rssdp.Infrastructure
|
|||
/// <seealso cref="StopListeningForNotifications"/>
|
||||
event EventHandler<DeviceUnavailableEventArgs> DeviceUnavailable;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
|
@ -58,12 +51,6 @@ namespace Rssdp.Infrastructure
|
|||
set;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
#region SearchAsync Overloads
|
||||
|
||||
/// <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.
|
||||
/// </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>
|
||||
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<DiscoveredSsdpDevice>> SearchAsync(TimeSpan searchWaitTime);
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Starts listening for broadcast notifications of service availability.
|
||||
/// </summary>
|
||||
|
@ -134,8 +119,5 @@ namespace Rssdp.Infrastructure
|
|||
/// <seealso cref="DeviceUnavailable"/>
|
||||
/// <seealso cref="NotificationFilter"/>
|
||||
void StopListeningForNotifications();
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,17 +9,12 @@ namespace Rssdp.Infrastructure
|
|||
/// </summary>
|
||||
public sealed class RequestReceivedEventArgs : EventArgs
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private readonly HttpRequestMessage _Message;
|
||||
|
||||
private readonly IPEndPoint _ReceivedFrom;
|
||||
|
||||
#endregion
|
||||
|
||||
public IPAddress LocalIpAddress { get; private set; }
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Full constructor.
|
||||
/// </summary>
|
||||
|
@ -30,10 +25,6 @@ namespace Rssdp.Infrastructure
|
|||
LocalIpAddress = localIpAddress;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="HttpRequestMessage"/> that was received.
|
||||
/// </summary>
|
||||
|
@ -49,7 +40,5 @@ namespace Rssdp.Infrastructure
|
|||
{
|
||||
get { return _ReceivedFrom; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,18 +9,12 @@ namespace Rssdp.Infrastructure
|
|||
/// </summary>
|
||||
public sealed class ResponseReceivedEventArgs : EventArgs
|
||||
{
|
||||
|
||||
public IPAddress LocalIpAddress { get; set; }
|
||||
|
||||
#region Fields
|
||||
|
||||
private readonly HttpResponseMessage _Message;
|
||||
|
||||
private readonly IPEndPoint _ReceivedFrom;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Full constructor.
|
||||
/// </summary>
|
||||
|
@ -30,10 +24,6 @@ namespace Rssdp.Infrastructure
|
|||
_ReceivedFrom = receivedFrom;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="HttpResponseMessage"/> that was received.
|
||||
/// </summary>
|
||||
|
@ -49,7 +39,5 @@ namespace Rssdp.Infrastructure
|
|||
{
|
||||
get { return _ReceivedFrom; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,6 @@ namespace Rssdp.Infrastructure
|
|||
/// </summary>
|
||||
public sealed class SsdpCommunicationsServer : DisposableManagedObjectBase, ISsdpCommunicationsServer
|
||||
{
|
||||
|
||||
#region Fields
|
||||
|
||||
/* We could technically use one socket listening on port 1900 for everything.
|
||||
* This should get both multicast (notifications) and unicast (search response) messages, however
|
||||
* this often doesn't work under Windows because the MS SSDP service is running. If that service
|
||||
|
@ -55,10 +52,6 @@ namespace Rssdp.Infrastructure
|
|||
private bool _IsShared;
|
||||
private readonly bool _enableMultiSocketBinding;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a HTTPU request message is received by a socket (unicast or multicast).
|
||||
/// </summary>
|
||||
|
@ -69,10 +62,6 @@ namespace Rssdp.Infrastructure
|
|||
/// </summary>
|
||||
public event EventHandler<ResponseReceivedEventArgs> ResponseReceived;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Minimum constructor.
|
||||
/// </summary>
|
||||
|
@ -109,10 +98,6 @@ namespace Rssdp.Infrastructure
|
|||
_enableMultiSocketBinding = enableMultiSocketBinding;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Causes the server to begin listening for multicast messages, being SSDP search requests and notifications.
|
||||
/// </summary>
|
||||
|
@ -298,10 +283,6 @@ namespace Rssdp.Infrastructure
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
|
@ -315,10 +296,6 @@ namespace Rssdp.Infrastructure
|
|||
set { _IsShared = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Overrides
|
||||
|
||||
/// <summary>
|
||||
/// Stops listening for requests, disposes this instance and all internal resources.
|
||||
/// </summary>
|
||||
|
@ -333,10 +310,6 @@ namespace Rssdp.Infrastructure
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private Task SendMessageIfSocketNotDisposed(byte[] messageData, IPEndPoint destination, IPAddress fromLocalIpAddress, CancellationToken cancellationToken)
|
||||
{
|
||||
var sockets = _sendSockets;
|
||||
|
@ -506,8 +479,5 @@ namespace Rssdp.Infrastructure
|
|||
LocalIpAddress = localIpAddress
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,6 @@ namespace Rssdp
|
|||
/// <seealso cref="SsdpEmbeddedDevice"/>
|
||||
public abstract class SsdpDevice
|
||||
{
|
||||
|
||||
#region Fields
|
||||
|
||||
private string _Udn;
|
||||
private string _DeviceType;
|
||||
private string _DeviceTypeNamespace;
|
||||
|
@ -25,10 +22,6 @@ namespace Rssdp
|
|||
|
||||
private IList<SsdpDevice> _Devices;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a new child device is added.
|
||||
/// </summary>
|
||||
|
@ -43,10 +36,6 @@ namespace Rssdp
|
|||
/// <seealso cref="DeviceRemoved"/>
|
||||
public event EventHandler<DeviceEventArgs> DeviceRemoved;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// 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"/>.
|
||||
/// </summary>
|
||||
|
@ -60,8 +49,6 @@ namespace Rssdp
|
|||
this.Devices = new ReadOnlyCollection<SsdpDevice>(_Devices);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public SsdpRootDevice ToRootDevice()
|
||||
{
|
||||
var device = this;
|
||||
|
@ -73,10 +60,6 @@ namespace Rssdp
|
|||
return rootDevice;
|
||||
}
|
||||
|
||||
#region Public Properties
|
||||
|
||||
#region UPnP Device Description Properties
|
||||
|
||||
/// <summary>
|
||||
/// Sets or returns the core device type (not including namespace, version etc.). Required.
|
||||
/// </summary>
|
||||
|
@ -252,8 +235,6 @@ namespace Rssdp
|
|||
/// </remarks>
|
||||
public Uri PresentationUrl { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns a read-only enumerable set of <see cref="SsdpDevice"/> objects representing children of this device. Child devices are optional.
|
||||
/// </summary>
|
||||
|
@ -265,10 +246,6 @@ namespace Rssdp
|
|||
private set;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Adds a child device to the <see cref="Devices"/> collection.
|
||||
/// </summary>
|
||||
|
@ -351,7 +328,5 @@ namespace Rssdp
|
|||
if (handlers != null)
|
||||
handlers(this, new DeviceEventArgs(device));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,6 @@ namespace Rssdp.Infrastructure
|
|||
/// </summary>
|
||||
public class SsdpDeviceLocator : DisposableManagedObjectBase
|
||||
{
|
||||
|
||||
#region Fields & Constants
|
||||
|
||||
private List<DiscoveredSsdpDevice> _Devices;
|
||||
private ISsdpCommunicationsServer _CommunicationsServer;
|
||||
|
||||
|
@ -25,10 +22,6 @@ namespace Rssdp.Infrastructure
|
|||
private readonly TimeSpan DefaultSearchWaitTime = TimeSpan.FromSeconds(4);
|
||||
private readonly TimeSpan OneSecond = TimeSpan.FromSeconds(1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
|
@ -42,10 +35,6 @@ namespace Rssdp.Infrastructure
|
|||
_Devices = new List<DiscoveredSsdpDevice>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Raised for when
|
||||
/// <list type="bullet">
|
||||
|
@ -76,12 +65,6 @@ namespace Rssdp.Infrastructure
|
|||
/// <seealso cref="StopListeningForNotifications"/>
|
||||
public event EventHandler<DeviceUnavailableEventArgs> DeviceUnavailable;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
#region Search Overloads
|
||||
|
||||
public void RestartBroadcastTimer(TimeSpan dueTime, TimeSpan period)
|
||||
{
|
||||
lock (_timerLock)
|
||||
|
@ -167,8 +150,6 @@ namespace Rssdp.Infrastructure
|
|||
return BroadcastDiscoverMessage(searchTarget, SearchTimeToMXValue(searchWaitTime), cancellationToken);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Starts listening for broadcast notifications of service availability.
|
||||
/// </summary>
|
||||
|
@ -236,10 +217,6 @@ namespace Rssdp.Infrastructure
|
|||
handlers(this, new DeviceUnavailableEventArgs(device, expired));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
|
@ -261,10 +238,6 @@ namespace Rssdp.Infrastructure
|
|||
set;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Overrides
|
||||
|
||||
/// <summary>
|
||||
/// Disposes this object and all internal resources. Stops listening for all network messages.
|
||||
/// </summary>
|
||||
|
@ -285,12 +258,6 @@ namespace Rssdp.Infrastructure
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
#region Discovery/Device Add
|
||||
|
||||
private void AddOrUpdateDiscoveredDevice(DiscoveredSsdpDevice device, IPAddress localIpAddress)
|
||||
{
|
||||
bool isNewDevice = false;
|
||||
|
@ -326,10 +293,6 @@ namespace Rssdp.Infrastructure
|
|||
|| device.NotificationType == this.NotificationFilter;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Network Message Processing
|
||||
|
||||
private Task BroadcastDiscoverMessage(string serviceType, TimeSpan mxValue, CancellationToken cancellationToken)
|
||||
{
|
||||
var values = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
@ -429,8 +392,6 @@ namespace Rssdp.Infrastructure
|
|||
}
|
||||
}
|
||||
|
||||
#region Header/Message Processing Utilities
|
||||
|
||||
private string GetFirstHeaderStringValue(string headerName, HttpResponseMessage message)
|
||||
{
|
||||
string retVal = null;
|
||||
|
@ -498,12 +459,6 @@ namespace Rssdp.Infrastructure
|
|||
return (TimeSpan)(headerValue.MaxAge ?? headerValue.SharedMaxAge ?? TimeSpan.Zero);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Expiry and Device Removal
|
||||
|
||||
private void RemoveExpiredDevicesFromCache()
|
||||
{
|
||||
if (this.IsDisposed) return;
|
||||
|
@ -560,8 +515,6 @@ namespace Rssdp.Infrastructure
|
|||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TimeSpan SearchTimeToMXValue(TimeSpan searchWaitTime)
|
||||
{
|
||||
if (searchWaitTime.TotalSeconds < 2 || searchWaitTime == TimeSpan.Zero)
|
||||
|
@ -598,10 +551,6 @@ namespace Rssdp.Infrastructure
|
|||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
private void CommsServer_ResponseReceived(object sender, ResponseReceivedEventArgs e)
|
||||
{
|
||||
ProcessSearchResponseMessage(e.Message, e.LocalIpAddress);
|
||||
|
@ -611,7 +560,5 @@ namespace Rssdp.Infrastructure
|
|||
{
|
||||
ProcessNotificationMessage(e.Message, e.LocalIpAddress);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,14 +5,8 @@ namespace Rssdp
|
|||
/// </summary>
|
||||
public class SsdpEmbeddedDevice : SsdpDevice
|
||||
{
|
||||
|
||||
#region Fields
|
||||
private SsdpRootDevice _RootDevice;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
|
@ -20,10 +14,6 @@ namespace Rssdp
|
|||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Returns the <see cref="SsdpRootDevice"/> that is this device's first ancestor. If this device is itself an <see cref="SsdpRootDevice"/>, then returns a reference to itself.
|
||||
/// </summary>
|
||||
|
@ -46,7 +36,5 @@ namespace Rssdp
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,14 +12,8 @@ namespace Rssdp
|
|||
/// </remarks>
|
||||
public class SsdpRootDevice : SsdpDevice
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private Uri _UrlBase;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
|
@ -27,10 +21,6 @@ namespace Rssdp
|
|||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Specifies how long clients can cache this device's details for. Optional but defaults to <see cref="TimeSpan.Zero"/> which means no-caching. Recommended value is half an hour.
|
||||
/// </summary>
|
||||
|
@ -77,7 +67,5 @@ namespace Rssdp
|
|||
_UrlBase = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user