コード例 #1
0
ファイル: ScheduleUtility.cs プロジェクト: ForBalah/SACS
        /// <summary>
        /// Builds the schedule.
        /// </summary>
        /// <param name="minutePart">The minute part.</param>
        /// <param name="hourPart">The hour part.</param>
        /// <param name="dayPart">The day part.</param>
        /// <param name="monthPart">The month part.</param>
        /// <param name="dayOfWeekPart">The day of week part.</param>
        /// <returns></returns>
        public static ScheduleBuildResult BuildSchedule(Tuple <IList <int>, bool> minutePart, Tuple <IList <int>, bool> hourPart, Tuple <IList <int>, bool> dayPart, Tuple <IList <int>, bool> monthPart, IList <int> dayOfWeekPart)
        {
            ScheduleBuildResult result          = new ScheduleBuildResult();
            StringBuilder       scheduleBuilder = new StringBuilder();

            BuildSchedulePart(minutePart, CrontabFieldKind.Minute, scheduleBuilder, result);
            BuildSchedulePart(hourPart, CrontabFieldKind.Hour, scheduleBuilder, result);
            BuildSchedulePart(dayPart, CrontabFieldKind.Day, scheduleBuilder, result);
            BuildSchedulePart(monthPart, CrontabFieldKind.Month, scheduleBuilder, result);
            BuildSchedulePart(dayOfWeekPart, CrontabFieldKind.DayOfWeek, scheduleBuilder, result);

            result.Result = scheduleBuilder.ToString().Trim();
            return(result);
        }
コード例 #2
0
ファイル: ScheduleUtility.cs プロジェクト: ForBalah/SACS
        /// <summary>
        /// Builds the schedule part.
        /// </summary>
        /// <param name="part">The part.</param>
        /// <param name="crontabFieldKind">Kind of the crontab field.</param>
        /// <param name="scheduleBuilder">The schedule builder.</param>
        /// <param name="result">The result.</param>
        private static void BuildSchedulePart(IList <int> part, CrontabFieldKind crontabFieldKind, StringBuilder scheduleBuilder, ScheduleBuildResult result)
        {
            string message = FieldLogicMap[crontabFieldKind].BuildSchedulePart(part, scheduleBuilder);

            if (!string.IsNullOrWhiteSpace(message))
            {
                result.Messages.Add(message);
            }
        }