예제 #1
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListPresetsResponse response = new ListPresetsResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Presets", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Preset, PresetUnmarshaller>(
                        PresetUnmarshaller.GetInstance());
                    response.Presets = unmarshaller.Unmarshall(context);

                    continue;
                }

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

            return(response);
        }
        public CreatePresetResult Unmarshall(JsonUnmarshallerContext context)
        {
            CreatePresetResult createPresetResult = new CreatePresetResult();

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

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

                    if (context.TestExpression("Preset", targetDepth))
                    {
                        createPresetResult.Preset = PresetUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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


            return(createPresetResult);
        }
예제 #3
0
        public ReadPresetResult Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonUnmarshallerContext.TokenType.Null)
            {
                return(null);
            }
            ReadPresetResult readPresetResult = new ReadPresetResult();

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

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

                    if (context.TestExpression("Preset", targetDepth))
                    {
                        readPresetResult.Preset = PresetUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(readPresetResult);
                }
            }


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

            while (context.Read())
            {
                if (context.TestExpression("Preset", targetDepth))
                {
                    context.Read();
                    response.Preset = PresetUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

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

            return;
        }
예제 #5
0
 public static PresetUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new PresetUnmarshaller();
     }
     return(instance);
 }
예제 #6
0
        private static void UnmarshallResult(JsonUnmarshallerContext context, ListPresetsResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("Presets", targetDepth))
                {
                    context.Read();

                    if (context.CurrentTokenType == JsonToken.Null)
                    {
                        response.Presets = null;
                        continue;
                    }
                    response.Presets = new List <Preset>();
                    PresetUnmarshaller unmarshaller = PresetUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.Presets.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

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

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

            return;
        }
        public ListPresetsResult Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonUnmarshallerContext.TokenType.Null)
            {
                return(null);
            }
            ListPresetsResult listPresetsResult = new ListPresetsResult();

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


            return(listPresetsResult);
        }
예제 #8
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ReadPresetResponse response = new ReadPresetResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Preset", targetDepth))
                {
                    response.Preset = PresetUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }