예제 #1
0
        /// <summary>
        /// Try to compile the step
        /// </summary>
        /// <param name="errors"></param>
        /// <returns></returns>
        public bool TryCompile(out string[] errors)
        {
            List <string> aggregatingErrors = new List <string>();

            if (IsCompiled)
            {
                errors = aggregatingErrors.ToArray();
                return(true);
            }
            if (_stepDef.OnEntry != null)
            {
                string[] onEntryErrors;
                _onEnter = new CsScriptRuntime(_stepDef.OnEntry);
                _onEnter.TryCompile(out onEntryErrors);
                aggregatingErrors.AddRange(onEntryErrors);
            }
            if (_stepDef.OnExit != null)
            {
                string[] onExitErrors;
                _onExit = new CsScriptRuntime(_stepDef.OnExit);
                _onExit.TryCompile(out onExitErrors);
                aggregatingErrors.AddRange(onExitErrors);
            }
            string[] handlerErrors;
            _handler.TryCompile(out handlerErrors);
            aggregatingErrors.AddRange(handlerErrors);
            errors     = aggregatingErrors.ToArray();
            IsCompiled = true;
            return(errors.Length == 0);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sd"></param>
        /// <param name="errors"></param>
        /// <returns></returns>
        protected bool TryCompileScript(ScriptDefinition sd, out string[] errors)
        {
            List <string> aggregatingErrors = new List <string>();

            if (IsCompiled)
            {
                errors = aggregatingErrors.ToArray();
                return(true);
            }
            if (sd != null)
            {
                string[] onEntryErrors;
                _script = new CsScriptRuntime(sd);
                _script.TryCompile(out onEntryErrors);
                aggregatingErrors.AddRange(onEntryErrors);
            }
            errors     = aggregatingErrors.ToArray();
            IsCompiled = true;
            return(errors.Length == 0);
        }
예제 #3
0
 public bool TryCompile(out string[] errors)
 {
     return(_script.TryCompile(out errors));
 }