diff --git a/SA-Mod-Manager/UI/MainWindow.xaml.cs b/SA-Mod-Manager/UI/MainWindow.xaml.cs index e47c3833..0360dc0f 100644 --- a/SA-Mod-Manager/UI/MainWindow.xaml.cs +++ b/SA-Mod-Manager/UI/MainWindow.xaml.cs @@ -49,7 +49,6 @@ public partial class MainWindow : Window string codexmlpath = string.Empty; string codedatpath = string.Empty; string patchdatpath = string.Empty; - private static bool gameMissingFlag = false; // Shared Variables CodeList mainCodes = null; @@ -109,7 +108,7 @@ private async void MainWindowManager_Loaded(object sender, RoutedEventArgs e) new SplashScreenDialog().ShowDialog(); } - + Load(); SetBindings(); //theme is set here @@ -152,6 +151,7 @@ private async void MainWindowManager_Loaded(object sender, RoutedEventArgs e) { UpdateManagerStatusText(Lang.GetString("UpdateStatus.ChkUpdate")); await App.PerformUpdateLoaderCheck(); + Refresh(); } if (App.CurrentGame.id == GameEntry.GameType.SADX) @@ -198,7 +198,7 @@ private void SaveAndPlayButton_Click(object sender, RoutedEventArgs e) Save(); Refresh(); - + if (App.CurrentGame.id == GameEntry.GameType.Unsupported || ModDependency.CheckDependencies(EnabledMods, mods)) return; @@ -1102,7 +1102,7 @@ private async Task ResultPickGame(string path) UIHelper.ToggleButton(ref btnOpenGameDir, true); suppressEvent = true; - + if (DoGameSwap((Game)game, path)) { ComboGameSelection.SelectedValue = App.CurrentGame; @@ -1188,6 +1188,7 @@ private async void btnInstallLoader_Click(object sender, RoutedEventArgs e) await HandleLoaderInstall(); UpdateButtonsState(); btnBrowseGameDir.IsEnabled = true; + Refresh(); Save(); } @@ -1310,7 +1311,7 @@ private void comboProfile_SelectionChanged(object sender, SelectionChangedEventA { LoadGameSettings(); SetBindings(); - SetGameUI(); + SetGameUI(); Refresh(); Save(); } @@ -1478,6 +1479,7 @@ private void UpdateManagerInfo() } App.CurrentGame.loader.installed = File.Exists(App.CurrentGame.loader.dataDllOriginPath) && File.Exists(App.CurrentGame.loader.loaderdllpath); + MigrateLoaderDLL(); UpdateButtonsState(); } @@ -2035,7 +2037,7 @@ private void LoadModList() } LoadCodes(); - // DataContext = ViewModel; + // DataContext = ViewModel; ConfigureModBtn_UpdateState(); } @@ -2430,7 +2432,7 @@ public void Refresh() ComboGameSelection.SelectedValue = App.GamesList.FirstOrDefault(); return; } - + InitCodes(); LoadModList(); @@ -2610,6 +2612,25 @@ private void UpdateDLLData() } } + //todo delete next update + private void MigrateLoaderDLL() + { + try + { + string oldLoaderPath = Path.Combine(App.CurrentGame.modDirectory, App.CurrentGame.loader.name + ".dll"); + if (App.CurrentGame.loader.installed == false && File.Exists(App.CurrentGame.loader.dataDllOriginPath) && File.Exists(oldLoaderPath)) + { + if (!File.Exists(App.CurrentGame.loader.loaderdllpath)) + { + //this will fire the mod loader update and it will download the rest + File.Copy(oldLoaderPath, App.CurrentGame.loader.loaderdllpath); + } + + } + } + catch { } + } + private async Task InstallLoader() { bool dataDllOrigExist = File.Exists(App.CurrentGame.loader.dataDllOriginPath); @@ -2723,6 +2744,7 @@ private async Task HandleLoaderInstall() App.CurrentGame.loader.installed = !App.CurrentGame.loader.installed; UIHelper.EnableButton(ref btnInstallLoader); UpdateBtnInstallLoader_State(); + } #endregion @@ -2890,7 +2912,7 @@ private async void ComboGameSelection_SelectionChanged(object sender, SelectionC suppressEvent = false; return; } - + Game entry = ComboGameSelection.SelectedItem as Game; if (entry == GamesInstall.AddGame)