Пример #1
0
        private static bool TryFormatRss20Enclosure(Rss20Enclosure enclosureToFormat, out XElement enclosureElement)
        {
            enclosureElement = default;

            if (enclosureToFormat == null)
            {
                return(false);
            }

            enclosureElement = new XElement("enclosure");
            enclosureElement.Add(new XAttribute("url", enclosureToFormat.Url ?? ""));
            enclosureElement.Add(new XAttribute("length", enclosureToFormat.Length ?? ""));
            enclosureElement.Add(new XAttribute("type", enclosureToFormat.Type ?? ""));

            return(true);
        }
Пример #2
0
        private static bool TryParseRss20Enclosure(XElement enclosureElement, out Rss20Enclosure parsedEnclosure)
        {
            parsedEnclosure = default;

            if (enclosureElement == null)
            {
                return(false);
            }

            parsedEnclosure        = new Rss20Enclosure();
            parsedEnclosure.Url    = enclosureElement.Attribute("url")?.Value;
            parsedEnclosure.Length = enclosureElement.Attribute("length")?.Value;
            parsedEnclosure.Type   = enclosureElement.Attribute("type")?.Value;

            return(true);
        }