public string checkUpdate(string updateUrl)
{
string newVerson = string.Empty;
try
{
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() == "Version")
{
foreach (XmlNode xml in node)
{
if (xml.Name == "Verson")
newVerson = xml.InnerText;
}
}
}
return newVerson;
}
catch (Exception ex)
{
return ex.Message;
}
}
checkUpdate("http://192.168.1.1:80//xxx/update.xml");
文件