mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-25 10:46:51 +01:00
Only launch updater copy in elevated mode if required
This commit is contained in:
parent
339846f701
commit
1c320505c6
@ -242,9 +242,9 @@ Properties.Resources.DS4Update, MessageBoxButton.YesNo, MessageBoxImage.Question
|
|||||||
|
|
||||||
private bool RunUpdaterCheck(bool launch)
|
private bool RunUpdaterCheck(bool launch)
|
||||||
{
|
{
|
||||||
if (!File.Exists(Global.exedirpath + "\\DS4Updater.exe") ||
|
bool updaterExists = File.Exists(Global.exedirpath + "\\DS4Updater.exe");
|
||||||
(File.Exists(Global.exedirpath + "\\DS4Updater.exe")
|
if (!updaterExists ||
|
||||||
&& (FileVersionInfo.GetVersionInfo(Global.exedirpath + "\\DS4Updater.exe").FileVersion.CompareTo(MainWindowsViewModel.UPDATER_VERSION) != 0)))
|
(FileVersionInfo.GetVersionInfo(Global.exedirpath + "\\DS4Updater.exe").FileVersion.CompareTo(MainWindowsViewModel.UPDATER_VERSION) != 0))
|
||||||
{
|
{
|
||||||
launch = false;
|
launch = false;
|
||||||
Uri url2 = new Uri($"https://github.com/Ryochan7/DS4Updater/releases/download/v{MainWindowsViewModel.UPDATER_VERSION}/{mainWinVM.updaterExe}");
|
Uri url2 = new Uri($"https://github.com/Ryochan7/DS4Updater/releases/download/v{MainWindowsViewModel.UPDATER_VERSION}/{mainWinVM.updaterExe}");
|
||||||
@ -259,8 +259,15 @@ Properties.Resources.DS4Update, MessageBoxButton.YesNo, MessageBoxImage.Question
|
|||||||
|
|
||||||
if (launch)
|
if (launch)
|
||||||
{
|
{
|
||||||
int copyStatus = Util.ElevatedCopyUpdater(filename);
|
if (Global.AdminNeeded())
|
||||||
if (copyStatus != 0) launch = false;
|
{
|
||||||
|
int copyStatus = Util.ElevatedCopyUpdater(filename);
|
||||||
|
if (copyStatus != 0) launch = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
File.Move(filename, Global.exedirpath + "\\DS4Updater.exe");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user