Exemple #1
0
        /// <summary>
        /// Initializes the supplied <see cref="RssCloud"/> using the specified <see cref="XPathNavigator"/> and <see cref="XmlNamespaceManager"/>.
        /// </summary>
        /// <param name="cloud">The <see cref="RssCloud"/> to be filled.</param>
        /// <param name="navigator">The <see cref="XPathNavigator"/> used to navigate the cloud XML data.</param>
        /// <param name="manager">The <see cref="XmlNamespaceManager"/> used to resolve XML namespace prefixes.</param>
        /// <param name="settings">The <see cref="SyndicationResourceLoadSettings"/> object used to configure the load operation of the <see cref="RssFeed"/>.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="cloud"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="navigator"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="manager"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="settings"/> is a null reference (Nothing in Visual Basic).</exception>
        private static void FillCloud(RssCloud cloud, XPathNavigator navigator, XmlNamespaceManager manager, SyndicationResourceLoadSettings settings)
        {
            //------------------------------------------------------------
            //	Validate parameters
            //------------------------------------------------------------
            Guard.ArgumentNotNull(cloud, "cloud");
            Guard.ArgumentNotNull(navigator, "navigator");
            Guard.ArgumentNotNull(manager, "manager");
            Guard.ArgumentNotNull(settings, "settings");

            //------------------------------------------------------------
            //	Attempt to extract category information
            //------------------------------------------------------------
            if (navigator.HasAttributes)
            {
                string domainAttribute            = navigator.GetAttribute("domain", String.Empty);
                string portAttribute              = navigator.GetAttribute("port", String.Empty);
                string pathAttribute              = navigator.GetAttribute("path", String.Empty);
                string registerProcedureAttribute = navigator.GetAttribute("registerProcedure", String.Empty);
                string protocolAttribute          = navigator.GetAttribute("protocol", String.Empty);

                if (!String.IsNullOrEmpty(domainAttribute))
                {
                    cloud.Domain = domainAttribute;
                }

                if (!String.IsNullOrEmpty(portAttribute))
                {
                    int port;
                    if (Int32.TryParse(portAttribute, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out port))
                    {
                        cloud.Port = port;
                    }
                }

                if (!String.IsNullOrEmpty(pathAttribute))
                {
                    cloud.Path = pathAttribute;
                }

                if (!String.IsNullOrEmpty(registerProcedureAttribute))
                {
                    cloud.RegisterProcedure = registerProcedureAttribute;
                }

                if (!String.IsNullOrEmpty(protocolAttribute))
                {
                    RssCloudProtocol protocol = RssCloud.CloudProtocolByName(protocolAttribute);
                    if (protocol != RssCloudProtocol.None)
                    {
                        cloud.Protocol = protocol;
                    }
                }
            }

            SyndicationExtensionAdapter adapter = new SyndicationExtensionAdapter(navigator, settings);

            adapter.Fill(cloud);
        }
Exemple #2
0
        /// <summary>
        /// Provides example code for the RssCloud.CloudProtocolByName(string) method
        /// </summary>
        public static void ProtocolByNameExample()
        {
            RssCloudProtocol protocol = RssCloud.CloudProtocolByName("xml-rpc");

            if (protocol == RssCloudProtocol.XmlRpc)
            {
            }
        }
Exemple #3
0
        /// <summary>
        /// Provides example code for the RssCloud.CloudProtocolByName(string) method
        /// </summary>
        public static void ProtocolByNameExample()
        {
            #region CloudProtocolByName(string name)
            RssCloudProtocol protocol = RssCloud.CloudProtocolByName("xml-rpc");

            if (protocol == RssCloudProtocol.XmlRpc)
            {
            }
            #endregion
        }