Example #1
0
        public ActivityTypeDetail Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            ActivityTypeDetail activityTypeDetail = new ActivityTypeDetail();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("typeInfo", targetDepth))
                {
                    activityTypeDetail.TypeInfo = ActivityTypeInfoUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("configuration", targetDepth))
                {
                    activityTypeDetail.Configuration = ActivityTypeConfigurationUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(activityTypeDetail);
        }
        public ActivityTypeDetail Unmarshall(JsonUnmarshallerContext context)
        {
            ActivityTypeDetail activityTypeDetail = new ActivityTypeDetail();

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

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("TypeInfo", targetDepth))
                    {
                        activityTypeDetail.TypeInfo = ActivityTypeInfoUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Configuration", targetDepth))
                    {
                        activityTypeDetail.Configuration = ActivityTypeConfigurationUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(activityTypeDetail);
                }
            }


            return(activityTypeDetail);
        }
Example #3
0
        public ActivityTypeInfos Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            ActivityTypeInfos activityTypeInfos = new ActivityTypeInfos();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("typeInfos", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <ActivityTypeInfo, ActivityTypeInfoUnmarshaller>(
                        ActivityTypeInfoUnmarshaller.GetInstance());
                    activityTypeInfos.TypeInfos = unmarshaller.Unmarshall(context);

                    continue;
                }

                if (context.TestExpression("nextPageToken", targetDepth))
                {
                    activityTypeInfos.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(activityTypeInfos);
        }
 public static ActivityTypeInfoUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new ActivityTypeInfoUnmarshaller();
     }
     return(instance);
 }
        public ActivityTypeInfos Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            ActivityTypeInfos activityTypeInfos = new ActivityTypeInfos();



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

            while (context.Read())
            {
                if (context.TestExpression("typeInfos", targetDepth))
                {
                    context.Read();
                    activityTypeInfos.TypeInfos = new List <ActivityTypeInfo>();
                    ActivityTypeInfoUnmarshaller unmarshaller = ActivityTypeInfoUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        activityTypeInfos.TypeInfos.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("nextPageToken", targetDepth))
                {
                    context.Read();
                    activityTypeInfos.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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


            return(activityTypeInfos);
        }
        public ActivityTypeInfos Unmarshall(JsonUnmarshallerContext context)
        {
            ActivityTypeInfos activityTypeInfos = new ActivityTypeInfos();

            activityTypeInfos.TypeInfos = 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("TypeInfos", targetDepth))
                    {
                        activityTypeInfos.TypeInfos = new List <ActivityTypeInfo>();
                        ActivityTypeInfoUnmarshaller unmarshaller = ActivityTypeInfoUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                activityTypeInfos.TypeInfos.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("NextPageToken", targetDepth))
                    {
                        activityTypeInfos.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(activityTypeInfos);
                }
            }


            return(activityTypeInfos);
        }