Ejemplo n.º 1
0
        private void ParseTaskStep(XPathNavigator nav, ref StepsGroup g)
        {
            string stepType = nav.GetAttribute("Type", string.Empty);

            string         breakconditionString = nav.GetAttribute("breakcondition", string.Empty);
            BreakCondition breakCondition       = BreakCondition.Never;

            if (!string.IsNullOrEmpty(breakconditionString))
            {
                breakCondition = (BreakCondition)Enum.Parse(typeof(BreakCondition), breakconditionString);
            }

            // TODO: Add execution flgs parsing

            MoveNavigatorToChildNode(ref nav, "Parameters");
            Parameters parameters = ParseTaskStepParameters(nav);

            Step s = StepsFactory.CreateStep(stepsAssemblies[stepType], parameters);

            s.BreakCondition = breakCondition;

            s.LogMessageAction = new Func <LogLevel, string, Task>(LogMessageAsync);

            g.Add(s);

            MoveNavigatorToParentNode(ref nav, 2);
        }
Ejemplo n.º 2
0
 private StepsGroup ParseTaskSteps(XPathNavigator nav, StepsGroup g)
 {
     nav.MoveToFirstChild();
     do
     {
         ParseTaskStep(nav, ref g);
     } while (nav.MoveToNext());
     MoveNavigatorToParentNode(ref nav, 1);
     return(g);
 }
Ejemplo n.º 3
0
        private void ParseTaskStepsGroup(XPathNavigator nav, ref Job t)
        {
            StepsGroup g = new StepsGroup();

            string sgId = nav.GetAttribute("id", string.Empty);

            string         breakConditionString = nav.GetAttribute("breakcondition", string.Empty);
            BreakCondition breakcondition       = BreakCondition.Never;

            if (!string.IsNullOrEmpty(breakConditionString))
            {
                breakcondition = (BreakCondition)Enum.Parse(typeof(BreakCondition), breakConditionString);
            }
            g.BreakCondition = breakcondition;
            g.Id             = sgId;

            g.LogMessageAction = new Func <LogLevel, string, Task>(LogMessageAsync);

            t.JobStepsGroups.Add(g);

            g = ParseTaskSteps(nav, g);
        }
Ejemplo n.º 4
0
        public async Task <JobResult> ExecuteStepsGroup(FileInfo f, StepsGroup g)
        {
            JobResult result     = new JobResult();
            string    resultText = string.Empty;
            bool      loopStatus = false;

            foreach (Step s in g)
            {
                s.LastCommandReport = resultText;
                result = await ExecuteStep(f, s);

                switch (s.BreakCondition)
                {
                case BreakCondition.Always:
                    return(result);

                case BreakCondition.OnError:
                    if (!result.Done)
                    {
                        return(result);
                    }
                    break;

                case BreakCondition.OnSuccess:
                    if (result.Done)
                    {
                        return(result);
                    }
                    break;
                }
                resultText  = result.ResultText;
                loopStatus &= result.Done;
            }
            result.Done = loopStatus;
            return(result);
        }