Beispiel #1
0
        //-----------------------------------------------------------------------------------------
        /// <summary>
        ///  Builds a date from the next valid crontab entries
        ///  after the given date
        /// </summary>
        /// <param name="cebs">Entries to choose from</param>
        /// <param name="afterDate">Date after wich next valid date is calculated from</param>
        /// <returns>the next valid date</returns>
        public ScheduleTime[] Next(CrontabEntryList cebs, DateTime afterDate)
        {
            ScheduleTime[] dates = new ScheduleTime[cebs.Count];
            for (int i = 0; i < dates.Length; i++)
            {
                dates[i] = Next(cebs[i], afterDate);
            }
            Array.Sort(dates);

            List<ScheduleTime> retList = new List<ScheduleTime>();
            ScheduleTime first = dates[0];
            retList.Add(first);
            for (int i = 1; i < dates.Length; i++)
            {
                if (dates[i].CompareTo(first) == 0)
                    retList.Add(dates[i]);
                else
                    break;
            }
            return (ScheduleTime[])retList.ToArray();
        }
Beispiel #2
0
        //-----------------------------------------------------------------------------------------
        /// <summary>
        /// Gets thes next CrontabEntry in the given Array. 
        /// We care only for one cause only need to know the next execution time.
        /// </summary>
        /// <param name="cebs"></param>
        /// <returns></returns>
        public CrontabEntry GetNextCrontabEntry(CrontabEntryList cebs)
        {
            long[] times = new long[cebs.Count];
            int value = 0;

            int index = 0;

            for (int i = 0; i < cebs.Count; i++)
            {
                times[i] = Next(cebs[i]).Date.Ticks;
            }

            long number = times[index];

            for (int i = 0; i < times.Length; i++)
            {
                if (times[i] < number)
                {
                    number = times[i];
                    value = i;
                }
            }
            return cebs[value];
        }
Beispiel #3
0
 //-----------------------------------------------------------------------------------------
 /// <summary>
 /// Builds a date from the next valid crontab entries
 /// </summary>
 /// <param name="cebs"></param>
 /// <returns>the next valid date</returns>
 public ScheduleTime[] Next(CrontabEntryList cebs)
 {
     return Next(cebs, DateTime.Now);
 }