Exemplo n.º 1
0
        /// <summary>
        /// Executes the script
        /// </summary>
        /// <param name="script">Script text</param>
        /// <param name="clearExistingCode">Whether or not to clear existing parsed code and start fresh.</param>
        public void Execute(string script, bool clearExistingCode, bool resetScript, params IPhase[] phases)
        {
            this.InitPlugins();
            if (_parser != null)
            {
                var execution = new Execution();
                execution.Ctx             = _context;
                EvalHelper.Ctx            = _context;
                _parser.OnDemandEvaluator = execution;
            }
            var phaseExecutor = new PhaseExecutor();

            // 1. Create the execution phase
            if (clearExistingCode || _phaseCtx == null)
            {
                _phaseCtx     = new PhaseContext();
                _phaseCtx.Ctx = _context;
            }
            if (resetScript)
            {
                _phaseCtx.ScriptText = script;
            }
            var phasesList = phases.ToList();
            var result     = phaseExecutor.Execute(script, _phaseCtx, _context, phasesList);

            this._runResult = result.Result;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Executes the script
        /// </summary>
        /// <param name="script">Script text</param>
        public void Execute(string script, params IPhase[] phases)
        {
            var phaseExecutor = new PhaseExecutor();
            var phasesList    = phases.ToList();
            var result        = phaseExecutor.Execute(script, _context, phasesList);

            this._runResult = result.Result;
        }