SsdpDeviceLocator.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using MediaBrowser.Model.Net;
  5. using MediaBrowser.Model.Threading;
  6. using Rssdp.Infrastructure;
  7. namespace Rssdp
  8. {
  9. // THIS IS A LINKED FILE - SHARED AMONGST MULTIPLE PLATFORMS
  10. // Be careful to check any changes compile and work for all platform projects it is shared in.
  11. /// <summary>
  12. /// Allows you to search the network for a particular device, device types, or UPnP service types. Also listenings for broadcast notifications of device availability and raises events to indicate changes in status.
  13. /// </summary>
  14. public sealed class SsdpDeviceLocator : SsdpDeviceLocatorBase
  15. {
  16. /// <summary>
  17. /// Default constructor. Constructs a new instance using the default <see cref="ISsdpCommunicationsServer"/> and <see cref="ISocketFactory"/> implementations for this platform.
  18. /// </summary>
  19. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification="Can't expose along exception paths here (exceptions should be very rare anyway, and probably fatal too) and we shouldn't dipose the items we pass to base in any other case.")]
  20. public SsdpDeviceLocator(ISsdpCommunicationsServer communicationsServer, ITimerFactory timerFacatory) : base(communicationsServer, timerFacatory)
  21. {
  22. // This is not the problem you are looking for;
  23. // Yes, this is poor man's dependency injection which some call an anti-pattern.
  24. // However, it makes the library really simple to get started with or to use if the calling code isn't using IoC/DI.
  25. // The fact we have injected dependencies is really an internal architectural implementation detail to allow for the
  26. // cross platform and testing concerns of this library. It shouldn't be something calling code worries about and is
  27. // not a deliberate extension point, except where adding new platform support in which case...
  28. // There is a constructor that takes a manually injected dependency anyway, so proper DI using
  29. // a container or whatever can be done anyway.
  30. }
  31. }
  32. }