private WindowsService(bool interactive, IServiceWrapper wrapper, ILogger logger, ICommandLineParser parser, IConsoleHarness console, IAssembly assembly, ServiceAttributeReader reader, WindowsServiceManager manager, HostFactory hostFactory) { Logger = logger; _metadata = reader.GetMetadata(this); _interactive = interactive; _assembly = assembly; Console = console; _manager = manager; _manager.SetMetadata(_metadata); _hostFactory = hostFactory; CommandLineParser = parser .SetApplicationName(reader.GetAttribute(this).DisplayName) .SetDescription(reader.GetAttribute(this).Description) .AddOption("quiet", "q", "Enable quiet mode. Will display only errors on the console.", noArgs => _metadata.Quiet = true) .AddOption("silent", "si", "Enable silent mode. Will display nothing (not even errors) on the console.", noArgs => _metadata.Silent = true) .AddOption("logtoconsole", "l", "Instructs the installer/uninstaller to log the output to the console.", noArgs => _manager.LogToConsole = true) .AddOption("debug", "d", "Pauses to attach a debugger.", noArgs => EnableDebugMode()) .AddOption("uninstall", "u", "Uninstalls the service.", noArgs => _manager.Uninstall()) .AddOption("install", "i", "Installs the service.", noArgs => _manager.Install()) .AddOption("installandstart", "is", "Installs and then starts the service.", noArgs => _manager.InstallAndStart()) .AddOption("start", "s", "Starts the service.", noArgs => _manager.StartService()) .AddOption("stop", "x", "Stops the service.", noArgs => _manager.StopService()) .AddOption("status", "st", "Displays the status of the service.", noArgs => _manager.ShowStatus()); Harness = wrapper.WrapService(this); }
private WindowsService(bool interactive, IServiceWrapper wrapper, ILogger logger, IConsoleHarness console, IAssembly assembly, ServiceAttributeReader reader, HostFactory factory) : this(interactive, wrapper, logger, new Parser(Strings.DEBUG_Cush, string.Empty, true, console, assembly), console, assembly, reader, WindowsServiceManager.GetInstance(console), factory) { }