diff --git a/GenshinLyreMidiPlayer.WPF/GenshinLyreMidiPlayer.WPF.csproj b/GenshinLyreMidiPlayer.WPF/GenshinLyreMidiPlayer.WPF.csproj
index 808c9b8..d5e8dc0 100644
--- a/GenshinLyreMidiPlayer.WPF/GenshinLyreMidiPlayer.WPF.csproj
+++ b/GenshinLyreMidiPlayer.WPF/GenshinLyreMidiPlayer.WPF.csproj
@@ -6,7 +6,7 @@
true
GenshinLyreMidiPlayer.WPF.App
app.manifest
- 4.0.0
+ 4.0.1
item_windsong_lyre.ico
enable
https://github.com/sabihoshi/GenshinLyreMidiPlayer
diff --git a/GenshinLyreMidiPlayer.WPF/ViewModels/MainWindowViewModel.cs b/GenshinLyreMidiPlayer.WPF/ViewModels/MainWindowViewModel.cs
index 938a0de..89de7d4 100644
--- a/GenshinLyreMidiPlayer.WPF/ViewModels/MainWindowViewModel.cs
+++ b/GenshinLyreMidiPlayer.WPF/ViewModels/MainWindowViewModel.cs
@@ -89,7 +89,7 @@ protected override async void OnViewLoaded()
Navigation = ((MainWindowView) View).RootNavigation;
_theme.SetTheme(_theme.GetSystemTheme());
- if (!SettingsView.TryGetLocation()) _ = SettingsView.LocationMissing();
+ if (!await SettingsView.TryGetLocationAsync()) _ = SettingsView.LocationMissing();
if (SettingsView.AutoCheckUpdates)
{
_ = SettingsView.CheckForUpdate()
diff --git a/GenshinLyreMidiPlayer.WPF/ViewModels/SettingsPageViewModel.cs b/GenshinLyreMidiPlayer.WPF/ViewModels/SettingsPageViewModel.cs
index 9031a91..5e3d913 100644
--- a/GenshinLyreMidiPlayer.WPF/ViewModels/SettingsPageViewModel.cs
+++ b/GenshinLyreMidiPlayer.WPF/ViewModels/SettingsPageViewModel.cs
@@ -193,7 +193,7 @@ public static string GenshinLocation
private PlaylistViewModel Playlist => _main.PlaylistView;
- public bool TryGetLocation()
+ public async Task TryGetLocationAsync()
{
var locations = new[]
{
@@ -213,7 +213,13 @@ public bool TryGetLocation()
AppContext.BaseDirectory + "YuanShen.exe"
};
- return locations.Any(TrySetLocation);
+ foreach (var location in locations)
+ {
+ if (await TrySetLocationAsync(location))
+ return true;
+ }
+
+ return false;
}
public async Task CheckForUpdate()
@@ -247,10 +253,10 @@ public async Task LocationMissing()
var dialog = new ContentDialog
{
Title = "Error",
- Content = "Could not find Game's Location",
+ Content = "Could not find Game's Location, please find GenshinImpact.exe or YuanShen.exe",
PrimaryButtonText = "Find Manually...",
- SecondaryButtonText = "Ignore",
+ SecondaryButtonText = "Ignore (Notes might not play)",
CloseButtonText = "Exit"
};
@@ -279,12 +285,12 @@ public async Task SetLocation()
{
Filter = "Executable|*.exe|All files (*.*)|*.*",
InitialDirectory = WindowHelper.InstallLocation is null
- ? string.Empty
+ ? @"C:\Program Files\Genshin Impact\Genshin Impact Game\"
: Path.Combine(WindowHelper.InstallLocation, "Genshin Impact Game")
};
var success = openFileDialog.ShowDialog() == true;
- var set = TrySetLocation(openFileDialog.FileName);
+ var set = await TrySetLocationAsync(openFileDialog.FileName);
if (!(success && set)) await LocationMissing();
}
@@ -332,9 +338,22 @@ protected override void OnActivate()
_ = CheckForUpdate();
}
- private bool TrySetLocation(string? location)
+ private async Task TrySetLocationAsync(string? location)
{
if (!File.Exists(location)) return false;
+ if (Path.GetFileName(location).Equals("launcher.exe", StringComparison.OrdinalIgnoreCase))
+ {
+ var dialog = new ContentDialog
+ {
+ Title = "Incorrect Location",
+ Content = "launcher.exe is not the game, please find GenshinImpact.exe",
+
+ CloseButtonText = "Ok"
+ };
+
+ await dialog.ShowAsync();
+ return false;
+ }
Settings.GenshinLocation = location;
NotifyOfPropertyChange(() => Settings.GenshinLocation);