BottomShelf.Host.Program.Main C# (CSharp) Method

Main() private static method

private static Main ( string arguments ) : void
arguments string
return void
        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));
        }