public CronTime(CronTemplate cronTemplate, DateTime datetime, bool forceToValidCronTime = true)
 {
     CronTemplate = cronTemplate;
     Time         = new Time(datetime);
     if (forceToValidCronTime)
     {
         var validCronTime = CronTimeValidator.GetNextCronTimeThatFitsTheTemplate(this);
         if (validCronTime.HasValue)
         {
             Time = validCronTime.Value.Time;
         }
     }
 }
 public Time ChangeYear(int year, CronTemplate template)
 {
     return(new Time(year, template.Months.First(), template.DaysOfMonth.First(), template.Hours.First(), template.Minutes.First(), template.Seconds.First()));
 }
        internal static bool MatchDayOfWeek(CronTemplate cronTemplate, DateTime date)
        {
            var dayOfWeekMatch = cronTemplate.DaysOfWeek.Contains((int)date.DayOfWeek);

            return(dayOfWeekMatch);
        }
 public Time ChangeMonth(int month, CronTemplate template)
 {
     return(new Time(Year, month, template.DaysOfMonth.First(), template.Hours.First(), template.Minutes.First(), template.Seconds.First()));
 }
 public Time ChangeDay(int day, CronTemplate template)
 {
     return(new Time(Year, Month, day, template.Hours.First(), template.Minutes.First(), template.Seconds.First()));
 }
 public Time ChangeHour(int hour, CronTemplate template)
 {
     return(new Time(Year, Month, Day, hour, template.Minutes.First(), template.Seconds.First()));
 }
 public Time ChangeMinute(int minute, CronTemplate template)
 {
     return(new Time(Year, Month, Day, Hour, minute, template.Seconds.First()));
 }
 public Time ChangeSecond(int second, CronTemplate template)
 {
     return(new Time(Year, Month, Day, Hour, Minute, second));
 }