/// <summary>
        /// Executes the expression once.
        /// </summary>
        /// <param name="code">Code to execute</param>
        private void Execute(string code)
        {
            lastRunSuccesfull = true;

            code = code.Trim().Trim(';');
            if (string.IsNullOrEmpty(code))
            {
                return;
            }

            RexISM.Code = code;
            var compile = _compileEngine.GetCompileAsync(code, out Messages);

            if (compile != null)
            {
                if (_expressionHistory.Count == 0 ||
                    _expressionHistory[0].Code != code)
                {
                    _expressionHistory.Insert(0, new RexHitoryItem
                    {
                        Code = code
                    });
                }

                var output = RexHelper.Execute <OutputEntry>(compile, out Messages);
                if (output != null)
                {
                    RexHelper.AddOutput(output);
                }

                if (output == null || output.Exception != null)
                {
                    lastRunSuccesfull = false;
                }
            }
            else
            {
                lastRunSuccesfull = false;
            }
            lastExecute = DateTime.Now;
        }
Exemple #2
0
 public static DummyOutput Execute(CompiledExpression compiledExpression)
 {
     Dictionary<MessageType, List<string>> tmp;
     return RexHelper.Execute<DummyOutput>(compiledExpression, out tmp);
 }
Exemple #3
0
 public static DummyOutput CompileAndRun(string code, out Dictionary<MessageType, List<string>> messages)
 {
     var pResult = new RexParser().ParseAssignment(code);
     var cResult = RexCompileEngine.Compile(pResult);
     return RexHelper.Execute<DummyOutput>(cResult, out messages);
 }