static void Main(string[] args) { ConfigureLogs(Environment.UserInteractive); CreateConfigs(); AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper; if (Environment.UserInteractive) { var arg = args != null && args.Length > 0 ? args[0].ToLower() : ""; if (arg == "-i") { Console.WriteLine("installing service..."); var param = new[] { Assembly.GetExecutingAssembly().Location }; ManagedInstallerClass.InstallHelper(param); } else if (arg == "-u") { Console.WriteLine("uninstalling service..."); var param = new[] { "/u", Assembly.GetExecutingAssembly().Location }; ManagedInstallerClass.InstallHelper(param); } else { AllocConsole(); JRobbot.Start(); Console.Write("Press enter to stop server..."); Console.ReadLine(); JRobbot.Stop(); } } else { using (var service = new JRobbotService()) { ServiceBase.Run(service); } } }
protected override void OnStop() { JRobbot.Stop(); }