コード例 #1
0
 public static bool CheckForUpdate(string _softWare, Version _version, bool notify)
 {
     try
     {
         string tempfile = System.IO.Path.GetTempFileName();
         using (WebClient client = new WebClient())
         {
             client.DownloadFile("http://www.pixvert.fr/updates/versioninfo.xml", tempfile);
         }
         XmlDocument document = new XmlDocument();
         document.Load(tempfile);
         string ver = document.SelectSingleNode("version/application[name='" + _softWare + "']/version").InnerText;
         string url = "http://www.pixvert.fr/download/" + _softWare;
         string logurl = "";
         var selectSingleNode = document.SelectSingleNode("version/application[name='" + _softWare + "']/url");
         if (selectSingleNode != null)
             url = selectSingleNode.InnerText;
         var logNode = document.SelectSingleNode("version/application[name='" + _softWare + "']/logurl");
         if (logNode != null)
             logurl = logNode.InnerText;
         Version v_ver = new Version(ver);
         if (v_ver > _version)
         {
             var wnd = new frmNewVersion(logurl, url);
             wnd.ShowDialog();
         }
         else
         {
             if (notify)
             {
                 MessageBox.Show("L'application est à jour.", "Version de référence : " + ver, MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         File.Delete(tempfile);
     }
     catch (Exception exception)
     {
         LabCommonLog.Log.Error("Erreur lors de la récupération des informations sur la Version", exception);
         if (notify)
         { MessageBox.Show("Une erreur s'est produite : " + exception.Message, "Erreur lors de la vérifiction"); }
     }
     return false;
 }
コード例 #2
0
 public static bool ViewChangesLogs(string _softWare, bool notify)
 {
     try
     {
         string url = "http://www.pixvert.fr/updates/" + _softWare + "/ChangesLog.html";
         var wnd = new frmNewVersion(url, String.Empty);
         wnd.ShowDialog();
     }
     catch (Exception exception)
     {
         LabCommonLog.Log.Error("Erreur lors de la récupération des informations sur la Version", exception);
         if (notify)
         { MessageBox.Show("Une erreur s'est produite : " + exception.Message, "Erreur lors de la vérifiction"); }
     }
     return false;
 }