2020-01-22 13:00:07 -07:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2016-10-29 15:22:20 -07:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2020-01-22 13:00:07 -07:00
|
|
|
using System.Xml;
|
2019-01-13 12:16:19 -07:00
|
|
|
using Emby.Dlna.Service;
|
|
|
|
using MediaBrowser.Common.Extensions;
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
using Microsoft.Extensions.Logging;
|
2016-10-29 15:22:20 -07:00
|
|
|
|
2016-10-29 15:34:54 -07:00
|
|
|
namespace Emby.Dlna.MediaReceiverRegistrar
|
2016-10-29 15:22:20 -07:00
|
|
|
{
|
|
|
|
public class ControlHandler : BaseControlHandler
|
|
|
|
{
|
2020-01-22 13:00:07 -07:00
|
|
|
public ControlHandler(IServerConfigurationManager config, ILogger logger)
|
|
|
|
: base(config, logger)
|
2016-10-29 15:22:20 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-01-22 13:00:07 -07:00
|
|
|
/// <inheritdoc />
|
|
|
|
protected override void WriteResult(string methodName, IDictionary<string, string> methodParams, XmlWriter xmlWriter)
|
2016-10-29 15:22:20 -07:00
|
|
|
{
|
2020-01-22 13:00:07 -07:00
|
|
|
if (string.Equals(methodName, "IsAuthorized", StringComparison.OrdinalIgnoreCase))
|
2016-10-29 15:22:20 -07:00
|
|
|
{
|
2020-01-22 13:00:07 -07:00
|
|
|
HandleIsAuthorized(xmlWriter);
|
|
|
|
return;
|
|
|
|
}
|
2016-10-29 15:22:20 -07:00
|
|
|
|
2020-01-22 13:00:07 -07:00
|
|
|
if (string.Equals(methodName, "IsValidated", StringComparison.OrdinalIgnoreCase))
|
2016-10-29 15:22:20 -07:00
|
|
|
{
|
2020-01-22 13:00:07 -07:00
|
|
|
HandleIsValidated(xmlWriter);
|
|
|
|
return;
|
|
|
|
}
|
2016-11-04 01:31:05 -07:00
|
|
|
|
2020-01-22 13:00:07 -07:00
|
|
|
throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
|
2016-11-04 01:31:05 -07:00
|
|
|
}
|
2020-01-22 13:00:07 -07:00
|
|
|
|
|
|
|
private static void HandleIsAuthorized(XmlWriter xmlWriter)
|
|
|
|
=> xmlWriter.WriteElementString("Result", "1");
|
|
|
|
|
|
|
|
private static void HandleIsValidated(XmlWriter xmlWriter)
|
|
|
|
=> xmlWriter.WriteElementString("Result", "1");
|
2016-10-29 15:22:20 -07:00
|
|
|
}
|
|
|
|
}
|