Exemplo n.º 1
0
        private static bool TryParseRss20TextInput(XElement textInputElement, ExtensionManifestDirectory extensionManifestDirectory, out Rss20TextInput parsedTextInput)
        {
            parsedTextInput = default;

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

            parsedTextInput             = new Rss20TextInput();
            parsedTextInput.Title       = textInputElement.Element("title")?.Value.Trim();
            parsedTextInput.Description = textInputElement.Element("description")?.Value.Trim();
            parsedTextInput.Name        = textInputElement.Element("name")?.Value.Trim();
            parsedTextInput.Link        = textInputElement.Element("link")?.Value.Trim();

            // extensions
            ExtensibleEntityParser.ParseXElementExtensions(textInputElement, extensionManifestDirectory, parsedTextInput);

            return(true);
        }
Exemplo n.º 2
0
        private static bool TryFormatRss20TextInput(Rss20TextInput textInputToFormat, XNamespaceAliasSet namespaceAliases, ExtensionManifestDirectory extensionManifestDirectory, out XElement textInputElement)
        {
            textInputElement = default;

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

            textInputElement = new XElement("textInput");

            textInputElement.Add(new XElement("title")
            {
                Value = textInputToFormat.Title ?? ""
            });
            textInputElement.Add(new XElement("description")
            {
                Value = textInputToFormat.Description ?? ""
            });
            textInputElement.Add(new XElement("name")
            {
                Value = textInputToFormat.Name ?? ""
            });
            textInputElement.Add(new XElement("link")
            {
                Value = textInputToFormat.Link ?? ""
            });

            // extensions
            if (ExtensibleEntityFormatter.TryFormatXElementExtensions(textInputToFormat, namespaceAliases, extensionManifestDirectory, out var extensionElements))
            {
                textInputElement.AddRange(extensionElements);
            }

            return(true);
        }