using System; using System.Collections.Generic; using System.Xml; using Emby.Dlna.Service; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Configuration; using Microsoft.Extensions.Logging; namespace Emby.Dlna.MediaReceiverRegistrar { /// /// Defines the . /// public class ControlHandler : BaseControlHandler { /// /// Initializes a new instance of the class. /// /// The for use with the instance. /// The for use with the instance. public ControlHandler(IServerConfigurationManager config, ILogger logger) : base(config, logger) { } /// protected override void WriteResult(string methodName, IReadOnlyDictionary methodParams, XmlWriter xmlWriter) { if (string.Equals(methodName, "IsAuthorized", StringComparison.OrdinalIgnoreCase)) { HandleIsAuthorized(xmlWriter); return; } if (string.Equals(methodName, "IsValidated", StringComparison.OrdinalIgnoreCase)) { HandleIsValidated(xmlWriter); return; } throw new ResourceNotFoundException("Unexpected control request name: " + methodName); } /// /// Records that the handle is authorized in the xml stream. /// /// The . private static void HandleIsAuthorized(XmlWriter xmlWriter) => xmlWriter.WriteElementString("Result", "1"); /// /// Records that the handle is validated in the xml stream. /// /// The . private static void HandleIsValidated(XmlWriter xmlWriter) => xmlWriter.WriteElementString("Result", "1"); } }