callm 4 anni fa
parent
commit
6195dfe861
1 ha cambiato i file con 21 aggiunte e 9 eliminazioni
  1. 21 9
      UAS_AutoUpdate/CheckUpdateWindow.cs

+ 21 - 9
UAS_AutoUpdate/CheckUpdateWindow.cs

@@ -54,6 +54,8 @@ namespace UAS_AutoUpdate
             try
             {
                 WebClient wc = new WebClient();
+                Console.WriteLine(GetCacheData(ConfigFile, "ServerConfigPath").ToString());
+                wc.Credentials= new NetworkCredential("vsftpd", "vsftpd");
                 wc.DownloadFile(new Uri(GetCacheData(ConfigFile, "ServerConfigPath").ToString()), ServerConfigFile);
                 //服务器获取的配置文件
                 Version ver1 = new Version(GetCacheData(ServerConfigFile, "Version").ToString());
@@ -93,6 +95,7 @@ namespace UAS_AutoUpdate
             }
             catch (Exception ex)
             {
+                Console.WriteLine(ex.Message);
                 LogManager.DoLog(ex.Message.ToString());
                 Process p = Process.Start("UAS_MES_NEW.exe");
                 CloseWhenFinished = true;
@@ -204,6 +207,7 @@ namespace UAS_AutoUpdate
         {
             Action act = () =>
             {
+                Console.WriteLine(e.ProgressPercentage);
                 _progressbar.Value = e.ProgressPercentage;
                 _processrate.Text = e.ProgressPercentage + "%";
             };
@@ -211,17 +215,24 @@ namespace UAS_AutoUpdate
                 this.Invoke(act);
             if (e.ProgressPercentage == 100)
             {
-                if (!Zipped)
+                try
                 {
-                    ZipHelper.UnZip(Application.StartupPath + @"\UAS_MES.zip", Application.StartupPath);
-                    Process p = Process.Start("UAS_MES_NEW.exe");
-                    CloseWhenFinished = true;
-                    Close();
+                    if (!Zipped)
+                    {
+                        ZipHelper.UnZip(Application.StartupPath + @"\UAS_MES.zip", Application.StartupPath);
+                        Process p = Process.Start("UAS_MES_NEW.exe");
+                        CloseWhenFinished = true;
+                        Close();
+                    }
+                    else
+                    {
+                        CloseWhenFinished = true;
+                        Close();
+                    }
                 }
-                else
+                catch (Exception ex)
                 {
-                    CloseWhenFinished = true;
-                    Close();
+                    Console.WriteLine(ex.Message);
                 }
             }
         }
@@ -284,8 +295,9 @@ namespace UAS_AutoUpdate
                                 }
                             }
                         }
-                        catch (Exception)
+                        catch (Exception ex)
                         {
+                            Console.WriteLine(ex.Message);
                         }
                     }
                 }