public ExpressionDescriptor(string expression, Options options) { m_expression = expression; m_options = options; m_expressionParts = new string[6]; m_parsed = false; }
public void TestDayOfWeekModifierWithSundayStartOne() { Options options = new Options(); options.DayOfWeekStartIndexZero = false; Assert.AreEqual("在 12:23 PM, 在 第二个星期日 每月", ExpressionDescriptor.GetDescription("23 12 * * 1#2", options)); }
public void TestDayOfWeekModifierWithSundayStartOne() { Options options = new Options(); options.DayOfWeekStartIndexZero = false; Assert.AreEqual("At 12:23 PM, on the second Sunday of the month", ExpressionDescriptor.GetDescription("23 12 * * 1#2", options)); }
private void EvaluateExpression(string expression) { Options options = new Options() { ThrowExceptionOnParseError = false }; ViewBag.Expression = expression; ViewBag.Description = ExpressionDescriptor.GetDescription(expression, options); }
/// <summary> /// Initializes a new instance of the <see cref="ExpressionDescriptor"/> class /// </summary> /// <param name="expression">The cron expression string</param> /// <param name="options">Options to control the output description</param> public ExpressionDescriptor(string expression, Options options) { m_expression = expression; m_options = options; m_expressionParts = new string[7]; m_parsed = false; m_culture = Thread.CurrentThread.CurrentUICulture; }
private void EvaluateExpression(ViewModel model) { Options options = new Options() { ThrowExceptionOnParseError = false }; options.Use24HourTimeFormat = model.Use24HourFormat; options.Verbose = model.VerboseDescription; if (!string.IsNullOrEmpty(model.Language)) { CultureInfo myCultureInfo = new CultureInfo(model.Language); Thread.CurrentThread.CurrentCulture = myCultureInfo; Thread.CurrentThread.CurrentUICulture = myCultureInfo; } model.ExpressionDescription = ExpressionDescriptor.GetDescription(model.Expression, options); }
public static string GetFriendlyDescription(string expression) { Guard.ArgumentNotEmpty(() => expression); var options = new Options { DayOfWeekStartIndexZero = true, ThrowExceptionOnParseError = true, Verbose = false, Use24HourTimeFormat = Thread.CurrentThread.CurrentUICulture.DateTimeFormat.AMDesignator.IsEmpty() }; try { return ExpressionDescriptor.GetDescription(expression, options); } catch { return null; } }
/// <summary> /// Generates a human readable string for the Cron Expression /// </summary> /// <param name="expression">The cron expression string</param> /// <param name="options">Options to control the output description</param> /// <returns>The cron expression description</returns> public static string GetDescription(string expression, Options options) { ExpressionDescriptor descripter = new ExpressionDescriptor(expression, options); return descripter.GetDescription(DescriptionTypeEnum.FULL); }
/// <summary> /// Initializes a new instance of the <see cref="ExpressionParser"/> class /// </summary> /// <param name="expression">The cron expression string</param> /// <param name="options">Parsing options</param> public ExpressionParser(string expression, Options options) { m_expression = expression; m_options = options; m_en_culture = new CultureInfo("en-US"); //Default to English }
public ExpressionParser(string expression, Options options) { m_expression = expression; m_options = options; }
private void Convert() { CronExpressionDescriptor.Options options = new CronExpressionDescriptor.Options(); options.ThrowExceptionOnParseError = false; lblResult.Text = ExpressionDescriptor.GetDescription(txtExpression.Text, options); }
public ExpressionParser(string expression, Options options) { m_expression = expression; m_options = options; m_en_culture = new CultureInfo("en"); }
private void Convert() { CronExpressionDescriptor.Options options = new CronExpressionDescriptor.Options(); options.ThrowExceptionOnParseError = false; lblResult.Text = ExpressionDescriptor.GetDescription(txtExpression.Text, options); }
/// <summary> /// Generates a human readable string for the Cron Expression /// </summary> /// <param name="expression">The cron expression string</param> /// <param name="options">Options to control the output description</param> /// <returns>The cron expression description</returns> public static string GetDescription(string expression, Options options) { ExpressionDescriptor descripter = new ExpressionDescriptor(expression, options); return(descripter.GetDescription(DescriptionTypeEnum.FULL)); }
/// <summary> /// /// </summary> /// <param name="expression"></param> /// <param name="options"></param> /// <param name="culture">allows setting of en-GB</param> public ExpressionParser(string expression, Options options, CultureInfo culture) { m_expression = expression; m_options = options; m_en_culture = culture; }
/// <summary> /// Initializes a new instance of the <see cref="ExpressionParser"/> class /// </summary> /// <param name="expression">The cron expression string</param> /// <param name="options">Parsing options</param> public ExpressionParser(string expression, Options options) : this(expression, options, new CultureInfo("en-GB")) { }