예제 #1
0
 private static CronRange ParseRangeExpression(CronField cronField, string rangeExpression)
 {
     try
     {
         var range = rangeExpression.Split('-');
         return new CronRange(cronField.ValueToIndex(Int32.Parse(range[UpperIndex])), cronField.ValueToIndex(Int32.Parse(range[LowerIndex])));
     }
     catch (FormatException ex)
     {
         throw new CronException("The range expression is incorrectly formatted.", ex);
     }
 }
예제 #2
0
        public static CronRange FromExpression(CronField cronField, string rangeExpression)
        {
            Mandate.ParameterNotNullOrEmpty(rangeExpression, "rangeExpression");
            int parsed;

            if(Int32.TryParse(rangeExpression, out parsed))
            {
                return new CronRange(cronField.ValueToIndex(parsed), cronField.ValueToIndex(parsed));
            }

            return ParseRangeExpression(cronField, rangeExpression);
        }
예제 #3
0
 public CronValueExpression(string expression, CronField cronField)
 {
     this.cronField = cronField;
     Parse(cronField.ReplaceTextWithNumbers(expression));
 }