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));
}