コード例 #1
0
        public StackSummary Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            StackSummary stackSummary = new StackSummary();



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

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

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

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

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

                if (context.TestExpression("InstancesCount", targetDepth))
                {
                    context.Read();
                    stackSummary.InstancesCount = InstancesCountUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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


            return(stackSummary);
        }
コード例 #2
0
 public static InstancesCountUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new InstancesCountUnmarshaller();
     }
     return(instance);
 }