/// <summary> /// 返回唯一实例 /// </summary> public static DealUpdate GetInstance() { if (instance == null) { instance = new DealUpdate(); } return(instance); }
/// <summary> /// 解压文件 /// </summary> private void DecompressFile(ConnectParam connectParam) { viewModel.UpdateStatus = "开始更新文件..."; Dispatcher.Invoke(new Action(() => { Grid.SetRow(updateStatus, 1); Grid.SetRow(receiveStatus, 3); }), System.Windows.Threading.DispatcherPriority.Normal); viewModel.UpdateStatus = "解压文件..."; try { GZip.Decompress(connectParam.tempPath, connectParam.tempPath, "updatefiles"); viewModel.UpdateStatus = "解压完成..."; } catch (Exception ex) { viewModel.UpdateStatus = "解压出错:" + ex.Message; return; } //备份,更新,还原,清理 DealUpdate dealUpdate = DealUpdate.GetInstance(); dealUpdate.ConfigUpdate(connectParam, viewModel); try { viewModel.UpdateStatus = "登陆程序重新启动中..."; Process.Start(@"G-Box.exe"); } catch { MessageBox.Show("启动程序失败,请手动自行启动!"); } finally { viewModel.UpdateStatus = "等待关闭更新程序..."; Environment.Exit(0); } }