Пример #1
0
        static public void Listen()
        {
            Console.WriteLine("Hello World!\nUse exit to quit listening commands.\n");
            Console.WriteLine("---------------------------------------------------");
            while (true)
            {
                string  i = Console.ReadLine();
                Command c = new Command(i);



                if (c.commandString == exitor)//the way to stop commanding
                {
                    break;
                }
                try
                {
                    c.Excute();//Excute the command inputed
                }
                catch (Exception e)
                {
                    Console.WriteLine("An error called:\n" + e.Message + "\nhas occured when excuting the command.\nFailed to excute it.\n");
                    Console.WriteLine("---------------------------------------------------");
                    continue;
                }


                //Console.WriteLine("Excuted the command :{0}\n", c.commandString);
                Console.WriteLine("---------------------------------------------------");
            }
        }