Skip to content

Commit f7f99e4

Browse files
Add a new event
Add a new event was fired in ScriptEvaluate
1 parent 6aac80b commit f7f99e4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

CodingSeb.ExpressionEvaluator/ExpressionEvaluator.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,13 @@ public IDictionary<string, object> Variables
927927
}
928928
}
929929

930+
/// <summary>
931+
/// Is fired just before an scriptExpression is evaluate.<para/>
932+
/// Allow to redefine the scriptExpression to evaluate or to force a result value.
933+
/// </summary>
934+
public event EventHandler<ExpressionEvaluationEventArg> ScriptExpressionEvaluating;
935+
936+
930937
/// <summary>
931938
/// Is fired just before an expression is evaluate.<para/>
932939
/// Allow to redefine the expression to evaluate or to force a result value.
@@ -1084,6 +1091,13 @@ public virtual T ScriptEvaluate<T>(string script)
10841091
public virtual object ScriptEvaluate(string script)
10851092
{
10861093
inScript = true;
1094+
1095+
ExpressionEvaluationEventArg expressionEvaluationEventArg = new ExpressionEvaluationEventArg(script, this);
1096+
1097+
ExpressionEvaluating?.Invoke(this, expressionEvaluationEventArg);
1098+
1099+
script = expressionEvaluationEventArg.Expression;
1100+
10871101
try
10881102
{
10891103
bool isReturn = false;

0 commit comments

Comments
 (0)