Пример #1
0
 public static PipelineDescriptionUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new PipelineDescriptionUnmarshaller();
     }
     return(instance);
 }
        public DescribePipelinesResult Unmarshall(JsonUnmarshallerContext context)
        {
            DescribePipelinesResult describePipelinesResult = new DescribePipelinesResult();

            describePipelinesResult.PipelineDescriptionList = null;

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

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

                    if (context.TestExpression("PipelineDescriptionList", targetDepth))
                    {
                        describePipelinesResult.PipelineDescriptionList = new List <PipelineDescription>();
                        PipelineDescriptionUnmarshaller unmarshaller = PipelineDescriptionUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                describePipelinesResult.PipelineDescriptionList.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(describePipelinesResult);
                }
            }


            return(describePipelinesResult);
        }
Пример #3
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribePipelinesResponse response = new DescribePipelinesResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("pipelineDescriptionList", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <PipelineDescription, PipelineDescriptionUnmarshaller>(
                        PipelineDescriptionUnmarshaller.GetInstance());
                    response.PipelineDescriptionList = unmarshaller.Unmarshall(context);

                    continue;
                }
            }

            return(response);
        }
        private static void UnmarshallResult(JsonUnmarshallerContext context, DescribePipelinesResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("pipelineDescriptionList", targetDepth))
                {
                    context.Read();
                    response.PipelineDescriptionList = new List <PipelineDescription>();
                    PipelineDescriptionUnmarshaller unmarshaller = PipelineDescriptionUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.PipelineDescriptionList.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return;
                }
            }

            return;
        }