private async void MetroWindow_Loaded(object sender, RoutedEventArgs e) { PARAMDATA.LoadConfig(); if (!string.IsNullOrWhiteSpace(PARAMDATA.Config?.InterrootPath) && CheckInterrotDirValid(PARAMDATA.Config?.InterrootPath)) { await PARAMDATA.LoadParamsInOtherThread(SetLoadingMode); } else { if (MessageBox.Show("If you are using non-remastered Dark Souls: Prepare to Die Edition, your installation " + "MUST be unpacked by UnpackDarkSoulsForModding by HotPocketRemix.\n\n" + @"Please navigate to your 'DARKSOULS.exe' or 'DarkSoulsRemastered.exe' file." + "\n\nOnce the inital setup is performed, the path will be saved." + "\nYou may press cancel to continue without selecting the path but the GUI will " + "be blank until you go to 'File -> Select Dark Souls Directory...'", "Initial Setup", MessageBoxButton.OKCancel, MessageBoxImage.Information) == MessageBoxResult.OK) { await BrowseForInterrootDialog(SetLoadingMode); } } MainTabs.Items.Refresh(); //RANDOM_DEBUG_TESTING(); }
private async Task BrowseForInterrootDialog(Action <bool> setIsLoading) { var browseDialog = new OpenFileDialog() { AddExtension = false, CheckFileExists = true, CheckPathExists = true, Multiselect = false, FileName = "DARKSOULS.exe", Filter = "Executable Files (*.EXE)|*.EXE", ShowReadOnly = false, Title = "Choose your DARKSOULS.exe or DarkSoulsRemastered.exe file...", ValidateNames = true }; if ((browseDialog.ShowDialog() ?? false) == true) { var interrootDir = new FileInfo(browseDialog.FileName).DirectoryName; if (CheckInterrotDirValid(interrootDir)) { PARAMDATA.Config.InterrootPath = interrootDir; PARAMDATA.SaveConfig(); await PARAMDATA.LoadParamsInOtherThread(setIsLoading); } else { var sb = new StringBuilder(); sb.AppendLine(@"Directory of EXE chosen did not include the following directories/files which are required:"); sb.AppendLine(@" - '.\param\DrawParam\'"); sb.AppendLine(@" - '.\param\GameParam\'"); sb.AppendLine(@" - '.\paramdef\'"); if (CheckIfUdsfmIsProbablyNotInstalled(interrootDir)) { sb.AppendLine(); sb.AppendLine(); sb.AppendLine("Warning: This installation does not appear to be unpacked with " + "UnpackDarkSoulsForModding because it meets one or more of the " + "criteria below:"); sb.AppendLine(@" - '.\unpackDS-backup' does not exist."); sb.AppendLine(@" - '.\dvdbnd0.bdt' exists."); sb.AppendLine(@" - '.\dvdbnd1.bdt' exists."); sb.AppendLine(@" - '.\dvdbnd2.bdt' exists."); sb.AppendLine(@" - '.\dvdbnd3.bdt' exists."); sb.AppendLine(@" - '.\dvdbnd0.bhd5' exists."); sb.AppendLine(@" - '.\dvdbnd1.bhd5' exists."); sb.AppendLine(@" - '.\dvdbnd2.bhd5' exists."); sb.AppendLine(@" - '.\dvdbnd3.bhd5' exists."); } MessageBox.Show( sb.ToString(), "Invalid Directory", MessageBoxButton.OK, MessageBoxImage.Error); } } }