コード例 #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="FileContent">Content of the RSD file</param>
        public RSD(string FileContent)
        {
            if (string.IsNullOrEmpty(FileContent))
            {
                throw new ArgumentNullException("FileContent");
            }
            XmlDocument Document = new XmlDocument();

            Document.LoadXml(FileContent);
            foreach (XmlNode Children in Document.ChildNodes)
            {
                if (Children.Name.Equals("RSD", StringComparison.CurrentCultureIgnoreCase))
                {
                    foreach (XmlNode Child in Children.ChildNodes)
                    {
                        if (Child.Name.Equals("service", StringComparison.CurrentCultureIgnoreCase))
                        {
                            foreach (XmlNode ServiceChild in Child.ChildNodes)
                            {
                                if (ServiceChild.Name.Equals("engineName", StringComparison.CurrentCultureIgnoreCase))
                                {
                                    EngineName = ServiceChild.InnerText;
                                }
                                else if (ServiceChild.Name.Equals("engineLink", StringComparison.CurrentCultureIgnoreCase))
                                {
                                    EngineLink = ServiceChild.InnerText;
                                }
                                else if (ServiceChild.Name.Equals("homePageLink", StringComparison.CurrentCultureIgnoreCase))
                                {
                                    HomePageLink = ServiceChild.InnerText;
                                }
                                else if (ServiceChild.Name.Equals("apis", StringComparison.CurrentCultureIgnoreCase))
                                {
                                    APIs = new APIs((XmlElement)ServiceChild);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: RSD.cs プロジェクト: pengyancai/cs-util
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="FileContent">Content of the RSD file</param>
 public RSD(string FileContent)
 {
     try
     {
         XmlDocument Document = new XmlDocument();
         Document.LoadXml(FileContent);
         foreach (XmlNode Children in Document.ChildNodes)
         {
             if (Children.Name.Equals("RSD", StringComparison.CurrentCultureIgnoreCase))
             {
                 foreach (XmlNode Child in Children.ChildNodes)
                 {
                     if (Child.Name.Equals("service", StringComparison.CurrentCultureIgnoreCase))
                     {
                         foreach (XmlNode ServiceChild in Child.ChildNodes)
                         {
                             if (ServiceChild.Name.Equals("engineName", StringComparison.CurrentCultureIgnoreCase))
                             {
                                 EngineName = ServiceChild.InnerText;
                             }
                             else if (ServiceChild.Name.Equals("engineLink", StringComparison.CurrentCultureIgnoreCase))
                             {
                                 EngineLink = ServiceChild.InnerText;
                             }
                             else if (ServiceChild.Name.Equals("homePageLink", StringComparison.CurrentCultureIgnoreCase))
                             {
                                 HomePageLink = ServiceChild.InnerText;
                             }
                             else if (ServiceChild.Name.Equals("apis", StringComparison.CurrentCultureIgnoreCase))
                             {
                                 APIs = new APIs((XmlElement)ServiceChild);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch { throw; }
 }
コード例 #3
0
        private void LoadContent(string Content)
        {
            XDocument Document = XDocument.Parse(Content);

            foreach (XElement Service in Document.Elements("RSD").Elements("service"))
            {
                if (Service.Element("engineName") != null)
                {
                    EngineName = Service.Element("engineName").Value;
                }
                if (Service.Element("engineLink") != null)
                {
                    EngineLink = Service.Element("engineLink").Value;
                }
                if (Service.Element("homePageLink") != null)
                {
                    HomePageLink = Service.Element("homePageLink").Value;
                }
                if (Service.Element("apis") != null)
                {
                    APIs = new APIs(Service.Element("apis"));
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 public RSD()
 {
     APIs = new APIs();
 }
コード例 #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 public RSD()
 {
     APIs = new APIs();
 }