31 lines
901 B
C#
31 lines
901 B
C#
using System;
|
|
using System.Linq;
|
|
using System.ServiceProcess;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace HikvisionAttendanceService;
|
|
|
|
internal static class Program
|
|
{
|
|
private static bool ArgsContainTestFlag(string[] args) =>
|
|
args.Any(a => string.Equals(a, "--test", StringComparison.OrdinalIgnoreCase));
|
|
|
|
private static async Task Main(string[] args)
|
|
{
|
|
// Console so mis-invocation is visible even before the daily log file is opened.
|
|
if (ArgsContainTestFlag(args))
|
|
Console.WriteLine("Program entry (test): rawArgCount=" + args.Length + " rawArgs=" + string.Join(" ", args));
|
|
|
|
if (ArgsContainTestFlag(args))
|
|
{
|
|
await AttendanceTestMode.RunAsync(args).ConfigureAwait(false);
|
|
return;
|
|
}
|
|
|
|
ServiceBase.Run(new ServiceBase[]
|
|
{
|
|
new HikvisionAttendanceWindowsService()
|
|
});
|
|
}
|
|
}
|