private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //TODO: Use e.Cancel, asking user if they wanna save changes and all that //Even if the user decides not to save the params, always save the config: PARAMDATA.SaveConfig(); }
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); } } }