示例#1
0
        public static void Run()
        {
            CommandInterface.PrintHelp();

            String chainWrittedByUser = null;
            bool   continueFlag       = true;

            while (continueFlag)
            {
                chainWrittedByUser = System.Console.ReadLine();

                if (!int.TryParse(chainWrittedByUser.ToLower(), out int op))
                {
                    op = -1;
                }
                Func <bool> command = null;
                if (!commandCast.TryGetValue((CommandInterfaceEnum)op, out command))
                {
                    Console.WriteLine("You´re dump!!!!");
                    continueFlag = true;
                    continue;
                }
                continueFlag = command();

                //System.Console.Clear();
                CommandInterface.PrintHelp();
            }
        }
示例#2
0
 static void Main(string[] args)
 {
     try
     {
         CommandInterface.Run();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         Console.ReadLine();
         CommandInterface.Run();
     }
 }