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);
}