2014-02-26 21:31:47 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Net.Sockets;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
|
2014-07-18 19:07:28 +00:00
|
|
|
|
namespace MediaBrowser.Dlna.Ssdp
|
2014-02-26 21:31:47 +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;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-06 17:53:23 +00:00
|
|
|
|
public static string GetAttributeValue(this XElement container, XName name)
|
|
|
|
|
{
|
|
|
|
|
var node = container.Attribute(name);
|
|
|
|
|
|
|
|
|
|
return node == null ? null : node.Value;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-26 21:31:47 +00:00
|
|
|
|
public static string GetDescendantValue(this XElement container, XName name)
|
|
|
|
|
{
|
|
|
|
|
var node = container.Descendants(name)
|
|
|
|
|
.FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
return node == null ? null : node.Value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|