using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.IO; using System.Data; namespace GZTW.AyaNova.BLL { /// /// Class used to check for updates /// [Serializable] public class CheckForUpdate { /// /// Checks the AyaNova web server for available /// updates to the product indicated /// /// Name of product i.e. "AyaNovaFull", "AyaNovaLite" /// Version to check (current version) /// url to update page or empty string if no update available static public string UpdateUrl(string sProductName, string sVersion) { try { //download the update xml WebClient wc = new WebClient(); Stream strm = wc.OpenRead("https://www.ayanova.com/updates/updates.xml");//case 3649 DataSet ds = new DataSet(); ds.ReadXml(strm); strm.Close(); //find matching product and version foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["Product"].ToString() == sProductName && dr["Version"].ToString() == sVersion) return dr["UpgradeInfoUrl"].ToString(); } return ""; } catch (System.Net.WebException e) { return e.Message; } } } }