/// <summary> /// The main entry point for the application. /// </summary> internal static void Main() { Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); if (!Environment.UserInteractive) { System.ServiceProcess.ServiceBase[] servicesToRun; servicesToRun = new System.ServiceProcess.ServiceBase[] { new FileServiceWindowsService() }; System.ServiceProcess.ServiceBase.Run(servicesToRun); } else { using (FileServiceWindowsService service = new FileServiceWindowsService()) { service.Start(); Console.WriteLine(Strings.PressEnterToStopConsoleMessage); Console.ReadLine(); service.Stop(); } } }
/// <summary> /// The main entry point for the application. /// </summary> internal static void Main() { Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); if (!Environment.UserInteractive) { System.ServiceProcess.ServiceBase[] servicesToRun; servicesToRun = new System.ServiceProcess.ServiceBase[] { new FileServiceWindowsService() }; System.ServiceProcess.ServiceBase.Run(servicesToRun); } else { using (FileServiceWindowsService service = new FileServiceWindowsService()) { service.Start(); Console.WriteLine(Strings.PressEnterToStopConsoleMessage); Console.ReadLine(); service.Stop(); } } }