@@ -20,6 +20,7 @@ public partial class MainWindow : Window
2020 public static bool ModsOpened = false ;
2121 public static bool ModsLoading = false ;
2222 public static string GameVersion ;
23+ public static string GameVersionDetected ; // the real game version detected from the game
2324 public static string GameVersionOverride ;
2425 public TaskCompletionSource < bool > VersionLoadStatus = new TaskCompletionSource < bool > ( ) ;
2526 public static string [ ] serverList = { "国际源@BeatMods" , "国内源@WGzeyu" , "包子源@BeatTop" } ;
@@ -129,6 +130,7 @@ private async void LoadVersionsAsync()
129130 Dictionary < string , string [ ] > aliases = JsonSerializer . Deserialize < Dictionary < string , string [ ] > > ( body ) ;
130131
131132 string version = Utils . GetVersion ( ) ;
133+ GameVersionDetected = version ;
132134 if ( ! versions . Contains ( version ) && CheckAliases ( versions , aliases , version ) == string . Empty )
133135 {
134136 versions . Insert ( 0 , version ) ;
@@ -281,7 +283,22 @@ private void OptionsButton_Click(object sender, RoutedEventArgs e)
281283
282284 private void InstallButton_Click ( object sender , RoutedEventArgs e )
283285 {
284- Mods . Instance . InstallMods ( ) ;
286+ if ( string . IsNullOrEmpty ( GameVersionOverride ) // game version not listed in aliases at all
287+ && GameVersion != GameVersionDetected ) // and the user manually selected a version
288+ {
289+ // show a waring about the version mismatch
290+ var result = MessageBox . Show ( String . Format ( ( string ) Application . Current . FindResource ( "MainWindow:GameVersionMismatch" ) , GameVersion , GameVersionDetected ) ,
291+ ( string ) Application . Current . FindResource ( "MainWindow:GameVersionMismatchTitle" ) , MessageBoxButton . OKCancel ) ;
292+
293+ if ( result == MessageBoxResult . OK )
294+ {
295+ Mods . Instance . InstallMods ( ) ;
296+ }
297+ }
298+ else
299+ {
300+ Mods . Instance . InstallMods ( ) ;
301+ }
285302 }
286303
287304 private void InfoButton_Click ( object sender , RoutedEventArgs e )
0 commit comments