2020-01-22 13:00:07 -07:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
#pragma warning disable SA1600
|
|
|
|
|
2019-01-13 12:54:44 -07:00
|
|
|
using System.Xml.Linq;
|
2016-10-29 15:22:20 -07:00
|
|
|
|
2016-10-29 15:34:54 -07:00
|
|
|
namespace Emby.Dlna.Ssdp
|
2016-10-29 15:22:20 -07: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 12:52:19 -07:00
|
|
|
foreach (var node in container.Descendants(name))
|
|
|
|
{
|
|
|
|
return node.Value;
|
|
|
|
}
|
2016-10-29 15:22:20 -07:00
|
|
|
|
2017-08-24 12:52:19 -07:00
|
|
|
return null;
|
2016-10-29 15:22:20 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|