aboutsummaryrefslogtreecommitdiff
path: root/RSSDP
diff options
context:
space:
mode:
Diffstat (limited to 'RSSDP')
-rw-r--r--RSSDP/CustomHttpHeaders.cs1
-rw-r--r--RSSDP/DeviceAvailableEventArgs.cs1
-rw-r--r--RSSDP/DeviceEventArgs.cs1
-rw-r--r--RSSDP/DeviceUnavailableEventArgs.cs1
-rw-r--r--RSSDP/DiscoveredSsdpDevice.cs1
-rw-r--r--RSSDP/DisposableManagedObjectBase.cs1
-rw-r--r--RSSDP/IUPnPDeviceValidator.cs4
-rw-r--r--RSSDP/RequestReceivedEventArgs.cs1
-rw-r--r--RSSDP/ResponseReceivedEventArgs.cs1
-rw-r--r--RSSDP/SsdpCommunicationsServer.cs2
-rw-r--r--RSSDP/SsdpConstants.cs1
-rw-r--r--RSSDP/SsdpDevice.cs7
-rw-r--r--RSSDP/SsdpDeviceExtensions.cs1
-rw-r--r--RSSDP/SsdpDeviceIcon.cs1
-rw-r--r--RSSDP/SsdpDeviceLocator.cs1
-rw-r--r--RSSDP/SsdpDeviceLocatorBase.cs37
-rw-r--r--RSSDP/SsdpDeviceProperties.cs1
-rw-r--r--RSSDP/SsdpDeviceProperty.cs1
-rw-r--r--RSSDP/SsdpDevicePublisher.cs1
-rw-r--r--RSSDP/SsdpEmbeddedDevice.cs1
-rw-r--r--RSSDP/SsdpRootDevice.cs1
-rw-r--r--RSSDP/UPnP10DeviceValidator.cs10
22 files changed, 34 insertions, 43 deletions
diff --git a/RSSDP/CustomHttpHeaders.cs b/RSSDP/CustomHttpHeaders.cs
index 9250d612f..f2412d2e7 100644
--- a/RSSDP/CustomHttpHeaders.cs
+++ b/RSSDP/CustomHttpHeaders.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
namespace Rssdp
diff --git a/RSSDP/DeviceAvailableEventArgs.cs b/RSSDP/DeviceAvailableEventArgs.cs
index 046c10524..d80b4b65b 100644
--- a/RSSDP/DeviceAvailableEventArgs.cs
+++ b/RSSDP/DeviceAvailableEventArgs.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MediaBrowser.Model.Net;
diff --git a/RSSDP/DeviceEventArgs.cs b/RSSDP/DeviceEventArgs.cs
index e0c19c4c4..774d812ee 100644
--- a/RSSDP/DeviceEventArgs.cs
+++ b/RSSDP/DeviceEventArgs.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
namespace Rssdp
diff --git a/RSSDP/DeviceUnavailableEventArgs.cs b/RSSDP/DeviceUnavailableEventArgs.cs
index 5b7c1437a..171a834a0 100644
--- a/RSSDP/DeviceUnavailableEventArgs.cs
+++ b/RSSDP/DeviceUnavailableEventArgs.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/RSSDP/DiscoveredSsdpDevice.cs b/RSSDP/DiscoveredSsdpDevice.cs
index 58f0acfa5..54701890c 100644
--- a/RSSDP/DiscoveredSsdpDevice.cs
+++ b/RSSDP/DiscoveredSsdpDevice.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
diff --git a/RSSDP/DisposableManagedObjectBase.cs b/RSSDP/DisposableManagedObjectBase.cs
index 87f2aa71c..1288ba721 100644
--- a/RSSDP/DisposableManagedObjectBase.cs
+++ b/RSSDP/DisposableManagedObjectBase.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/RSSDP/IUPnPDeviceValidator.cs b/RSSDP/IUPnPDeviceValidator.cs
index 39b80742e..8fa48df7b 100644
--- a/RSSDP/IUPnPDeviceValidator.cs
+++ b/RSSDP/IUPnPDeviceValidator.cs
@@ -11,13 +11,13 @@ namespace Rssdp.Infrastructure
/// Returns an enumerable set of strings, each one being a description of an invalid property on the specified root device.
/// </summary>
/// <param name="device">The <see cref="SsdpRootDevice"/> to validate.</param>
- System.Collections.Generic.IEnumerable<string> GetValidationErrors(SsdpRootDevice device);
+ System.Collections.Generic.List<string> GetValidationErrors(SsdpRootDevice device);
/// <summary>
/// Returns an enumerable set of strings, each one being a description of an invalid property on the specified device.
/// </summary>
/// <param name="device">The <see cref="SsdpDevice"/> to validate.</param>
- System.Collections.Generic.IEnumerable<string> GetValidationErrors(SsdpDevice device);
+ System.Collections.Generic.List<string> GetValidationErrors(SsdpDevice device);
/// <summary>
/// Validates the specified device and throws an <see cref="System.InvalidOperationException"/> if there are any validation errors.
diff --git a/RSSDP/RequestReceivedEventArgs.cs b/RSSDP/RequestReceivedEventArgs.cs
index 03c059634..f4e367760 100644
--- a/RSSDP/RequestReceivedEventArgs.cs
+++ b/RSSDP/RequestReceivedEventArgs.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
diff --git a/RSSDP/ResponseReceivedEventArgs.cs b/RSSDP/ResponseReceivedEventArgs.cs
index c983fa204..f67d5da90 100644
--- a/RSSDP/ResponseReceivedEventArgs.cs
+++ b/RSSDP/ResponseReceivedEventArgs.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
diff --git a/RSSDP/SsdpCommunicationsServer.cs b/RSSDP/SsdpCommunicationsServer.cs
index 91004b76f..a4be24ebf 100644
--- a/RSSDP/SsdpCommunicationsServer.cs
+++ b/RSSDP/SsdpCommunicationsServer.cs
@@ -364,7 +364,7 @@ namespace Rssdp.Infrastructure
if (_enableMultiSocketBinding)
{
- foreach (var address in _networkManager.GetLocalIpAddresses().ToList())
+ foreach (var address in _networkManager.GetLocalIpAddresses())
{
try
{
diff --git a/RSSDP/SsdpConstants.cs b/RSSDP/SsdpConstants.cs
index c839d9e0b..87f01f9e0 100644
--- a/RSSDP/SsdpConstants.cs
+++ b/RSSDP/SsdpConstants.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/RSSDP/SsdpDevice.cs b/RSSDP/SsdpDevice.cs
index a595742d0..cda11f0a4 100644
--- a/RSSDP/SsdpDevice.cs
+++ b/RSSDP/SsdpDevice.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
-using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
@@ -283,7 +282,7 @@ namespace Rssdp
/// </summary>
/// <seealso cref="AddDevice"/>
/// <seealso cref="RemoveDevice"/>
- public IEnumerable<SsdpDevice> Devices
+ public IList<SsdpDevice> Devices
{
get;
private set;
@@ -466,7 +465,7 @@ namespace Rssdp
private static void WriteIcons(XmlWriter writer, SsdpDevice device)
{
- if (device.Icons.Any())
+ if (device.Icons.Count > 0)
{
writer.WriteStartElement("iconList");
@@ -489,7 +488,7 @@ namespace Rssdp
private void WriteChildDevices(XmlWriter writer, SsdpDevice parentDevice)
{
- if (parentDevice.Devices.Any())
+ if (parentDevice.Devices.Count > 0)
{
writer.WriteStartElement("deviceList");
diff --git a/RSSDP/SsdpDeviceExtensions.cs b/RSSDP/SsdpDeviceExtensions.cs
index 0ad710a6b..6e1b45646 100644
--- a/RSSDP/SsdpDeviceExtensions.cs
+++ b/RSSDP/SsdpDeviceExtensions.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
namespace Rssdp
diff --git a/RSSDP/SsdpDeviceIcon.cs b/RSSDP/SsdpDeviceIcon.cs
index 4ffda58ff..3ed707c80 100644
--- a/RSSDP/SsdpDeviceIcon.cs
+++ b/RSSDP/SsdpDeviceIcon.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/RSSDP/SsdpDeviceLocator.cs b/RSSDP/SsdpDeviceLocator.cs
index 3ea17237d..8fe4d4a14 100644
--- a/RSSDP/SsdpDeviceLocator.cs
+++ b/RSSDP/SsdpDeviceLocator.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Threading;
diff --git a/RSSDP/SsdpDeviceLocatorBase.cs b/RSSDP/SsdpDeviceLocatorBase.cs
index 1adb95cdf..d1eaef88a 100644
--- a/RSSDP/SsdpDeviceLocatorBase.cs
+++ b/RSSDP/SsdpDeviceLocatorBase.cs
@@ -127,7 +127,7 @@ namespace Rssdp.Infrastructure
}
catch (Exception ex)
{
-
+
}
}
@@ -543,17 +543,9 @@ namespace Rssdp.Infrastructure
}
}
- private IEnumerable<DiscoveredSsdpDevice> GetUnexpiredDevices()
- {
- lock (_Devices)
- {
- return (from device in _Devices where !device.IsExpired() select device).ToArray();
- }
- }
-
private bool DeviceDied(string deviceUsn, bool expired)
{
- IEnumerable<DiscoveredSsdpDevice> existingDevices = null;
+ List<DiscoveredSsdpDevice> existingDevices = null;
lock (_Devices)
{
existingDevices = FindExistingDeviceNotifications(_Devices, deviceUsn);
@@ -565,7 +557,7 @@ namespace Rssdp.Infrastructure
}
}
- if (existingDevices != null && existingDevices.Any())
+ if (existingDevices != null && existingDevices.Count > 0)
{
foreach (var removedDevice in existingDevices)
{
@@ -591,12 +583,29 @@ namespace Rssdp.Infrastructure
private static DiscoveredSsdpDevice FindExistingDeviceNotification(IEnumerable<DiscoveredSsdpDevice> devices, string notificationType, string usn)
{
- return (from d in devices where d.NotificationType == notificationType && d.Usn == usn select d).FirstOrDefault();
+ foreach (var d in devices)
+ {
+ if (d.NotificationType == notificationType && d.Usn == usn)
+ {
+ return d;
+ }
+ }
+ return null;
}
- private static IEnumerable<DiscoveredSsdpDevice> FindExistingDeviceNotifications(IList<DiscoveredSsdpDevice> devices, string usn)
+ private static List<DiscoveredSsdpDevice> FindExistingDeviceNotifications(IList<DiscoveredSsdpDevice> devices, string usn)
{
- return (from d in devices where d.Usn == usn select d).ToArray();
+ var list = new List<DiscoveredSsdpDevice>();
+
+ foreach (var d in devices)
+ {
+ if (d.Usn == usn)
+ {
+ list.Add(d);
+ }
+ }
+
+ return list;
}
#endregion
diff --git a/RSSDP/SsdpDeviceProperties.cs b/RSSDP/SsdpDeviceProperties.cs
index 850dfb0ba..ae5309da5 100644
--- a/RSSDP/SsdpDeviceProperties.cs
+++ b/RSSDP/SsdpDeviceProperties.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
namespace Rssdp
diff --git a/RSSDP/SsdpDeviceProperty.cs b/RSSDP/SsdpDeviceProperty.cs
index 3a8dd2ec7..3abcfb9aa 100644
--- a/RSSDP/SsdpDeviceProperty.cs
+++ b/RSSDP/SsdpDeviceProperty.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
using System.Threading.Tasks;
diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.cs
index 1c17c7837..2aa143775 100644
--- a/RSSDP/SsdpDevicePublisher.cs
+++ b/RSSDP/SsdpDevicePublisher.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Threading;
diff --git a/RSSDP/SsdpEmbeddedDevice.cs b/RSSDP/SsdpEmbeddedDevice.cs
index c03106b2d..28948f950 100644
--- a/RSSDP/SsdpEmbeddedDevice.cs
+++ b/RSSDP/SsdpEmbeddedDevice.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
namespace Rssdp
diff --git a/RSSDP/SsdpRootDevice.cs b/RSSDP/SsdpRootDevice.cs
index faf851bcb..5b7d0f454 100644
--- a/RSSDP/SsdpRootDevice.cs
+++ b/RSSDP/SsdpRootDevice.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Text;
using System.Xml;
using Rssdp.Infrastructure;
diff --git a/RSSDP/UPnP10DeviceValidator.cs b/RSSDP/UPnP10DeviceValidator.cs
index f802b7639..2a8a9ccd2 100644
--- a/RSSDP/UPnP10DeviceValidator.cs
+++ b/RSSDP/UPnP10DeviceValidator.cs
@@ -26,11 +26,11 @@ namespace Rssdp.Infrastructure
/// <param name="device">The <see cref="SsdpRootDevice"/> to validate.</param>
/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
/// <returns>A non-null enumerable set of strings, empty if there are no validation errors, otherwise each string represents a discrete problem.</returns>
- public IEnumerable<string> GetValidationErrors(SsdpRootDevice device)
+ public List<string> GetValidationErrors(SsdpRootDevice device)
{
if (device == null) throw new ArgumentNullException("device");
- var retVal = GetValidationErrors((SsdpDevice)device) as IList<string>;
+ var retVal = GetValidationErrors((SsdpDevice)device);
if (device.Location == null)
retVal.Add("Location cannot be null.");
@@ -49,7 +49,7 @@ namespace Rssdp.Infrastructure
/// <param name="device">The <see cref="SsdpDevice"/> to validate.</param>
/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
/// <returns>A non-null enumerable set of strings, empty if there are no validation errors, otherwise each string represents a discrete problem.</returns>
- public IEnumerable<string> GetValidationErrors(SsdpDevice device)
+ public List<string> GetValidationErrors(SsdpDevice device)
{
if (device == null) throw new ArgumentNullException("device");
@@ -110,7 +110,7 @@ namespace Rssdp.Infrastructure
if (String.IsNullOrEmpty(device.ModelName))
retVal.Add("ModelName is required.");
- if (device.Icons.Any())
+ if (device.Icons.Count > 0)
ValidateIcons(device, retVal);
ValidateChildDevices(device, retVal);
@@ -127,7 +127,7 @@ namespace Rssdp.Infrastructure
public void ThrowIfDeviceInvalid(SsdpDevice device)
{
var errors = this.GetValidationErrors(device);
- if (errors != null && errors.Any()) throw new InvalidOperationException("Invalid device settings : " + String.Join(Environment.NewLine, errors));
+ if (errors != null && errors.Count > 0) throw new InvalidOperationException("Invalid device settings : " + String.Join(Environment.NewLine, errors));
}
#endregion