public bool Resolve(MethodStateMachine methodSM)
        {
            //Create an execution model for calling method
            var cmExec = _methodStateMachineFactory.Create(methodSM.State.CallMethod);

            cmExec.Caller = methodSM;
            if (cmExec == null)
            {
                throw new Exception("Method not found");
            }

            //Fill calling method's arguments if any
            if (cmExec.MethodDesc.TakesArguments)
            {
                cmExec.SetMethodArguments(methodSM.Context.EvalStack);
            }

            //Add calling method to the call stack
            _callStack.Push(cmExec);

            //Reset the flow
            methodSM.State.ExecutionInterruption = ExecutionInterruption.None;
            methodSM.State.CallMethod            = null;

            return(false);
        }
        public void Execute(ICallStack callStack, IStoryContext context)
        {
            nextIndex = callStack.Push();
            var macro = context.ScenarioMacroRepository.GetMacro(name);

            if (macro != null)
            {
                nextIndex = macro.index;
                context.ScenarioRepository.JumpToScenario(macro.file_name);
            }
            else
            {
                nextIndex += 1;
            }
        }
Esempio n. 3
0
 public void Start()
 {
     try
     {
         MethodDesc entryPoint = _compiledModel.Methods.Values.Where(d => d.IsEntryPoint).SingleOrDefault();
         if (entryPoint == null)
         {
             throw new InvalidOperationException("Entry point not found");
         }
         MethodStateMachine entryPointExecModel = _methodStateMachineFactory.Create(entryPoint);
         _callStack.Push(entryPointExecModel);
         ProcessCallStack();
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public void Execute(ICallStack callStack, IStoryContext context)
 {
     callStack.Push();
     if (string.IsNullOrEmpty(file))
     {
         file = context.ScenarioRepository.GetCurrentRunningScenario().name;
     }
     file = ArgumentExpression.replaceVariable(file, context.VariableRepository);
     context.ScenarioRepository.JumpToScenario(file);
     target = ArgumentExpression.replaceVariable(target, context.VariableRepository);
     if (!string.IsNullOrEmpty(target))
     {
         index = context.ScenarioRepository.GetScenario(file).getIndex(target);
         if (index < 0)
         {
             index = 0;
         }
     }
 }
Esempio n. 5
0
 public RouteAction Handle(ICall call)
 {
     call.AssignSequenceNumber(_generator.Next());
     _callStack.Push(call);
     return(RouteAction.Continue());
 }
Esempio n. 6
0
 public RouteAction Handle(ICall call)
 {
     _callStack.Push(call);
     return(RouteAction.Continue());
 }