/// <summary> /// JScriptで記述された式を評価します /// </summary> /// <param name="expression">評価する式</param> /// <param name="isUnsafe">制限付きのセキュリティコンテキストで実行されないかどうか</param> public static object Eval(string expression, bool isUnsafe) { if (isUnsafe) { return(InternalEvaluator.Eval(expression, isUnsafe)); } else { return(InternalEvaluator.Eval(expression)); } }
public void Setup() { var blockFunctions = new IBlockFunction[] { new ForEach(), new Literal(), new Strip(), new Capture() }; var inlineFunctions = new IInlineFunction[] { new LDelim(), new RDelim(), new Assign(), new Cycle() }; var expressionFunctions = new IExpressionFunction[] { new If() }; var variableModifiers = new IVariableModifier[] { new Capitalize(), new Cat(), new CountCharacters(), new CountParagraphs(), new CountSentences(), new CountWords(), new DateFormat(), new Default(), new Lower(), new NewLineToBreak(), new RegexReplace(), new Replace(), new Spacify(), new StringFormat(), new ASmarty.VariableModifiers.Strip(), new StripTags(), new Truncate(), new Upper(), new WordWrap(), new Indent() }; var functions = new Functions(blockFunctions, inlineFunctions, expressionFunctions, variableModifiers); viewData = new Dictionary <string, object>(); functionData = new Dictionary <string, object>(); var internalEvaluator = new InternalEvaluator(null, null, functions); evaluator = new ViewEngine.Evaluator(internalEvaluator, 0); functionEvaluator = new FunctionEvaluator(internalEvaluator, 0, functionData); }
/// <summary> /// JScriptで記述された式を評価します /// </summary> /// <param name="expression">評価する式</param> public static object Eval(string expression) { return(InternalEvaluator.Eval(expression)); }