public ReadJobResult Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonUnmarshallerContext.TokenType.Null)
            {
                return(null);
            }
            ReadJobResult readJobResult = new ReadJobResult();

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

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

                    if (context.TestExpression("Job", targetDepth))
                    {
                        readJobResult.Job = JobUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(readJobResult);
                }
            }


            return(readJobResult);
        }
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListJobsByPipelineResponse response = new ListJobsByPipelineResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Jobs", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Job, JobUnmarshaller>(
                        JobUnmarshaller.GetInstance());
                    response.Jobs = unmarshaller.Unmarshall(context);

                    continue;
                }

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

            return(response);
        }
 public static JobUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new JobUnmarshaller();
     }
     return(instance);
 }
Exemple #4
0
        public ListJobsByPipelineResult Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonUnmarshallerContext.TokenType.Null)
            {
                return(null);
            }
            ListJobsByPipelineResult listJobsByPipelineResult = new ListJobsByPipelineResult();

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

                    if (context.TestExpression("NextPageToken", targetDepth))
                    {
                        listJobsByPipelineResult.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(listJobsByPipelineResult);
                }
            }


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

            while (context.Read())
            {
                if (context.TestExpression("Jobs", targetDepth))
                {
                    context.Read();

                    if (context.CurrentTokenType == JsonToken.Null)
                    {
                        response.Jobs = null;
                        continue;
                    }
                    response.Jobs = new List <Job>();
                    JobUnmarshaller unmarshaller = JobUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.Jobs.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

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

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

            return;
        }
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ReadJobResponse response = new ReadJobResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Job", targetDepth))
                {
                    response.Job = JobUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

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

            while (context.Read())
            {
                if (context.TestExpression("Job", targetDepth))
                {
                    context.Read();
                    response.Job = JobUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

            return;
        }