Skip updater execution if new version could not be downloaded

Related to issue #638
This commit is contained in:
Travis Nickles 2019-03-30 08:08:21 -05:00
parent 9bf4499007
commit 592a0245b7

View File

@ -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}"); Uri url2 = new Uri($"https://github.com/Ryochan7/DS4Updater/releases/download/v{UPDATER_VERSION}/{updaterExe}");
WebClient wc2 = new WebClient(); WebClient wc2 = new WebClient();
if (appdatapath == exepath) if (appdatapath == exepath)
{
wc2.DownloadFile(url2, exepath + "\\DS4Updater.exe"); 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 else
{ {
this.BeginInvoke((System.Action)(() => MessageBox.Show(Properties.Resources.PleaseDownloadUpdater))); this.BeginInvoke((System.Action)(() => MessageBox.Show(Properties.Resources.PleaseDownloadUpdater)));
Process.Start($"https://github.com/Ryochan7/DS4Updater/releases/download/v{UPDATER_VERSION}/{updaterExe}"); 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 else
File.Delete(appdatapath + "\\version.txt"); File.Delete(appdatapath + "\\version.txt");