예제 #1
0
 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;
         }
     }
 }
예제 #2
0
 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()));
 }
예제 #3
0
        internal static bool MatchDayOfWeek(CronTemplate cronTemplate, DateTime date)
        {
            var dayOfWeekMatch = cronTemplate.DaysOfWeek.Contains((int)date.DayOfWeek);

            return(dayOfWeekMatch);
        }
예제 #4
0
 public Time ChangeMonth(int month, CronTemplate template)
 {
     return(new Time(Year, month, template.DaysOfMonth.First(), template.Hours.First(), template.Minutes.First(), template.Seconds.First()));
 }
예제 #5
0
 public Time ChangeDay(int day, CronTemplate template)
 {
     return(new Time(Year, Month, day, template.Hours.First(), template.Minutes.First(), template.Seconds.First()));
 }
예제 #6
0
 public Time ChangeHour(int hour, CronTemplate template)
 {
     return(new Time(Year, Month, Day, hour, template.Minutes.First(), template.Seconds.First()));
 }
예제 #7
0
 public Time ChangeMinute(int minute, CronTemplate template)
 {
     return(new Time(Year, Month, Day, Hour, minute, template.Seconds.First()));
 }
예제 #8
0
 public Time ChangeSecond(int second, CronTemplate template)
 {
     return(new Time(Year, Month, Day, Hour, Minute, second));
 }