Пример #1
0
 public static void Start()
 {
     currentVersion = OperatorFile.GetIniFileString("Version", "CurrentVersion", "", Environment.CurrentDirectory + "\\AmbleAppServer.ini");
     try
     {
         DownloadTool.DownloadFile(tempPath, "http://" + OperatorFile.GetIniFileString("DataBase", "Server", "", Environment.CurrentDirectory + "\\AmbleAppServer.ini") + "/AmbleUpdate/", ReleaseConfigFileName);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Can not connect to the server,Please contact the Admin");
     }
     remoteReleaseList = new ReleaseList(tempPath + ReleaseConfigFileName);
 }
Пример #2
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();
 }