Ejemplo n.º 1
0
 public static InstanceGroupStatusUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new InstanceGroupStatusUnmarshaller();
     }
     return(instance);
 }
Ejemplo n.º 2
0
        public InstanceGroup Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            InstanceGroup instanceGroup = new InstanceGroup();



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

            while (context.Read())
            {
                if (context.TestExpression("Id", targetDepth))
                {
                    context.Read();
                    instanceGroup.Id = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

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

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

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

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

                if (context.TestExpression("RequestedInstanceCount", targetDepth))
                {
                    context.Read();
                    instanceGroup.RequestedInstanceCount = IntUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("RunningInstanceCount", targetDepth))
                {
                    context.Read();
                    instanceGroup.RunningInstanceCount = IntUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("Status", targetDepth))
                {
                    context.Read();
                    instanceGroup.Status = InstanceGroupStatusUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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


            return(instanceGroup);
        }