From 592a0245b7e98cf25c63b3dd70d8889d0b6d20fa Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Sat, 30 Mar 2019 08:08:21 -0500 Subject: [PATCH] Skip updater execution if new version could not be downloaded Related to issue #638 --- DS4Windows/DS4Forms/DS4Form.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index b65af28..995d659 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -792,22 +792,23 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question Uri url2 = new Uri($"https://github.com/Ryochan7/DS4Updater/releases/download/v{UPDATER_VERSION}/{updaterExe}"); WebClient wc2 = new WebClient(); if (appdatapath == exepath) + { wc2.DownloadFile(url2, exepath + "\\DS4Updater.exe"); + Process p = new Process(); + p.StartInfo.FileName = exepath + "\\DS4Updater.exe"; + p.StartInfo.Arguments = "-autolaunch"; + if (AdminNeeded()) + p.StartInfo.Verb = "runas"; + + try { p.Start(); Close(); } + catch { } + } else { this.BeginInvoke((System.Action)(() => MessageBox.Show(Properties.Resources.PleaseDownloadUpdater))); Process.Start($"https://github.com/Ryochan7/DS4Updater/releases/download/v{UPDATER_VERSION}/{updaterExe}"); } } - - Process p = new Process(); - p.StartInfo.FileName = exepath + "\\DS4Updater.exe"; - p.StartInfo.Arguments = "-autolaunch"; - if (AdminNeeded()) - p.StartInfo.Verb = "runas"; - - try { p.Start(); Close(); } - catch { } } else File.Delete(appdatapath + "\\version.txt");