|
@@ -17,6 +17,8 @@ namespace UAS_AutoUpdate
|
|
|
|
|
|
string ServerConfigFile = "ServerConfig.xml";
|
|
|
|
|
|
+ public bool CloseWhenFinished = false;
|
|
|
+
|
|
|
public CheckUpdateWindow()
|
|
|
{
|
|
|
InitializeComponent();
|
|
@@ -47,7 +49,7 @@ namespace UAS_AutoUpdate
|
|
|
//进行版本的比较
|
|
|
if (ver1 > ver2)
|
|
|
{
|
|
|
- Process[] pro = Process.GetProcessesByName("UAS_MES");
|
|
|
+ Process[] pro = Process.GetProcessesByName("UAS_MES_NEW");
|
|
|
if (pro.Length > 0)
|
|
|
{
|
|
|
string CloseProcess = MessageBox.Show(this.ParentForm, "检测到程序仍在运行,是否关闭", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
|
|
@@ -60,6 +62,7 @@ namespace UAS_AutoUpdate
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ CloseWhenFinished = true;
|
|
|
Close();
|
|
|
return;
|
|
|
}
|
|
@@ -71,6 +74,7 @@ namespace UAS_AutoUpdate
|
|
|
else
|
|
|
{
|
|
|
Process p = Process.Start("UAS_MES_NEW.exe");
|
|
|
+ CloseWhenFinished = true;
|
|
|
Close();
|
|
|
}
|
|
|
}
|
|
@@ -192,10 +196,17 @@ namespace UAS_AutoUpdate
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ CloseWhenFinished = true;
|
|
|
Close();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void CheckUpdateWindow_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
+ {
|
|
|
+ if (!CloseWhenFinished)
|
|
|
+ e.Cancel = true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public class ZipHelper
|
|
@@ -226,7 +237,7 @@ namespace UAS_AutoUpdate
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
string directorName = Path.Combine(UnZipPath, Path.GetDirectoryName(theEntry.Name));
|
|
|
string fileName = Path.Combine(directorName, Path.GetFileName(theEntry.Name));
|
|
|
if (!Directory.Exists(directorName))
|