public static AudioParametersUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new AudioParametersUnmarshaller();
     }
     return(instance);
 }
Example #2
0
        public Preset Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            Preset preset = new Preset();



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

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

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

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

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

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

                if (context.TestExpression("Audio", targetDepth))
                {
                    context.Read();
                    preset.Audio = AudioParametersUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("Video", targetDepth))
                {
                    context.Read();
                    preset.Video = VideoParametersUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("Thumbnails", targetDepth))
                {
                    context.Read();
                    preset.Thumbnails = ThumbnailsUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

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


            return(preset);
        }