public static ClockSettings AsSettings(this ClockServerOptions me) => me == null ? throw new ArgumentNullException(nameof(me)) : new ClockSettings { DurationHours = me.Duration.TotalHours, StartTime = me.StartTime, Speed = me.Speed };
public static ClockSettings AsSettings(this ClockServerOptions me) => me == null ? throw new ArgumentNullException(nameof(me)) : new ClockSettings { Name = me.Name, AdministratorPassword = me.Password, Duration = me.Duration, StartTime = me.StartTime, Speed = me.Speed };
public ClockServer(IOptions <ClockServerOptions> options) { Options = options?.Value ?? throw new ArgumentNullException(nameof(options)); Update(Options.AsSettings()); Elapsed = TimeSpan.Zero; ClockTimer = new Timer(1000); ClockTimer.Elapsed += Tick; Multicaster = new ClockMulticaster(Options.Multicast, this); PollingService = new ClockPollingService(Options.Polling, this); }
public ClockServer(IOptions <ClockServerOptions> options) { Options = options?.Value ?? throw new ArgumentNullException(nameof(options)); Name = Options.Name; Password = Options.Password; Update(Options.AsSettings()); Elapsed = TimeSpan.Zero; ClockTimer = new Timer(1000); ClockTimer.Elapsed += Tick; Multicaster = new ClockMulticaster(Options.Multicast, this); PollingService = new ClockPollingService(Options.Polling, this); UtcOffset = TimeZoneInfo.FindSystemTimeZoneById(Options.TimeZoneId).GetUtcOffset(DateTime.Today); }