2016-10-29 22:22:20 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Net.Sockets;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
|
2016-10-29 22:34:54 +00:00
|
|
|
|
namespace Emby.Dlna.Ssdp
|
2016-10-29 22:22:20 +00: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)
|
|
|
|
|
{
|
|
|
|
|
var node = container.Descendants(name)
|
|
|
|
|
.FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
return node == null ? null : node.Value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|