public StepDetail Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            StepDetail stepDetail = new StepDetail();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("StepConfig", targetDepth))
                {
                    stepDetail.StepConfig = StepConfigUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("ExecutionStatusDetail", targetDepth))
                {
                    stepDetail.ExecutionStatusDetail = StepExecutionStatusDetailUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(stepDetail);
        }
        public StepDetail Unmarshall(JsonUnmarshallerContext context)
        {
            StepDetail stepDetail = new StepDetail();

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("StepConfig", targetDepth))
                    {
                        stepDetail.StepConfig = StepConfigUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("ExecutionStatusDetail", targetDepth))
                    {
                        stepDetail.ExecutionStatusDetail = StepExecutionStatusDetailUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(stepDetail);
                }
            }


            return(stepDetail);
        }
Пример #3
0
 public static StepConfigUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new StepConfigUnmarshaller();
     }
     return(instance);
 }
Пример #4
0
        public StepDetail Unmarshall(XmlUnmarshallerContext context)
        {
            StepDetail stepDetail    = new StepDetail();
            int        originalDepth = context.CurrentDepth;
            int        targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("StepConfig", targetDepth))
                    {
                        stepDetail.StepConfig = StepConfigUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("ExecutionStatusDetail", targetDepth))
                    {
                        stepDetail.ExecutionStatusDetail = StepExecutionStatusDetailUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(stepDetail);
                }
            }



            return(stepDetail);
        }