0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-12 17:30:42 -05:00
Co-authored-by: IsWaffle <waffle.lord@noreply.dev.sp-tarkov.com>
Co-authored-by: Dev <dev@dev.sp-tarkov.com>
Reviewed-on: SPT-AKI/Launcher#35
This commit is contained in:
chomp 2023-12-20 16:59:14 +00:00
parent 1112795fcd
commit 7eaff0da37
2 changed files with 19 additions and 12 deletions

View File

@ -49,10 +49,10 @@ namespace Aki.Launcher
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return null;
var uninstallStringValue = Registry.LocalMachine.OpenSubKey(registryInstall, false)
?.GetValue("UninstallString");
var info = (uninstallStringValue is string key) ? new FileInfo(key) : null;
return info?.DirectoryName;
var installLocation = Registry.LocalMachine.OpenSubKey(registryInstall, false)
?.GetValue("InstallLocation");
var info = (installLocation is string key) ? new DirectoryInfo(key) : null;
return info?.FullName;
}
public async Task<GameStarterResult> LaunchGame(ServerInfo server, AccountInfo account, string gamePath)

View File

@ -9,8 +9,8 @@
using System;
using System.IO;
using System.Reflection.Metadata.Ecma335;
using Aki.ByteBanger;
using Aki.Launcher.Controllers;
using Aki.Launcher.MiniCommon;
using Aki.Launcher.Models.Launcher;
@ -115,14 +115,21 @@ namespace Aki.Launcher.Helpers
var target = Path.ChangeExtension(file.FullName, null);
// remove patched file
var patched = new FileInfo(target);
patched.IsReadOnly = false;
patched.Delete();
try
{
var patched = new FileInfo(target);
patched.IsReadOnly = false;
patched.Delete();
// restore from backup
File.Copy(file.FullName, target);
file.IsReadOnly = false;
file.Delete();
// Restore from backup
File.Copy(file.FullName, target);
file.IsReadOnly = false;
file.Delete();
}
catch (Exception ex)
{
LogManager.Instance.Exception(ex);
}
}
}
}