public static ChapInfoUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new ChapInfoUnmarshaller();
     }
     return(instance);
 }
示例#2
0
        public DescribeChapCredentialsResult Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeChapCredentialsResult describeChapCredentialsResult = new DescribeChapCredentialsResult();

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


            return(describeChapCredentialsResult);
        }
        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.GetInstance());
                    response.ChapCredentials = unmarshaller.Unmarshall(context);

                    continue;
                }
            }

            return(response);
        }
示例#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;
        }