コード例 #1
0
        public static IntervalRange[] GetIntervals(string suppliedIntervalString, TextWriter console = null)
        {
            string[]        definedIntervals = suppliedIntervalString.Split(",");
            IntervalRange[] intervals        = new IntervalRange[definedIntervals.Length];

            int index = 0;

            foreach (string definedInterval in definedIntervals)
            {
                IntervalRange parsedInterval = ParseInterval(definedInterval);
                if (parsedInterval == null)
                {
                    console?.WriteLine("Invalid interval string: " + definedInterval);
                }
                else
                {
                    intervals[index++] = parsedInterval;
                }
            }

            // Check if we actually have all intervals
            if (index != intervals.Length)
            {
                return(null);
            }
            return(intervals);
        }
コード例 #2
0
 public IntervalScheduler(BaseAction action, IntervalRange range) : this(action, new[] { range })
 {
 }