public void rShow(string ans, MulChoice lMc) { int num; switch (ans.ToUpper()) { case "A": num = 1; break; case "B": num = 2; break; case "C": num = 3; break; case "D": num = 4; break; default: num = 0; break; } Console.WriteLine(lMc.content); char k = 'A'; for (int i = 1; i <= lMc.options.Count; i++) { if (i == num) { Console.ForegroundColor = ConsoleColor.Blue; Console.Write(k + " "); k++; Console.WriteLine(lMc.options[i - 1].Content); Console.ResetColor(); } else { Console.Write(k + " "); k++; Console.WriteLine(lMc.options[i - 1].Content); } } Console.WriteLine(); }
// end of search question public List <MulChoice> InitMC() { List <MulChoice> MC = new List <MulChoice>(); int i = 0; string[] lines = File.ReadAllLines(this.fileMulChoice); while (i < lines.Length) { string[] sMc = new string[4]; sMc[0] = lines[i++]; sMc[1] = lines[i++]; sMc[2] = lines[i++]; sMc[3] = lines[i++]; MulChoice Mc = ConvertToMc(sMc); MC.Add(Mc); i++; } return(MC); }
public void WShow(string uChoice, option Ans, MulChoice lMc) { uChoice = uChoice.ToUpper(); char userC = uChoice[0]; char aKey = getKey(Ans, lMc.options); Console.WriteLine(lMc.content); char k = 'A'; int j = 0; for (char i = 'A'; i <= 'D'; i++) { if (i == aKey) { Console.ForegroundColor = ConsoleColor.Blue; Console.Write(k + " "); k++; Console.WriteLine(lMc.options[j].Content); Console.ResetColor(); j++; } else if (i == userC) { Console.ForegroundColor = ConsoleColor.Red; Console.Write(k + " "); k++; Console.WriteLine(lMc.options[j].Content); Console.ResetColor(); j++; } else { Console.Write(k + " "); k++; Console.WriteLine(lMc.options[j].Content); j++; } } Console.WriteLine(); }