/// <summary> /// /// </summary> /// <param name="overseer"></param> /// <param name="absolutePath"></param> /// <returns>a list of string of files that ends with proper postfix and supported language</returns> public static string Delegated_GetApplicableFileWithFeedback(FileReadingOverseer overseer, string absolutePath) { List <string> qnotefiles = GetQNoteFiles(absolutePath); string fname = null; List <string> vlangfiles = qnotefiles.Where(s => isSupportedLanguage(getFileLang(s))).Select(s => s).ToList(); // ---------------------File Finding if (qnotefiles.Count == 0) {// no qnote file Instruction i = overseer.onFileNotExist(); if (i == Instruction.RESTART) { return(Delegated_GetApplicableFileWithFeedback(overseer, absolutePath)); } else { return(null); } } if (vlangfiles.Count == 0) { //no qnote file of supported language Instruction i = overseer.onFileLangInvalid(); // TODO: finish this } else if (vlangfiles.Count > 1) { KeyValuePair <Instruction, string> i = overseer.onMultipleFileExist(qnotefiles); switch (i.Key) { case Instruction.RESTART: return(Delegated_GetApplicableFileWithFeedback(overseer, absolutePath)); case Instruction.CHOOSE: fname = i.Value; break; case Instruction.CONTINUE: fname = qnotefiles[0]; break; default: return(null); } } else if (vlangfiles.Count == 1) { fname = vlangfiles[0]; } return(fname); }