ControlHandler.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using MediaBrowser.Common.Extensions;
  2. using MediaBrowser.Controller.Configuration;
  3. using Emby.Dlna.Server;
  4. using Emby.Dlna.Service;
  5. using MediaBrowser.Model.Dlna;
  6. using MediaBrowser.Model.Logging;
  7. using System;
  8. using System.Collections.Generic;
  9. using MediaBrowser.Model.Xml;
  10. namespace Emby.Dlna.ConnectionManager
  11. {
  12. public class ControlHandler : BaseControlHandler
  13. {
  14. private readonly DeviceProfile _profile;
  15. protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
  16. {
  17. if (string.Equals(methodName, "GetProtocolInfo", StringComparison.OrdinalIgnoreCase))
  18. {
  19. return HandleGetProtocolInfo();
  20. }
  21. throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
  22. }
  23. private IEnumerable<KeyValuePair<string, string>> HandleGetProtocolInfo()
  24. {
  25. return new Headers(true)
  26. {
  27. { "Source", _profile.ProtocolInfo },
  28. { "Sink", "" }
  29. };
  30. }
  31. public ControlHandler(IServerConfigurationManager config, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory, DeviceProfile profile) : base(config, logger, xmlReaderSettingsFactory)
  32. {
  33. _profile = profile;
  34. }
  35. }
  36. }