45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.ServiceProcess;
|
|
using System.Threading;
|
|
|
|
namespace FileinterfaceCronScheduler
|
|
{
|
|
internal static class Program
|
|
{
|
|
private static int Main(string[] args)
|
|
{
|
|
bool forceService = args.Any(a => String.Equals(a, "--service", StringComparison.OrdinalIgnoreCase));
|
|
|
|
if (!Environment.UserInteractive || forceService)
|
|
{
|
|
ServiceBase.Run(new FileinterfaceCronSchedulerService());
|
|
return 0;
|
|
}
|
|
|
|
Console.Title = "FileInterface Watcher + CronScheduler";
|
|
Console.WriteLine("FileInterface Watcher + CronScheduler");
|
|
Console.WriteLine("====================================");
|
|
Console.WriteLine("Konsole/Debug-Modus. Mit --service als Windows-Dienst starten.");
|
|
Console.WriteLine();
|
|
|
|
using (var runtime = RuntimeFactory.Create())
|
|
using (var quit = new ManualResetEvent(false))
|
|
{
|
|
Console.CancelKeyPress += (s, e) =>
|
|
{
|
|
e.Cancel = true;
|
|
quit.Set();
|
|
};
|
|
|
|
runtime.Start();
|
|
Console.WriteLine("FileSystemWatcher, CronScheduler und Webinterface gestartet.");
|
|
Console.WriteLine("Beenden mit Strg+C.");
|
|
quit.WaitOne();
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
}
|