InputError() public method

Writes an input error message to the console.
public InputError ( ) : void
return void
Exemplo n.º 1
0
        public static int Main(string[] args)
        {
            Console.CancelKeyPress += new ConsoleCancelEventHandler(ConsoleCancelKeyPress);

            options   = InputOptions.Create(args);
            logger    = new ConsoleLogger(options);
            isRunning = true;

            if (options.IsValid)
            {
                if (!options.Help)
                {
                    if (options.ParentProcessId > 0)
                    {
                        Process parentProcess = Process.GetProcessById(options.ParentProcessId);

                        if (parentProcess != null)
                        {
                            logger.Debug("Parent process was found with ID {0}. Subscribing to 'Exited' event.", options.ParentProcessId);
                            parentProcess.Exited += new EventHandler(ParentProcessExited);
                            parentProcess.EnableRaisingEvents = true;
                        }
                        else
                        {
                            logger.Debug("No parent process was found with ID {0}.", options.ParentProcessId);
                        }
                    }

                    Console.WriteLine();
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("Type 'exit' to shutdown gracefully, or Ctl+C to exit immediately.");
                    Console.ResetColor();
                    Console.WriteLine();

                    inputThread = new Thread(WaitForInput);
                    inputThread.Start();

                    PullupBootstraps();
                }
                else
                {
                    logger.Help();
                }
            }
            else
            {
                logger.InputError();
                return(1);
            }

            return(0);
        }
Exemplo n.º 2
0
        public static int Main(string[] args)
        {
            Console.CancelKeyPress += new ConsoleCancelEventHandler(ConsoleCancelKeyPress);

            options = InputOptions.Create(args);
            logger = new ConsoleLogger(options);
            isRunning = true;

            if (options.IsValid)
            {
                if (!options.Help)
                {
                    if (options.ParentProcessId > 0)
                    {
                        Process parentProcess = Process.GetProcessById(options.ParentProcessId);

                        if (parentProcess != null)
                        {
                            logger.Debug("Parent process was found with ID {0}. Subscribing to 'Exited' event.", options.ParentProcessId);
                            parentProcess.Exited += new EventHandler(ParentProcessExited);
                            parentProcess.EnableRaisingEvents = true;
                        }
                        else
                        {
                            logger.Debug("No parent process was found with ID {0}.", options.ParentProcessId);
                        }
                    }

                    Console.WriteLine();
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("Type 'exit' to shutdown gracefully, or Ctl+C to exit immediately.");
                    Console.ResetColor();
                    Console.WriteLine();

                    inputThread = new Thread(WaitForInput);
                    inputThread.Start();

                    PullupBootstraps();
                }
                else
                {
                    logger.Help();
                }
            }
            else
            {
                logger.InputError();
                return 1;
            }

            return 0;
        }