private static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(LogUnhandledException); Logger.LogInfo(); Logger.LogToConsole = true; try { if (!System.Environment.UserInteractive) { // TODO: run as a service ServiceBase.Run(new ServiceBase[] { new Service() }); } else { try { var hub = new CommandHub(); Progress.Start(); ConsoleHelper.ApplicationShortTitle(); #if DEBUG Engine.Start(); #endif hub.ProcessCommands(args); } catch (Exception ex) { ConsoleHelper.WriteException(ex); } Progress.Stop(); Engine.Stop(); while (!Engine.Stopped) { Thread.Sleep(100); } return; } } catch (Exception ex) { Logger.Log(ex); } }