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,14 +792,8 @@ 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");
else
{
this.BeginInvoke((System.Action)(() => MessageBox.Show(Properties.Resources.PleaseDownloadUpdater)));
Process.Start($"https://github.com/Ryochan7/DS4Updater/releases/download/v{UPDATER_VERSION}/{updaterExe}");
}
}
wc2.DownloadFile(url2, exepath + "\\DS4Updater.exe");
Process p = new Process();
p.StartInfo.FileName = exepath + "\\DS4Updater.exe";
p.StartInfo.Arguments = "-autolaunch";
@ -809,6 +803,13 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
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}");
}
}
}
else
File.Delete(appdatapath + "\\version.txt");
}