Esempio n. 1
0
 public static RaidArrayUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new RaidArrayUnmarshaller();
     }
     return(instance);
 }
Esempio n. 2
0
        public DescribeRaidArraysResult Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonUnmarshallerContext.TokenType.Null)
            {
                return(null);
            }
            DescribeRaidArraysResult describeRaidArraysResult = new DescribeRaidArraysResult();

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


            return(describeRaidArraysResult);
        }
Esempio n. 3
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeRaidArraysResponse response = new DescribeRaidArraysResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("RaidArrays", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <RaidArray, RaidArrayUnmarshaller>(
                        RaidArrayUnmarshaller.GetInstance());
                    response.RaidArrays = unmarshaller.Unmarshall(context);

                    continue;
                }
            }

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

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

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

            return;
        }