本地讀取服務器Xml文件及本地讀本地的xml


 

updateUrl="ServerUrl"(服務器路徑)

WebClient wc = new WebClient();
Stream stream = wc.OpenRead(updateUrl);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(stream);
XmlNode list = xmlDoc.SelectSingleNode("Update");
foreach (XmlNode node in list)
{
if (node.Name == "Soft" && node.Attributes["Name"].Value.ToLower() == SoftName.ToLower())
{
foreach (XmlNode xml in node)
{
if (xml.Name == "Verson")
newVerson = xml.InnerText;//拿到最新版本號
else
download = xml.InnerText;//拿到要更新的文件
}
}
}
//Version ver = new Version(newVerson);
//Version verson = Assembly.LoadFrom(loadFile).GetName().Version;
Double versonSer = Convert.ToDouble(newVerson);
//獲取本地版本號..
xmlDoc.Load("Update.xml");
XmlElement xmlRoot = xmlDoc.DocumentElement;
Double verson = 0;
foreach (XmlNode node in xmlRoot.ChildNodes)
{
//5、獲取子節點對應的內容
verson = Convert.ToDouble(node["Verson"].InnerText);
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM