Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 internal static WindowsServiceManager GetInstance(
     IConsoleHarness harness,
     IAssembly assembly,
     ManagedInstallerProxy installerProxy)
 {
     return new Implementation(harness, assembly, installerProxy);
 }
Ejemplo n.º 3
0
 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)
 {
 }
Ejemplo n.º 4
0
 internal static WindowsServiceManager GetInstance(IConsoleHarness harness)
 {
     return GetInstance(harness,
         AssemblyProxy.Default,
         ManagedInstallerProxy.Default);
 }
Ejemplo n.º 5
0
 public Implementation(IConsoleHarness console, IAssembly assembly, ManagedInstallerProxy installer)
 {
     _assembly = assembly;
     _console = console;
     _installerProxy = installer;
 }