|
|
@@ -28,17 +28,28 @@ namespace UAS_AutoUpdate
|
|
|
private void CheckUpdateWindow_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
//使用WebClient从指定位置下载文件,然后进行解压缩覆盖
|
|
|
- FileInfo info = new FileInfo(ConfigFile);
|
|
|
- if (info.Length == 0)
|
|
|
+ try
|
|
|
{
|
|
|
- XmlDocument doc = new XmlDocument();
|
|
|
- //创建类型声明节点
|
|
|
- XmlNode node = doc.CreateXmlDeclaration("1.0", "utf-8", "");
|
|
|
- doc.AppendChild(node);
|
|
|
- //创建根节点
|
|
|
- XmlElement xeRoot = doc.CreateElement("cacheInfo");
|
|
|
- doc.AppendChild(xeRoot);
|
|
|
- doc.Save(ConfigFile);
|
|
|
+ FileInfo info = new FileInfo(ConfigFile);
|
|
|
+ if (info.Length == 0)
|
|
|
+ {
|
|
|
+ XmlDocument doc = new XmlDocument();
|
|
|
+ //创建类型声明节点
|
|
|
+ XmlNode node = doc.CreateXmlDeclaration("1.0", "utf-8", "");
|
|
|
+ doc.AppendChild(node);
|
|
|
+ //创建根节点
|
|
|
+ XmlElement xeRoot = doc.CreateElement("cacheInfo");
|
|
|
+ doc.AppendChild(xeRoot);
|
|
|
+ doc.Save(ConfigFile);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ MessageBox.Show("配置文件丢失,程序无法自动升级");
|
|
|
+ Process p = Process.Start("UAS_MES_NEW.exe");
|
|
|
+ CloseWhenFinished = true;
|
|
|
+ Close();
|
|
|
+ return;
|
|
|
}
|
|
|
try
|
|
|
{
|