Esempio n. 1
0
 private void Completed(object sender, AsyncCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         if (File.Exists(DownloadXMLPath))
         {
             long   lRemoteAppVersion;
             string szRemoteAppVersion = IniHelper.IniReadValue("APP", "Version", DownloadXMLPath);
             if (!string.IsNullOrEmpty(szRemoteAppVersion))
             {
                 m_pVersion         = szRemoteAppVersion;
                 szRemoteAppVersion = szRemoteAppVersion.Replace(".", "");
                 if (long.TryParse(szRemoteAppVersion, out lRemoteAppVersion))
                 {
                     string szLocalAppVersion = IniHelper.IniReadValue("基本信息", "软件版本", APPBASEPATH);
                     szLocalAppVersion = szLocalAppVersion.Replace(".", "");
                     long lpLocalAppVersion = long.TryParse(szLocalAppVersion, out lpLocalAppVersion) ? lpLocalAppVersion : 0;
                     if (lRemoteAppVersion > lpLocalAppVersion)
                     {
                         string dFile = IniHelper.IniReadValue("APP", "File", DownloadXMLPath);
                         DownLoadFile(dFile);
                     }
                 }
             }
         }
     }
     else
     {
         if (OnUpdateNofityEvent != null)
         {
             OnUpdateNofityEvent(string.Format("检查更新时发生错误:{0}", e.Error.Message));
         }
     }
 }
Esempio n. 2
0
 public SoftUpdate()
 {
     if (!Directory.Exists(DOWNPATH))
     {
         DirectoryInfo directoryInfo = new DirectoryInfo(DOWNPATH);
         directoryInfo.Create();
     }
     UpdateID = IniHelper.IniReadValue("基本信息", "更新标识", APPBASEPATH);
 }