private void Play_Mods_Click(object sender, RoutedEventArgs e) { var settings = Shrek2MM.LoadSettings(); if (settings == null || string.IsNullOrWhiteSpace(settings.GameFolderPath)) { MessageBox.Show("Unable to 'Play' yet as you have not set up Settings correctly yet. Please ensure your Game Folder is selected before proceeding!"); return; } if (ModItems == null || ModItems.Count <= 0) { MessageBox.Show("You currently have no added mods in the Shrek 2 Mod Manager so you cannot 'Play' yet."); return; } if (ModItems.Any(p => p.IsActive) == false) { MessageBox.Show("You have no Enabled Mods in the Shrek 2 Mod Manager. Ensure atleast 1 mod is enabled before proceeding."); return; } var installed = Shrek2MM.InstallModLoader(settings.GameFolderPath); if (installed == false) { MessageBox.Show("Failed to install Mod Loader into the selected Game Folder you chose in Settings. This could be a Read/write Permission issue. Check the error_log in 'Documents/Shrek 2 Mod Manager' for more details."); return; } if (Shrek2MM.ReinstallMods(settings.GameFolderPath, ModItems.Where(p => p.IsActive).ToList()) == false) { MessageBox.Show("Failed to install the enabled mods. This could be a Read/write Permission issue. Check the error_log in 'Documents/Shrek 2 Mod Manager' for more details."); return; } if (Shrek2MM.UpdateDefUserFile(settings.GameFolderPath, ModItems.Where(p => p.IsActive).ToList()) == false) { MessageBox.Show("Failed to update DefUser.ini file, this could be a Read/write Permission issue. Check the error_log in 'Documents/Shrek 2 Mod Manager' for more details."); return; } GameProcess = Process.Start(Shrek2Utils.GetModdedGameExeFilePath(settings.GameFolderPath), settings.DisplayMode == 0 ? "-windowed" : ""); GameProcess.EnableRaisingEvents = true; Play_Button.IsEnabled = false; Play_Button.Content = "Running"; GameProcess.Exited += (sender, e) => { Dispatcher.Invoke(() => { Play_Button.IsEnabled = true; Play_Button.Content = "Play"; }); }; }