jellyfin/Emby.Dlna/Ssdp/Extensions.cs

34 lines
795 B
C#
Raw Normal View History

#pragma warning disable CS1591
using System.Xml.Linq;
2016-10-30 00:22:20 +02:00
2016-10-30 00:34:54 +02:00
namespace Emby.Dlna.Ssdp
2016-10-30 00:22:20 +02:00
{
public static class Extensions
{
public static string GetValue(this XElement container, XName name)
{
var node = container.Element(name);
return node == null ? null : node.Value;
}
public static string GetAttributeValue(this XElement container, XName name)
{
var node = container.Attribute(name);
return node == null ? null : node.Value;
}
public static string GetDescendantValue(this XElement container, XName name)
{
2017-08-24 21:52:19 +02:00
foreach (var node in container.Descendants(name))
{
return node.Value;
}
2016-10-30 00:22:20 +02:00
2017-08-24 21:52:19 +02:00
return null;
2016-10-30 00:22:20 +02:00
}
}
}