Inheritance: CommandLine.CommandLineOptionsBase
Ejemplo n.º 1
0
        private static void InstallOrUninstallWindowsServiceIfNecessary(CommandLineParameters parameters)
        {
            if(!parameters.InstallAsWindowService && !parameters.UninstallWindowsService) return;

            try
            {
                ProjectInstaller.Run(parameters);
                Environment.Exit(0);
            }
            catch
            {
                Environment.Exit(1);
            }
        }
Ejemplo n.º 2
0
        public void Start(CommandLineParameters parameters)
        {
            logger.Info("Starting BottomShelf host.");

            var servicesDirectory = Path.GetFullPath(parameters.ServicesDirectory);
            watcher = new FileSystemWatcher(servicesDirectory, parameters.FileSystemPoll);

            hostedServices = new AssemblyScanner().Scan(servicesDirectory);
            hostedServices.ForEach(hs => StartHostedService(hs, watcher));

            watcher.Start();

            logger.Info("Started monitoring changes in '{0}'.", servicesDirectory);
        }
Ejemplo n.º 3
0
        private static void Main(string[] arguments)
        {
            var parser = new CommandLineParser(new CommandLineParserSettings(Console.Error));
            var parameters = new CommandLineParameters();

            if(!parser.ParseArguments(arguments, parameters))
                Environment.Exit(1);

            InstallOrUninstallWindowsServiceIfNecessary(parameters);

            var bottomShelfHost = new BottomShelfHost();

            if(Environment.UserInteractive)
            {
                bottomShelfHost.Start(parameters);
                WaitUntilUserWantsToExit();
                bottomShelfHost.Stop();

                Environment.Exit(0);
            }

            ServiceBase.Run(new BottomShelfService(bottomShelfHost));
        }