Exemplo n.º 1
0
        public char ReadKey(string s)
        {
            char key    = ' ';
            bool parsed = false;

            writer.Write(s);
            while (!parsed)
            {
                s = ReadString();
                Exception exception = parser.ParseKey(s, out key);
                if (exception == null)
                {
                    parsed = true;
                }
                else
                {
                    writer.Write(exception.Message);
                }
            }
            return(key);
        }
Exemplo n.º 2
0
        public char ReadKey(string s)
        {
            bool parsed = false;

            writer.Write(s);
            char key = ' ';

            while (!parsed)
            {
                s = Console.ReadLine();
                Exception exception = parser.ParseKey(s, out key);
                if (exception == null)
                {
                    parsed = true;
                }
                else
                {
                    writer.Write(exception.Message + " Try again: ");
                }
            }
            return(key);
        }