From 6a435d62f5c79d07b49c497d30cf41782129a130 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 22 Apr 2014 23:18:01 -0400 Subject: [PATCH] move Didl builder --- .../{PlayTo => Didl}/DidlBuilder.cs | 4 ++-- MediaBrowser.Dlna/MediaBrowser.Dlna.csproj | 2 +- MediaBrowser.Dlna/PlayTo/DlnaController.cs | 1 + MediaBrowser.Dlna/Server/ControlHandler.cs | 18 +++++++++--------- 4 files changed, 13 insertions(+), 12 deletions(-) rename MediaBrowser.Dlna/{PlayTo => Didl}/DidlBuilder.cs (99%) diff --git a/MediaBrowser.Dlna/PlayTo/DidlBuilder.cs b/MediaBrowser.Dlna/Didl/DidlBuilder.cs similarity index 99% rename from MediaBrowser.Dlna/PlayTo/DidlBuilder.cs rename to MediaBrowser.Dlna/Didl/DidlBuilder.cs index 0304008fc2..5c7992a065 100644 --- a/MediaBrowser.Dlna/PlayTo/DidlBuilder.cs +++ b/MediaBrowser.Dlna/Didl/DidlBuilder.cs @@ -5,9 +5,9 @@ using System; using System.Collections.Generic; using System.Linq; -namespace MediaBrowser.Dlna.PlayTo +namespace MediaBrowser.Dlna.Didl { - internal class DidlBuilder + public class DidlBuilder { const string CRLF = "\r\n"; const string UNKNOWN = "Unknown"; diff --git a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj index c09c512c8d..a96838a4dd 100644 --- a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj +++ b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj @@ -61,7 +61,7 @@ - + diff --git a/MediaBrowser.Dlna/PlayTo/DlnaController.cs b/MediaBrowser.Dlna/PlayTo/DlnaController.cs index 1c5503abb8..b037113d5f 100644 --- a/MediaBrowser.Dlna/PlayTo/DlnaController.cs +++ b/MediaBrowser.Dlna/PlayTo/DlnaController.cs @@ -7,6 +7,7 @@ using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Session; +using MediaBrowser.Dlna.Didl; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; diff --git a/MediaBrowser.Dlna/Server/ControlHandler.cs b/MediaBrowser.Dlna/Server/ControlHandler.cs index 40e1919f8d..8a0b0a3d5e 100644 --- a/MediaBrowser.Dlna/Server/ControlHandler.cs +++ b/MediaBrowser.Dlna/Server/ControlHandler.cs @@ -93,15 +93,6 @@ namespace MediaBrowser.Dlna.Server var deviceId = "fgd"; - var env = new XmlDocument(); - env.AppendChild(env.CreateXmlDeclaration("1.0", "utf-8", "yes")); - var envelope = env.CreateElement("SOAP-ENV", "Envelope", NS_SOAPENV); - env.AppendChild(envelope); - envelope.SetAttribute("encodingStyle", NS_SOAPENV, "http://schemas.xmlsoap.org/soap/encoding/"); - - var rbody = env.CreateElement("SOAP-ENV:Body", NS_SOAPENV); - env.DocumentElement.AppendChild(rbody); - IEnumerable> result; _logger.Debug("Received control request {0}", method.Name); @@ -125,6 +116,15 @@ namespace MediaBrowser.Dlna.Server else throw new ResourceNotFoundException("Unexpected control request name: " + method.LocalName); + var env = new XmlDocument(); + env.AppendChild(env.CreateXmlDeclaration("1.0", "utf-8", "yes")); + var envelope = env.CreateElement("SOAP-ENV", "Envelope", NS_SOAPENV); + env.AppendChild(envelope); + envelope.SetAttribute("encodingStyle", NS_SOAPENV, "http://schemas.xmlsoap.org/soap/encoding/"); + + var rbody = env.CreateElement("SOAP-ENV:Body", NS_SOAPENV); + env.DocumentElement.AppendChild(rbody); + var response = env.CreateElement(String.Format("u:{0}Response", method.LocalName), method.NamespaceURI); rbody.AppendChild(response);