mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
Update BaseControlHandler.cs
This commit is contained in:
parent
a52ab69e13
commit
63571578ae
1 changed files with 18 additions and 5 deletions
|
@ -155,7 +155,7 @@ namespace Emby.Dlna.Service
|
||||||
|
|
||||||
private async Task<ControlRequestInfo> ParseBodyTagAsync(XmlReader reader)
|
private async Task<ControlRequestInfo> ParseBodyTagAsync(XmlReader reader)
|
||||||
{
|
{
|
||||||
var result = new ControlRequestInfo();
|
string namespaceURI = null, localName = null;
|
||||||
|
|
||||||
await reader.MoveToContentAsync().ConfigureAwait(false);
|
await reader.MoveToContentAsync().ConfigureAwait(false);
|
||||||
await reader.ReadAsync().ConfigureAwait(false);
|
await reader.ReadAsync().ConfigureAwait(false);
|
||||||
|
@ -165,11 +165,12 @@ namespace Emby.Dlna.Service
|
||||||
{
|
{
|
||||||
if (reader.NodeType == XmlNodeType.Element)
|
if (reader.NodeType == XmlNodeType.Element)
|
||||||
{
|
{
|
||||||
result.LocalName = reader.LocalName;
|
localName = reader.LocalName;
|
||||||
result.NamespaceURI = reader.NamespaceURI;
|
namespaceURI = reader.NamespaceURI;
|
||||||
|
|
||||||
if (!reader.IsEmptyElement)
|
if (!reader.IsEmptyElement)
|
||||||
{
|
{
|
||||||
|
var result = new ControlRequestInfo(localName, namespaceURI);
|
||||||
using (var subReader = reader.ReadSubtree())
|
using (var subReader = reader.ReadSubtree())
|
||||||
{
|
{
|
||||||
await ParseFirstBodyChildAsync(subReader, result.Headers).ConfigureAwait(false);
|
await ParseFirstBodyChildAsync(subReader, result.Headers).ConfigureAwait(false);
|
||||||
|
@ -187,7 +188,12 @@ namespace Emby.Dlna.Service
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
if (localName != null && namespaceURI != null)
|
||||||
|
{
|
||||||
|
return new ControlRequestInfo(localName, namespaceURI);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new EndOfStreamException("Stream ended but no control found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ParseFirstBodyChildAsync(XmlReader reader, IDictionary<string, string> headers)
|
private async Task ParseFirstBodyChildAsync(XmlReader reader, IDictionary<string, string> headers)
|
||||||
|
@ -234,11 +240,18 @@ namespace Emby.Dlna.Service
|
||||||
|
|
||||||
private class ControlRequestInfo
|
private class ControlRequestInfo
|
||||||
{
|
{
|
||||||
|
public ControlRequestInfo(string localName, string namespaceUri)
|
||||||
|
{
|
||||||
|
LocalName = localName;
|
||||||
|
NamespaceURI = namespaceUri;
|
||||||
|
Headers = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
public string LocalName { get; set; }
|
public string LocalName { get; set; }
|
||||||
|
|
||||||
public string NamespaceURI { get; set; }
|
public string NamespaceURI { get; set; }
|
||||||
|
|
||||||
public Dictionary<string, string> Headers { get; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
public Dictionary<string, string> Headers { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue