コード例 #1
0
        static void doCommand(PythonSampleConsole test)
        {
            bool running = true;

            printHelp();
            while (running)
            {
                string[] temp = Console.ReadLine().Split();
                if (temp == null || temp.Length < 0 || temp[0].Trim().Length <= 0)
                {
                    continue;
                }
                string command = temp[0].Trim();

                if ("quit".Equals(command.ToLower()))
                {
                    running = false;
                }
                else if ("stop".Equals(command.ToLower()))
                {
                    test.Stop();
                }
                else if ("help".Equals(command.ToLower()))
                {
                    printHelp();
                }
                else if ("push".Equals(command.ToLower()) && temp.Length > 0)
                {
                    test.PushMsg(temp[1].Trim());
                }
            }
            ;
        }
コード例 #2
0
        private static void Main(string[] args)
        {
            PythonSampleConsole test = new PythonSampleConsole();

            test.Start();

            doCommand(test);

            test.Stop();
        }