diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/Account/RegistryInterop.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/Account/RegistryInterop.cs index 513fb4a2..636aa7b2 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Game/Account/RegistryInterop.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/Account/RegistryInterop.cs @@ -40,10 +40,7 @@ internal static class RegistryInterop string base64 = Convert.ToBase64String(target); string path = $"HKCU:{GenshinPath}"; - string command = $""" - $value = [Convert]::FromBase64String('{base64}'); - Set-ItemProperty -Path '{path}' -Name '{SdkChineseKey}' -Value $value -Force; - """; + string command = $"-Command \"$value = [Convert]::FromBase64String('{base64}'); Set-ItemProperty -Path '{path}' -Name '{SdkChineseKey}' -Value $value -Force;\""; ProcessStartInfo startInfo = new() { diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs index 9fac23ba..59c5ba89 100644 --- a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs @@ -254,6 +254,7 @@ internal sealed partial class LaunchGameViewModel : Abstraction.ViewModel } else { + await taskContext.SwitchToMainThreadAsync(); GamePathEntries = launchOptions.GetGamePathEntries(out GamePathEntry? entry); UpdateSelectedGamePathEntry(entry, false); }