SsdpExtensions.cs 673 B

123456789101112131415161718192021222324252627
  1. #pragma warning disable CS1591
  2. using System.Linq;
  3. using System.Xml.Linq;
  4. namespace Emby.Dlna.Ssdp
  5. {
  6. public static class SsdpExtensions
  7. {
  8. public static string GetValue(this XElement container, XName name)
  9. {
  10. var node = container.Element(name);
  11. return node?.Value;
  12. }
  13. public static string GetAttributeValue(this XElement container, XName name)
  14. {
  15. var node = container.Attribute(name);
  16. return node?.Value;
  17. }
  18. public static string GetDescendantValue(this XElement container, XName name)
  19. => container.Descendants(name).FirstOrDefault()?.Value;
  20. }
  21. }