Beispiel #1
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeChapCredentialsResponse response = new DescribeChapCredentialsResponse();

            context.Read();

            UnmarshallResult(context, response);
            return(response);
        }
Beispiel #2
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeChapCredentialsResponse response = new DescribeChapCredentialsResponse();

            context.Read();
            response.DescribeChapCredentialsResult = DescribeChapCredentialsResultUnmarshaller.GetInstance().Unmarshall(context);

            return(response);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeChapCredentialsResponse response = new DescribeChapCredentialsResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("ChapCredentials", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <ChapInfo, ChapInfoUnmarshaller>(ChapInfoUnmarshaller.Instance);
                    response.ChapCredentials = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Beispiel #4
0
        private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeChapCredentialsResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

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

            return;
        }