Пример #1
0
        internal static void Run(ProcessCommandLineArgs args)
        {
            args.Writer.WriteLine("Press Ctrl+C to stop...");
            var autoResetEvent = new AutoResetEvent(false);

            System.Console.CancelKeyPress += (sender, eventArgs) =>
            {
                // cancel the cancellation to allow the program to shutdown cleanly
                eventArgs.Cancel = true;
                autoResetEvent.Set();
            };

            // block until ctrl+c is pressed
            autoResetEvent.WaitOne();
        }
Пример #2
0
        public static int Run()
        {
#if !UNIVERSAL
            EngineInternal.Initialize();
#endif
            var command = new CommandLine(Environment.CommandLine);

            var args = new ProcessCommandLineArgs
            {
                Command  = command,
                Handlers = GetHandlers().ToList(),
            };
            foreach (var handler in args.Handlers)
            {
                if (handler.Process(args))
                {
                    return(0);
                }
            }
            return(-1);
        }
Пример #3
0
 public abstract bool Process(ProcessCommandLineArgs args);
Пример #4
0
 public abstract void GetHelp(ProcessCommandLineArgs args);