mirror of
https://github.com/babalae/better-genshin-impact
synced 2025-01-08 11:57:53 +08:00
fix install path get
This commit is contained in:
parent
1214ca2d65
commit
c9634abebb
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using BetterGenshinImpact.GameTask.Common;
|
using BetterGenshinImpact.GameTask.Common;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
@ -17,19 +18,19 @@ public class RegistryGameLocator
|
|||||||
var cn = Registry.GetValue($@"HKEY_CURRENT_USER\Software\miHoYo\HYP\1_1\hk4e_cn", "GameInstallPath", null) as string;
|
var cn = Registry.GetValue($@"HKEY_CURRENT_USER\Software\miHoYo\HYP\1_1\hk4e_cn", "GameInstallPath", null) as string;
|
||||||
if (!string.IsNullOrEmpty(cn))
|
if (!string.IsNullOrEmpty(cn))
|
||||||
{
|
{
|
||||||
return cn;
|
return Path.Combine(cn, "YuanShen.exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
var global = Registry.GetValue($@"HKEY_CURRENT_USER\Software\Cognosphere\HYP\1_0\hk4e_global", "GameInstallPath", null) as string;
|
var global = Registry.GetValue($@"HKEY_CURRENT_USER\Software\Cognosphere\HYP\1_0\hk4e_global", "GameInstallPath", null) as string;
|
||||||
if (!string.IsNullOrEmpty(global))
|
if (!string.IsNullOrEmpty(global))
|
||||||
{
|
{
|
||||||
return global;
|
return Path.Combine(global, "GenshinImpact.exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
var bilibili = Registry.GetValue($@"HKEY_CURRENT_USER\Software\miHoYo\HYP\standalone\14_0\hk4e_bilibili\BilibiliGenshin\hk4e_bilibili", "GameInstallPath", null) as string;
|
var bilibili = Registry.GetValue($@"HKEY_CURRENT_USER\Software\miHoYo\HYP\standalone\14_0\hk4e_cn\umfgRO5gh5\hk4e_cn", "GameInstallPath", null) as string;
|
||||||
if (!string.IsNullOrEmpty(bilibili))
|
if (!string.IsNullOrEmpty(bilibili))
|
||||||
{
|
{
|
||||||
return bilibili;
|
return Path.Combine(bilibili, "YuanShen.exe");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -337,17 +337,17 @@ public partial class HomePageViewModel : ObservableObject, INavigationAware, IVi
|
|||||||
{
|
{
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
var p1 = RegistryGameLocator.GetDefaultGameInstallPath();
|
var p1 = await UnityLogGameLocator.LocateSingleGamePathAsync();
|
||||||
if (!string.IsNullOrEmpty(p1))
|
if (!string.IsNullOrEmpty(p1))
|
||||||
{
|
{
|
||||||
Config.GenshinStartConfig.InstallPath = p1;
|
Config.GenshinStartConfig.InstallPath = p1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var path = await UnityLogGameLocator.LocateSingleGamePathAsync();
|
var p2 = RegistryGameLocator.GetDefaultGameInstallPath();
|
||||||
if (!string.IsNullOrEmpty(path))
|
if (!string.IsNullOrEmpty(p2))
|
||||||
{
|
{
|
||||||
Config.GenshinStartConfig.InstallPath = path;
|
Config.GenshinStartConfig.InstallPath = p2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user