Пример #1
0
        private static bool InteractiveConsole(CommandHub cmdHub)
        {
            var stdio = CmdConsole.StdIO;

            stdio.Write("(Press [Enter] to start interactive interface)\n", Color32.FromConsoleColor(ConsoleColor.Green));
            var sw   = Stopwatch.StartNew();
            var line = stdio.ReadLine();

            sw.Stop();
            if (line == null)
            {
                Logging.warning("Read an EOF from stdin");
                if (sw.ElapsedMilliseconds < 50)
                {
                    Logging.warning("...within 50 ms. Keep running without interactive interface.");
                    Logging.warning("Please use --no-cli option if the program do not run from a console.");
                    return(false);
                }
                Logging.warning("...exiting...");
            }
            else
            {
                cmdHub.CmdLoop(CmdConsole.StdIO);
            }
            return(true);
        }