Пример #1
0
        public ISchedule GetSchedule(string name)
        {
            CronScheduleInfo info = ScheduleManager.Get(name);

            if (info == null)
            {
                return(null);
            }

            return(new CronSchedule(info));
        }
Пример #2
0
        public CronSchedule(CronScheduleInfo info)
        {
            this.minutes = CronHelper.Parse(info.Minutes, 0, 59);
            this.hours   = CronHelper.Parse(info.Hours, 0, 23);

            if (info.Months != "*" || info.DaysOfMonth != "*")
            {
                this.months      = CronHelper.Parse(info.Months, 1, 12);
                this.daysOfMonth = CronHelper.Parse(info.DaysOfMonth, 1, 31);
            }

            if (info.DaysOfWeek != "*")
            {
                this.daysOfWeek    = CronHelper.Parse(info.DaysOfWeek, 0, 7);
                this.daysOfWeek[7] = this.daysOfWeek[0] = this.daysOfWeek[0] || this.daysOfWeek[7];
            }
        }