static void Main(string[] args) { args = args.Select(s => s.ToLowerInvariant()).ToArray(); log4net.Config.XmlConfigurator.Configure(); if (ArgsContain(args, arrPingDb)) { var app = new SendToCMS(); Console.WriteLine(app.PingDb()); } else if (ArgsContain(args, arrUnInstall)) { Install(args, installIt: false); } else if (ArgsContain(args, arrInstall)) { Install(args); } else if (ArgsContain(args, arrOnce)) { var app = new SendToCMS(); app.config.runType = SendToCMS.RunType.runOnce; app.RunOnce(); } else if (ArgsContain(args, arrBpoEnv, true)) { var app = new SendToCMS(); app.config.runType = SendToCMS.RunType.runOnce; app.ValuationId = GetArgValue(args, arrBpoEnv); app.RunOnce(); } else if (ArgsContain(args, arrConsole)) { Console.WriteLine("press 'q' to quit."); var app = new SendToCMS(); app.config.runType = SendToCMS.RunType.console; app.Start(); if (!app.stopSignaled) { while (Console.ReadKey().KeyChar != 'q') { } } app.Stop(); } else if (ArgsContain(args, arrSvcStart)) { ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1() }; ServiceBase.Run(ServicesToRun); } else { Console.WriteLine(help); } }
protected override void OnStart(string[] args) { service = new SendToCMS(); service.Start(); }