private bool isListUsed(string listName, string suffix, out bool stopProcess) { string currentProgram = "", originPath = "", programName = "", destinationPath = ""; string[] TRPrograms = ReactionProgram.GetAllPrograms(); string[] StroopPrograms = StroopProgram.GetAllPrograms(); string[] MatchingPrograms = MatchingProgram.GetAllPrograms(); try { foreach (string file in TRPrograms) { originPath = ReactionProgram.GetProgramsPath(); destinationPath = FileManipulation.ReactionTestFilesBackupPath; programName = Path.GetFileNameWithoutExtension(file); currentProgram = Path.GetFileNameWithoutExtension(file) + " (" + LocRM.GetString("reactionTest", currentCulture) + ")"; ReactionProgram program = new ReactionProgram(); program.readProgramFile(file); if (suffix == "_image" && program.getImageListFile() != null && program.getImageListFile().ListName == listName) { stopProcess = false; return(true); } else if (suffix == "_audio" && program.getAudioListFile() != null && program.getAudioListFile().ListName == listName) { stopProcess = false; return(true); } else if (suffix == "_words_color") { if (program.getWordListFile() != null && ((program.getWordListFile().ListName + "_words") == listName)) { stopProcess = false; return(true); } else if (program.getColorListFile() != null && ((program.getColorListFile().ListName + "_color") == listName)) { stopProcess = false; return(true); } } } foreach (string file in StroopPrograms) { originPath = StroopProgram.GetProgramsPath(); destinationPath = FileManipulation.StroopTestFilesBackupPath; programName = Path.GetFileNameWithoutExtension(file); StroopProgram program = new StroopProgram(); currentProgram = Path.GetFileNameWithoutExtension(file) + " (" + LocRM.GetString("stroopTest", currentCulture) + ")"; program.readProgramFile(programName); if (suffix == "_image" && program.getImageListFile() != null && program.getImageListFile().ListName == listName) { stopProcess = false; return(true); } else if (suffix == "_audio" && program.getAudioListFile() != null && program.getAudioListFile().ListName == listName) { stopProcess = false; return(true); } else if (suffix == "_words_color") { if (program.getWordListFile() != null && ((program.getWordListFile().ListName + "_words") == listName)) { stopProcess = false; return(true); } else if (program.getColorListFile() != null && ((program.getColorListFile().ListName + "_color") == listName)) { stopProcess = false; return(true); } } } foreach (string file in MatchingPrograms) { originPath = MatchingProgram.GetProgramsPath(); destinationPath = FileManipulation._matchingTestFilesBackupPath; programName = Path.GetFileNameWithoutExtension(file); MatchingProgram program = new MatchingProgram(); currentProgram = Path.GetFileNameWithoutExtension(file) + " (" + LocRM.GetString("matchingTest", currentCulture) + ")"; program.configureReadProgram(file); if (suffix == "_image" && program.getImageListFile() != null && program.getImageListFile().ListName == listName) { stopProcess = false; return(true); } else if (suffix == "_audio" && program.getAudioListFile() != null && program.getAudioListFile().ListName == listName) { stopProcess = false; return(true); } else if (suffix == "_words_color") { if (program.getWordListFile() != null && ((program.getWordListFile().ListName + "_words") == listName)) { stopProcess = false; return(true); } else if (program.getColorListFile() != null && ((program.getColorListFile().ListName + "_color") == listName)) { stopProcess = false; return(true); } } } } catch (FileNotFoundException e) { DialogResult dialogResult = MessageBox.Show(LocRM.GetString("wanstPossibleToRecoverLists", currentCulture) + "\"" + currentProgram + "\"" + LocRM.GetString("hasMissingLists", currentCulture) + e.Message + "\"" + LocRM.GetString("missingListSolution", currentCulture), LocRM.GetString("error", currentCulture), MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { DialogResult shouldDelete = MessageBox.Show(LocRM.GetString("deleteProgram", currentCulture) + currentProgram + "?", LocRM.GetString("delete", currentCulture), MessageBoxButtons.YesNo); if (shouldDelete == DialogResult.Yes) { try { File.Move(originPath + programName + ".prg", destinationPath + programName + ".prg"); } catch (IOException) { File.Delete(destinationPath + programName + ".prg"); File.Move(originPath + programName + ".prg", destinationPath + programName + ".prg"); } MessageBox.Show(LocRM.GetString("deletedSucessful", currentCulture)); this.Parent.Controls.Remove(this); ListManagment newListManagment = new ListManagment(suffix, mode); FileManipulation.GlobalFormMain._contentPanel.Controls.Add(newListManagment); stopProcess = true; return(false); } else { MessageBox.Show(LocRM.GetString("FilesNotDeleted", currentCulture)); this.Parent.Controls.Remove(this); stopProcess = true; return(false); } } else { this.Parent.Controls.Remove(this); stopProcess = true; return(false); } } stopProcess = false; return(false); }