Exemplo n.º 1
0
        public void LoadXml()
        {
            XmlDocument xdoc = new XmlDocument();

            xdoc.Load(url);
            var root      = xdoc.DocumentElement;
            var listNodes = root.SelectNodes("/LocalUpdate");

            foreach (XmlNode item in listNodes)
            {
                RemoteInfo remote = new RemoteInfo();
                foreach (XmlNode pItem in item.ChildNodes)
                {
                    this.GetType().GetProperty(pItem.Name).SetValue(this, pItem.InnerText, null);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取更新的服务器端的数据信息
        /// </summary>
        /// <param name="url">自动更新的URL信息</param>
        /// <returns></returns>
        private static List <RemoteInfo> GetServer(String url)
        {
            List <RemoteInfo> list = new List <RemoteInfo>();
            XmlReader         xml  = XmlReader.Create(url);
            XmlDocument       xdoc = new XmlDocument();

            xdoc.Load(url);
            var root      = xdoc.DocumentElement;
            var listNodes = root.SelectNodes("/ServerUpdate/item");

            foreach (XmlNode item in listNodes)
            {
                RemoteInfo remote = new RemoteInfo();
                foreach (XmlNode pItem in item.ChildNodes)
                {
                    remote.GetType().GetProperty(pItem.Name).SetValue(remote, pItem.InnerText, null);
                }
                list.Add(remote);
            }
            return(list);
        }