Esempio n. 1
0
 private void DoUpgrade()
 {
     downloaded         = false;
     progressBar1.Value = 0;
     foreach (ReleaseFile file in diff)
     {
         try
         {
             DownloadTool.DownloadFile(tempPath,
                                       "http://" + OperatorFile.GetIniFileString("DataBase", "Server", "", Environment.CurrentDirectory + "\\AmbleAppServer.ini") + "/AmbleUpdate/" + remoteRelease.ReleaseVersion, file.FileName, progressBar1);
         }
         catch (Exception ex)
         {
             AppTool.DeleteTempFolder(tempPath);
             MessageBox.Show(file.FileName + "Download Fail, Please try later");
             return;
         }
     }
     try
     {
         foreach (ReleaseFile file in diff)
         {
             string dir = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory + file.FileName);
             if (!Directory.Exists(dir))
             {
                 Directory.CreateDirectory(dir);
             }
             File.Copy(tempPath + file.FileName, AppDomain.CurrentDomain.BaseDirectory + file.FileName, true);
         }
     }
     catch (Exception ex)
     {
         AppTool.DeleteTempFolder(tempPath);
         MessageBox.Show(ex.Message, "Upgrate Fail", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     downloaded = true;
     OperatorFile.WriteIniFileString("Version", "CurrentVersion", remoteRelease.ReleaseVersion, Environment.CurrentDirectory + "\\AmbleAppServer.ini");
     MessageBox.Show("Upgrade Successful.");
     Application.Exit();
 }
Esempio n. 2
0
 private void UpdateForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     AppTool.DeleteTempFolder(tempPath);
 }