public DescribeObjectsResult Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeObjectsResult describeObjectsResult = new DescribeObjectsResult();

            describeObjectsResult.PipelineObjects = 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("PipelineObjects", targetDepth))
                    {
                        describeObjectsResult.PipelineObjects = new List <PipelineObject>();
                        PipelineObjectUnmarshaller unmarshaller = PipelineObjectUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                describeObjectsResult.PipelineObjects.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("Marker", targetDepth))
                    {
                        describeObjectsResult.Marker = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("HasMoreResults", targetDepth))
                    {
                        describeObjectsResult.HasMoreResults = BoolUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(describeObjectsResult);
                }
            }


            return(describeObjectsResult);
        }
Exemplo n.º 2
0
        private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeObjectsResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("pipelineObjects", targetDepth))
                {
                    context.Read();
                    response.PipelineObjects = new List <PipelineObject>();
                    PipelineObjectUnmarshaller unmarshaller = PipelineObjectUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.PipelineObjects.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("marker", targetDepth))
                {
                    context.Read();
                    response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("hasMoreResults", targetDepth))
                {
                    context.Read();
                    response.HasMoreResults = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

            return;
        }
Exemplo n.º 3
0
        public GetPipelineDefinitionResult Unmarshall(JsonUnmarshallerContext context)
        {
            GetPipelineDefinitionResult getPipelineDefinitionResult = new GetPipelineDefinitionResult();

            getPipelineDefinitionResult.PipelineObjects = 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("PipelineObjects", targetDepth))
                    {
                        getPipelineDefinitionResult.PipelineObjects = new List <PipelineObject>();
                        PipelineObjectUnmarshaller unmarshaller = PipelineObjectUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                getPipelineDefinitionResult.PipelineObjects.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(getPipelineDefinitionResult);
                }
            }


            return(getPipelineDefinitionResult);
        }