Beispiel #1
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
            ConsoleHandler.SetConsoleCtrlHandler(ConsoleHandler.GoodHandler, true);

            var service = new CollectorService();

            if ((args.Length == 5 && args[0] == "-d"))
            {
                service.SaveMessage(args[1], Convert.ToInt32(args[2]), args[3], args[4]);

                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
            }
            else if (Environment.UserInteractive)
            {
                service.StartDaemon();
            }
            else
            {
                ServiceBase.Run(service);
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
            ConsoleHandler.SetConsoleCtrlHandler(ConsoleHandler.GoodHandler, true);

            var service = new CollectorService();

            if ((args.Length == 5 && args[0] == "-d"))
            {
                service.SaveMessage(args[1], Convert.ToInt32(args[2]), args[3], args[4]);

                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
            }
            else if (Environment.UserInteractive)
            {
                service.StartDaemon();
            }
            else
            {
                ServiceBase.Run(service);
            }
        }
Beispiel #3
0
        private static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
            //ConsoleHandler.SetConsoleCtrlHandler(ConsoleHandler.GoodHandler, true);

            if (Environment.UserInteractive || (args.Any() && args[0].Equals("-console")))
            {
                var options = new Options();

                if (CommandLine.Parser.Default.ParseArgumentsStrict(args, options,
                                                                    () =>
                                                                    Console.WriteLine("Bad command line parameters.")))
                {
                    var service = new CollectorService(options.OnlyUsers);
                    service.StartDaemon();
                }
                Console.ReadKey();
            }
            else
            {
                ServiceBase.Run(new CollectorService());
            }
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
            ConsoleHandler.SetConsoleCtrlHandler(ConsoleHandler.GoodHandler, true);

            if (Environment.UserInteractive)
            {
                var options = new Options();

                if (CommandLine.Parser.Default.ParseArgumentsStrict(args, options,
                                                                    () =>
                                                                        Console.WriteLine("Bad command line parameters.")))
                {
                    var service = new CollectorService(options.OnlyUsers);
                    service.StartDaemon();
                }
                Console.ReadKey();
            }
            else
            {
                ServiceBase.Run(new CollectorService());
            }
        }