jellyfin/Emby.Dlna/ConnectionManager/ControlHandler.cs

43 lines
1.3 KiB
C#
Raw Normal View History

#pragma warning disable CS1591
using System;
2019-01-13 14:16:19 -05:00
using System.Collections.Generic;
using System.Xml;
2016-10-29 18:34:54 -04:00
using Emby.Dlna.Service;
2019-01-13 14:16:19 -05:00
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
2016-10-29 18:22:20 -04:00
using MediaBrowser.Model.Dlna;
2019-01-13 14:16:19 -05:00
using Microsoft.Extensions.Logging;
2016-10-29 18:22:20 -04:00
2016-10-29 18:34:54 -04:00
namespace Emby.Dlna.ConnectionManager
2016-10-29 18:22:20 -04:00
{
public class ControlHandler : BaseControlHandler
{
private readonly DeviceProfile _profile;
public ControlHandler(IServerConfigurationManager config, ILogger logger, DeviceProfile profile)
: base(config, logger)
{
_profile = profile;
}
/// <inheritdoc />
protected override void WriteResult(string methodName, IDictionary<string, string> methodParams, XmlWriter xmlWriter)
2016-10-29 18:22:20 -04:00
{
if (string.Equals(methodName, "GetProtocolInfo", StringComparison.OrdinalIgnoreCase))
{
HandleGetProtocolInfo(xmlWriter);
2020-01-26 11:41:34 -05:00
return;
2016-10-29 18:22:20 -04:00
}
throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
}
private void HandleGetProtocolInfo(XmlWriter xmlWriter)
2016-10-29 18:22:20 -04:00
{
xmlWriter.WriteElementString("Source", _profile.ProtocolInfo);
xmlWriter.WriteElementString("Sink", string.Empty);
2016-11-04 04:31:05 -04:00
}
2016-10-29 18:22:20 -04:00
}
}