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); } }
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); }