private static void UnmarshallResult(XmlUnmarshallerContext context,GetAccountSummaryResponse response)
        {
            
            int originalDepth = context.CurrentDepth;
            int targetDepth = originalDepth + 1;
            
            if (context.IsStartOfDocument) 
               targetDepth += 2;
            
            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("SummaryMap/entry", targetDepth))
                    {
                        KeyValueUnmarshaller<string, int, StringUnmarshaller, IntUnmarshaller> unmarshaller = new KeyValueUnmarshaller<string, int, StringUnmarshaller, IntUnmarshaller>(StringUnmarshaller.GetInstance(), IntUnmarshaller.GetInstance());
                        KeyValuePair<string, int> kvp = unmarshaller.Unmarshall(context);
                        response.SummaryMap.Add(kvp.Key, kvp.Value);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return;
                }
            }
                            


            return;
        }
Пример #2
0
        private static void UnmarshallResult(XmlUnmarshallerContext context,GetQueueAttributesResponse response)
        {
            
            int originalDepth = context.CurrentDepth;
            int targetDepth = originalDepth + 1;
            
            if (context.IsStartOfDocument) 
               targetDepth += 2;
            
            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {

                    if (context.TestExpression("Attribute", targetDepth))
                    {
                        var unmarshaller = new KeyValueUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        var item = unmarshaller.Unmarshall(context);
                        response.Attributes.Add(item);
                        continue;
                    }
                } 
           }

            return;
        }
        public PlatformApplication Unmarshall(XmlUnmarshallerContext context)
        {
            PlatformApplication unmarshalledObject = new PlatformApplication();
            int originalDepth = context.CurrentDepth;
            int targetDepth = originalDepth + 1;
            
            if (context.IsStartOfDocument) 
               targetDepth += 2;
            
            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Attributes/entry", targetDepth))
                    {
                        var unmarshaller = new KeyValueUnmarshaller<string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
                        var item = unmarshaller.Unmarshall(context);
                        unmarshalledObject.Attributes.Add(item);
                        continue;
                    }
                    if (context.TestExpression("PlatformApplicationArn", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        unmarshalledObject.PlatformApplicationArn = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return unmarshalledObject;
                }
            }

            return unmarshalledObject;
        }
        private static void UnmarshallResult(XmlUnmarshallerContext context, GetIdentityMailFromDomainAttributesResponse response)
        {
            
            int originalDepth = context.CurrentDepth;
            int targetDepth = originalDepth + 1;
            
            if (context.IsStartOfDocument) 
               targetDepth += 2;
            
            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {

                    if (context.TestExpression("MailFromDomainAttributes/entry", targetDepth))
                    {
                        var unmarshaller = new KeyValueUnmarshaller<string, IdentityMailFromDomainAttributes, StringUnmarshaller, IdentityMailFromDomainAttributesUnmarshaller>(StringUnmarshaller.Instance, IdentityMailFromDomainAttributesUnmarshaller.Instance);
                        var item = unmarshaller.Unmarshall(context);
                        response.MailFromDomainAttributes.Add(item);
                        continue;
                    }
                } 
           }

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

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("DkimAttributes/entry", targetDepth))
                    {
                        var unmarshaller = new KeyValueUnmarshaller <string, IdentityDkimAttributes, StringUnmarshaller, IdentityDkimAttributesUnmarshaller>(StringUnmarshaller.Instance, IdentityDkimAttributesUnmarshaller.Instance);
                        var item         = unmarshaller.Unmarshall(context);
                        response.DkimAttributes.Add(item);
                        continue;
                    }
                }
            }

            return;
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public ResourceSpecificResult Unmarshall(XmlUnmarshallerContext context)
        {
            ResourceSpecificResult unmarshalledObject = new ResourceSpecificResult();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("EvalDecisionDetails/entry", targetDepth))
                    {
                        var unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
                        var item         = unmarshaller.Unmarshall(context);
                        unmarshalledObject.EvalDecisionDetails.Add(item);
                        continue;
                    }
                    if (context.TestExpression("EvalResourceDecision", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        unmarshalledObject.EvalResourceDecision = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("EvalResourceName", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        unmarshalledObject.EvalResourceName = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("MatchedStatements/member", targetDepth))
                    {
                        var unmarshaller = StatementUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        unmarshalledObject.MatchedStatements.Add(item);
                        continue;
                    }
                    if (context.TestExpression("MissingContextValues/member", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        unmarshalledObject.MissingContextValues.Add(item);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(unmarshalledObject);
                }
            }

            return(unmarshalledObject);
        }
       private static void UnmarshallResult(JsonUnmarshallerContext context,UpdateItemResponse response)
       {
         
           int originalDepth = context.CurrentDepth;
           int targetDepth = originalDepth + 1;
           while (context.Read())
           {
             
             if (context.TestExpression("Attributes", targetDepth))
             {
               context.Read();
               response.Attributes = new Dictionary<String,AttributeValue>();
               if (context.CurrentTokenType == JsonToken.Null)
               {
                   continue;
               }
               KeyValueUnmarshaller<string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new KeyValueUnmarshaller<string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance());
               while (context.Read())
               {
                 JsonToken token = context.CurrentTokenType;
                 if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                 {
                     continue;
                 }
                 if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                 {
                     break;
                 }
                 KeyValuePair<string, AttributeValue> kvp = unmarshaller.Unmarshall(context);
                   response.Attributes.Add(kvp.Key, kvp.Value);
               }
               continue;
             }
 
             if (context.TestExpression("ConsumedCapacity", targetDepth))
             {
               context.Read();
               response.ConsumedCapacity = ConsumedCapacityUnmarshaller.GetInstance().Unmarshall(context);
               continue;
             }
 
             if (context.TestExpression("ItemCollectionMetrics", targetDepth))
             {
               context.Read();
               response.ItemCollectionMetrics = ItemCollectionMetricsUnmarshaller.GetInstance().Unmarshall(context);
               continue;
             }
 
               if (context.CurrentDepth <= originalDepth)
               {                   
                   return;
               }
           }
                       
           return;
       }                        
Пример #8
0
        public SourceDataMap Unmarshall(XmlUnmarshallerContext context)
        {
            SourceDataMap unmarshalledObject = new SourceDataMap();
            int           originalDepth      = context.CurrentDepth;
            int           targetDepth        = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Cases/entry", targetDepth))
                    {
                        var unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
                        var item         = unmarshaller.Unmarshall(context);
                        unmarshalledObject.Cases.Add(item);
                        continue;
                    }
                    if (context.TestExpression("DefaultValue", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        unmarshalledObject.DefaultValue = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("SourceName", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        unmarshalledObject.SourceName = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(unmarshalledObject);
                }
            }

            return(unmarshalledObject);
        }
Пример #9
0
        public DeleteRequest Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            DeleteRequest deleteRequest = new DeleteRequest();



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

            while (context.Read())
            {
                if (context.TestExpression("Key", targetDepth))
                {
                    context.Read();
                    deleteRequest.Key = new Dictionary <String, AttributeValue>();
                    if (context.CurrentTokenType == JsonToken.Null)
                    {
                        continue;
                    }
                    KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, AttributeValue> kvp = unmarshaller.Unmarshall(context);
                        deleteRequest.Key.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

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


            return(deleteRequest);
        }
Пример #10
0
        public Layer Unmarshall(JsonUnmarshallerContext context)
        {
            Layer layer = new Layer();

            layer.Attributes                = null;
            layer.CustomSecurityGroupIds    = null;
            layer.DefaultSecurityGroupNames = null;
            layer.Packages             = null;
            layer.VolumeConfigurations = 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("StackId", targetDepth))
                    {
                        layer.StackId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

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

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

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

                    if (context.TestExpression("Attributes", targetDepth))
                    {
                        layer.Attributes = new Dictionary <String, String>();
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                                layer.Attributes.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

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

                    if (context.TestExpression("CustomSecurityGroupIds", targetDepth))
                    {
                        layer.CustomSecurityGroupIds = new List <String>();
                        StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                layer.CustomSecurityGroupIds.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("DefaultSecurityGroupNames", targetDepth))
                    {
                        layer.DefaultSecurityGroupNames = new List <String>();
                        StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                layer.DefaultSecurityGroupNames.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("Packages", targetDepth))
                    {
                        layer.Packages = new List <String>();
                        StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                layer.Packages.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("VolumeConfigurations", targetDepth))
                    {
                        layer.VolumeConfigurations = new List <VolumeConfiguration>();
                        VolumeConfigurationUnmarshaller unmarshaller = VolumeConfigurationUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                layer.VolumeConfigurations.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("EnableAutoHealing", targetDepth))
                    {
                        layer.EnableAutoHealing = BoolUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("AutoAssignElasticIps", targetDepth))
                    {
                        layer.AutoAssignElasticIps = BoolUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("DefaultRecipes", targetDepth))
                    {
                        layer.DefaultRecipes = RecipesUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("CustomRecipes", targetDepth))
                    {
                        layer.CustomRecipes = RecipesUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

                    if (context.TestExpression("InstallUpdatesOnBoot", targetDepth))
                    {
                        layer.InstallUpdatesOnBoot = BoolUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(layer);
                }
            }


            return(layer);
        }
Пример #11
0
        public BatchWriteItemResult Unmarshall(JsonUnmarshallerContext context)
        {
            BatchWriteItemResult batchWriteItemResult = new BatchWriteItemResult();

            batchWriteItemResult.UnprocessedItems      = null;
            batchWriteItemResult.ItemCollectionMetrics = null;
            batchWriteItemResult.ConsumedCapacity      = 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("UnprocessedItems", targetDepth))
                    {
                        batchWriteItemResult.UnprocessedItems = new Dictionary <String, List <WriteRequest> >();
                        KeyValueUnmarshaller <string, List <WriteRequest>, StringUnmarshaller, ListUnmarshaller <WriteRequest, WriteRequestUnmarshaller> > unmarshaller = new KeyValueUnmarshaller <string, List <WriteRequest>, StringUnmarshaller, ListUnmarshaller <WriteRequest, WriteRequestUnmarshaller> >(StringUnmarshaller.GetInstance(), new ListUnmarshaller <WriteRequest, WriteRequestUnmarshaller>(WriteRequestUnmarshaller.GetInstance()));
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, List <WriteRequest> > kvp = unmarshaller.Unmarshall(context);
                                batchWriteItemResult.UnprocessedItems.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("ItemCollectionMetrics", targetDepth))
                    {
                        batchWriteItemResult.ItemCollectionMetrics = new Dictionary <String, List <ItemCollectionMetrics> >();
                        KeyValueUnmarshaller <string, List <ItemCollectionMetrics>, StringUnmarshaller, ListUnmarshaller <ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller> > unmarshaller = new KeyValueUnmarshaller <string, List <ItemCollectionMetrics>, StringUnmarshaller, ListUnmarshaller <ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller> >(StringUnmarshaller.GetInstance(), new ListUnmarshaller <ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller>(ItemCollectionMetricsUnmarshaller.GetInstance()));
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, List <ItemCollectionMetrics> > kvp = unmarshaller.Unmarshall(context);
                                batchWriteItemResult.ItemCollectionMetrics.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("ConsumedCapacity", targetDepth))
                    {
                        batchWriteItemResult.ConsumedCapacity = new List <ConsumedCapacity>();
                        ConsumedCapacityUnmarshaller unmarshaller = ConsumedCapacityUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                batchWriteItemResult.ConsumedCapacity.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(batchWriteItemResult);
                }
            }


            return(batchWriteItemResult);
        }
Пример #12
0
        public Stack Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            Stack stack = new Stack();



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

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

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

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

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

                if (context.TestExpression("Attributes", targetDepth))
                {
                    context.Read();
                    stack.Attributes = new Dictionary <String, String>();
                    KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        stack.Attributes.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

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

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

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

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

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

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

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

                if (context.TestExpression("ConfigurationManager", targetDepth))
                {
                    context.Read();
                    stack.ConfigurationManager = StackConfigurationManagerUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("UseCustomCookbooks", targetDepth))
                {
                    context.Read();
                    stack.UseCustomCookbooks = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("CustomCookbooksSource", targetDepth))
                {
                    context.Read();
                    stack.CustomCookbooksSource = SourceUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

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

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

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


            return(stack);
        }
        public GetIdentityNotificationAttributesResult Unmarshall(XmlUnmarshallerContext context)
        {
            GetIdentityNotificationAttributesResult getIdentityNotificationAttributesResult = new GetIdentityNotificationAttributesResult();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("NotificationAttributes/entry", targetDepth))
                    {
                        KeyValueUnmarshaller <string, IdentityNotificationAttributes, StringUnmarshaller, IdentityNotificationAttributesUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, IdentityNotificationAttributes, StringUnmarshaller, IdentityNotificationAttributesUnmarshaller>(StringUnmarshaller.GetInstance(), IdentityNotificationAttributesUnmarshaller.GetInstance());
                        KeyValuePair <string, IdentityNotificationAttributes> kvp = unmarshaller.Unmarshall(context);
                        getIdentityNotificationAttributesResult.NotificationAttributes.Add(kvp.Key, kvp.Value);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(getIdentityNotificationAttributesResult);
                }
            }



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

            while (context.Read())
            {
                if (context.TestExpression("Attributes", targetDepth))
                {
                    context.Read();
                    response.Attributes = new Dictionary <String, AttributeValue>();
                    if (context.CurrentTokenType == JsonToken.Null)
                    {
                        continue;
                    }
                    KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, AttributeValue> kvp = unmarshaller.Unmarshall(context);
                        response.Attributes.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

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

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

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

            return;
        }
        public App Unmarshall(JsonUnmarshallerContext context)
        {
            App app = new App();

            app.Domains    = null;
            app.Attributes = 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("AppId", targetDepth))
                    {
                        app.AppId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

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

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

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

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

                    if (context.TestExpression("AppSource", targetDepth))
                    {
                        app.AppSource = SourceUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Domains", targetDepth))
                    {
                        app.Domains = new List <String>();
                        StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                app.Domains.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("EnableSsl", targetDepth))
                    {
                        app.EnableSsl = BoolUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("SslConfiguration", targetDepth))
                    {
                        app.SslConfiguration = SslConfigurationUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Attributes", targetDepth))
                    {
                        app.Attributes = new Dictionary <String, String>();
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                                app.Attributes.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

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


            return(app);
        }
Пример #16
0
        public WeeklyAutoScalingSchedule Unmarshall(JsonUnmarshallerContext context)
        {
            WeeklyAutoScalingSchedule weeklyAutoScalingSchedule = new WeeklyAutoScalingSchedule();

            weeklyAutoScalingSchedule.Monday    = null;
            weeklyAutoScalingSchedule.Tuesday   = null;
            weeklyAutoScalingSchedule.Wednesday = null;
            weeklyAutoScalingSchedule.Thursday  = null;
            weeklyAutoScalingSchedule.Friday    = null;
            weeklyAutoScalingSchedule.Saturday  = null;
            weeklyAutoScalingSchedule.Sunday    = 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("Monday", targetDepth))
                    {
                        weeklyAutoScalingSchedule.Monday = new Dictionary <String, String>();
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                                weeklyAutoScalingSchedule.Monday.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("Tuesday", targetDepth))
                    {
                        weeklyAutoScalingSchedule.Tuesday = new Dictionary <String, String>();
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                                weeklyAutoScalingSchedule.Tuesday.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("Wednesday", targetDepth))
                    {
                        weeklyAutoScalingSchedule.Wednesday = new Dictionary <String, String>();
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                                weeklyAutoScalingSchedule.Wednesday.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("Thursday", targetDepth))
                    {
                        weeklyAutoScalingSchedule.Thursday = new Dictionary <String, String>();
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                                weeklyAutoScalingSchedule.Thursday.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("Friday", targetDepth))
                    {
                        weeklyAutoScalingSchedule.Friday = new Dictionary <String, String>();
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                                weeklyAutoScalingSchedule.Friday.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("Saturday", targetDepth))
                    {
                        weeklyAutoScalingSchedule.Saturday = new Dictionary <String, String>();
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                                weeklyAutoScalingSchedule.Saturday.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("Sunday", targetDepth))
                    {
                        weeklyAutoScalingSchedule.Sunday = new Dictionary <String, String>();
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                                weeklyAutoScalingSchedule.Sunday.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(weeklyAutoScalingSchedule);
                }
            }


            return(weeklyAutoScalingSchedule);
        }
Пример #17
0
        public WeeklyAutoScalingSchedule Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            WeeklyAutoScalingSchedule weeklyAutoScalingSchedule = new WeeklyAutoScalingSchedule();



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

            while (context.Read())
            {
                if (context.TestExpression("Monday", targetDepth))
                {
                    context.Read();
                    weeklyAutoScalingSchedule.Monday = new Dictionary <String, String>();
                    KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        weeklyAutoScalingSchedule.Monday.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

                if (context.TestExpression("Tuesday", targetDepth))
                {
                    context.Read();
                    weeklyAutoScalingSchedule.Tuesday = new Dictionary <String, String>();
                    KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        weeklyAutoScalingSchedule.Tuesday.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

                if (context.TestExpression("Wednesday", targetDepth))
                {
                    context.Read();
                    weeklyAutoScalingSchedule.Wednesday = new Dictionary <String, String>();
                    KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        weeklyAutoScalingSchedule.Wednesday.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

                if (context.TestExpression("Thursday", targetDepth))
                {
                    context.Read();
                    weeklyAutoScalingSchedule.Thursday = new Dictionary <String, String>();
                    KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        weeklyAutoScalingSchedule.Thursday.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

                if (context.TestExpression("Friday", targetDepth))
                {
                    context.Read();
                    weeklyAutoScalingSchedule.Friday = new Dictionary <String, String>();
                    KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        weeklyAutoScalingSchedule.Friday.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

                if (context.TestExpression("Saturday", targetDepth))
                {
                    context.Read();
                    weeklyAutoScalingSchedule.Saturday = new Dictionary <String, String>();
                    KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        weeklyAutoScalingSchedule.Saturday.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

                if (context.TestExpression("Sunday", targetDepth))
                {
                    context.Read();
                    weeklyAutoScalingSchedule.Sunday = new Dictionary <String, String>();
                    KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        weeklyAutoScalingSchedule.Sunday.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

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


            return(weeklyAutoScalingSchedule);
        }
        public Message Unmarshall(XmlUnmarshallerContext context)
        {
            Message message       = new Message();
            int     originalDepth = context.CurrentDepth;
            int     targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("MessageId", targetDepth))
                    {
                        message.MessageId = StringUnmarshaller.GetInstance().Unmarshall(context);

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

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

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

                        continue;
                    }
                    if (context.TestExpression("Attribute", targetDepth))
                    {
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        message.Attributes.Add(kvp.Key, kvp.Value);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(message);
                }
            }



            return(message);
        }
Пример #19
0
        public TaskObject Unmarshall(JsonUnmarshallerContext context)
        {
            TaskObject taskObject = new TaskObject();

            taskObject.Objects = 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("TaskId", targetDepth))
                    {
                        taskObject.TaskId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

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

                    if (context.TestExpression("Objects", targetDepth))
                    {
                        taskObject.Objects = new Dictionary <String, PipelineObject>();
                        KeyValueUnmarshaller <string, PipelineObject, StringUnmarshaller, PipelineObjectUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, PipelineObject, StringUnmarshaller, PipelineObjectUnmarshaller>(StringUnmarshaller.GetInstance(), PipelineObjectUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, PipelineObject> kvp = unmarshaller.Unmarshall(context);
                                taskObject.Objects.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(taskObject);
                }
            }


            return(taskObject);
        }
Пример #20
0
        public Layer Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            Layer layer = new Layer();



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

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

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

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

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

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

                if (context.TestExpression("Attributes", targetDepth))
                {
                    context.Read();
                    layer.Attributes = new Dictionary <String, String>();
                    KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        layer.Attributes.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

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

                if (context.TestExpression("CustomSecurityGroupIds", targetDepth))
                {
                    context.Read();
                    layer.CustomSecurityGroupIds = new List <String>();
                    StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        layer.CustomSecurityGroupIds.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("DefaultSecurityGroupNames", targetDepth))
                {
                    context.Read();
                    layer.DefaultSecurityGroupNames = new List <String>();
                    StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        layer.DefaultSecurityGroupNames.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("Packages", targetDepth))
                {
                    context.Read();
                    layer.Packages = new List <String>();
                    StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        layer.Packages.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("VolumeConfigurations", targetDepth))
                {
                    context.Read();
                    layer.VolumeConfigurations = new List <VolumeConfiguration>();
                    VolumeConfigurationUnmarshaller unmarshaller = VolumeConfigurationUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        layer.VolumeConfigurations.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("EnableAutoHealing", targetDepth))
                {
                    context.Read();
                    layer.EnableAutoHealing = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("AutoAssignElasticIps", targetDepth))
                {
                    context.Read();
                    layer.AutoAssignElasticIps = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("AutoAssignPublicIps", targetDepth))
                {
                    context.Read();
                    layer.AutoAssignPublicIps = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("DefaultRecipes", targetDepth))
                {
                    context.Read();
                    layer.DefaultRecipes = RecipesUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("CustomRecipes", targetDepth))
                {
                    context.Read();
                    layer.CustomRecipes = RecipesUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

                if (context.TestExpression("InstallUpdatesOnBoot", targetDepth))
                {
                    context.Read();
                    layer.InstallUpdatesOnBoot = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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


            return(layer);
        }
Пример #21
0
        private static void UnmarshallResult(JsonUnmarshallerContext context, QueryResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("Items", targetDepth))
                {
                    context.Read();
                    response.Items = new List <Dictionary <string, AttributeValue> >();
                    DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.Items.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

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

                if (context.TestExpression("LastEvaluatedKey", targetDepth))
                {
                    context.Read();
                    response.LastEvaluatedKey = new Dictionary <String, AttributeValue>();
                    KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, AttributeValue> kvp = unmarshaller.Unmarshall(context);
                        response.LastEvaluatedKey.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

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

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

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

            while (context.Read())
            {
                if (context.TestExpression("Responses", targetDepth))
                {
                    context.Read();
                    response.Responses = new Dictionary <String, List <Dictionary <string, AttributeValue> > >();
                    if (context.CurrentTokenType == JsonToken.Null)
                    {
                        continue;
                    }
                    KeyValueUnmarshaller <string, List <Dictionary <string, AttributeValue> >, StringUnmarshaller, ListUnmarshaller <Dictionary <string, AttributeValue>, DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> > > unmarshaller = new KeyValueUnmarshaller <string, List <Dictionary <string, AttributeValue> >, StringUnmarshaller, ListUnmarshaller <Dictionary <string, AttributeValue>, DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> > >(StringUnmarshaller.GetInstance(), new ListUnmarshaller <Dictionary <string, AttributeValue>, DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> >(new DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance())));
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, List <Dictionary <string, AttributeValue> > > kvp = unmarshaller.Unmarshall(context);
                        response.Responses.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

                if (context.TestExpression("UnprocessedKeys", targetDepth))
                {
                    context.Read();
                    response.UnprocessedKeys = new Dictionary <String, KeysAndAttributes>();
                    if (context.CurrentTokenType == JsonToken.Null)
                    {
                        continue;
                    }
                    KeyValueUnmarshaller <string, KeysAndAttributes, StringUnmarshaller, KeysAndAttributesUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, KeysAndAttributes, StringUnmarshaller, KeysAndAttributesUnmarshaller>(StringUnmarshaller.GetInstance(), KeysAndAttributesUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, KeysAndAttributes> kvp = unmarshaller.Unmarshall(context);
                        response.UnprocessedKeys.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

                if (context.TestExpression("ConsumedCapacity", targetDepth))
                {
                    context.Read();
                    response.ConsumedCapacity = new List <ConsumedCapacity>();
                    if (context.CurrentTokenType == JsonToken.Null)
                    {
                        continue;
                    }
                    ConsumedCapacityUnmarshaller unmarshaller = ConsumedCapacityUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.ConsumedCapacity.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

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

            return;
        }
Пример #23
0
        public App Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            App app = new App();



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

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

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

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

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

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

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

                if (context.TestExpression("AppSource", targetDepth))
                {
                    context.Read();
                    app.AppSource = SourceUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("Domains", targetDepth))
                {
                    context.Read();
                    app.Domains = new List <String>();
                    StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        app.Domains.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("EnableSsl", targetDepth))
                {
                    context.Read();
                    app.EnableSsl = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("SslConfiguration", targetDepth))
                {
                    context.Read();
                    app.SslConfiguration = SslConfigurationUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("Attributes", targetDepth))
                {
                    context.Read();
                    app.Attributes = new Dictionary <String, String>();
                    KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        app.Attributes.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

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

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


            return(app);
        }
Пример #24
0
        public VideoParameters Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonUnmarshallerContext.TokenType.Null)
            {
                return(null);
            }
            VideoParameters videoParameters = new VideoParameters();

            videoParameters.CodecOptions = null;
            videoParameters.Watermarks   = 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("Codec", targetDepth))
                    {
                        videoParameters.Codec = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("CodecOptions", targetDepth))
                    {
                        videoParameters.CodecOptions = new Dictionary <String, String>();
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                                videoParameters.CodecOptions.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

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

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

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

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

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

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

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

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

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

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

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

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

                    if (context.TestExpression("Watermarks", targetDepth))
                    {
                        videoParameters.Watermarks = new List <PresetWatermark>();
                        PresetWatermarkUnmarshaller unmarshaller = PresetWatermarkUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                videoParameters.Watermarks.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(videoParameters);
                }
            }


            return(videoParameters);
        }
        public QueryResult Unmarshall(JsonUnmarshallerContext context)
        {
            QueryResult queryResult = new QueryResult();

            queryResult.Items            = null;
            queryResult.LastEvaluatedKey = 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("Items", targetDepth))
                    {
                        queryResult.Items = new List <Dictionary <string, AttributeValue> >();
                        DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                queryResult.Items.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("Count", targetDepth))
                    {
                        queryResult.Count = IntUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("LastEvaluatedKey", targetDepth))
                    {
                        queryResult.LastEvaluatedKey = new Dictionary <String, AttributeValue>();
                        KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, AttributeValue> kvp = unmarshaller.Unmarshall(context);
                                queryResult.LastEvaluatedKey.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("ConsumedCapacity", targetDepth))
                    {
                        queryResult.ConsumedCapacity = ConsumedCapacityUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(queryResult);
                }
            }


            return(queryResult);
        }
Пример #26
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public AuthenticateCognitoActionConfig Unmarshall(XmlUnmarshallerContext context)
        {
            AuthenticateCognitoActionConfig unmarshalledObject = new AuthenticateCognitoActionConfig();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("AuthenticationRequestExtraParams/entry", targetDepth))
                    {
                        var unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
                        var item         = unmarshaller.Unmarshall(context);
                        unmarshalledObject.AuthenticationRequestExtraParams.Add(item);
                        continue;
                    }
                    if (context.TestExpression("OnUnauthenticatedRequest", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        unmarshalledObject.OnUnauthenticatedRequest = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("Scope", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        unmarshalledObject.Scope = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("SessionCookieName", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        unmarshalledObject.SessionCookieName = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("SessionTimeout", targetDepth))
                    {
                        var unmarshaller = LongUnmarshaller.Instance;
                        unmarshalledObject.SessionTimeout = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("UserPoolArn", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        unmarshalledObject.UserPoolArn = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("UserPoolClientId", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        unmarshalledObject.UserPoolClientId = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("UserPoolDomain", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        unmarshalledObject.UserPoolDomain = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(unmarshalledObject);
                }
            }

            return(unmarshalledObject);
        }
Пример #27
0
        public SourceDataMap Unmarshall(XmlUnmarshallerContext context)
        {
            SourceDataMap sourceDataMap = new SourceDataMap();
            int           originalDepth = context.CurrentDepth;
            int           targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("SourceName", targetDepth))
                    {
                        sourceDataMap.SourceName = StringUnmarshaller.GetInstance().Unmarshall(context);

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

                        continue;
                    }
                    if (context.TestExpression("Cases/entry", targetDepth))
                    {
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        sourceDataMap.Cases.Add(kvp.Key, kvp.Value);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(sourceDataMap);
                }
            }



            return(sourceDataMap);
        }
        public PutItemResult Unmarshall(JsonUnmarshallerContext context)
        {
            PutItemResult putItemResult = new PutItemResult();

            putItemResult.Attributes = 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("Attributes", targetDepth))
                    {
                        putItemResult.Attributes = new Dictionary <String, AttributeValue>();
                        KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, AttributeValue> kvp = unmarshaller.Unmarshall(context);
                                putItemResult.Attributes.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("ConsumedCapacity", targetDepth))
                    {
                        putItemResult.ConsumedCapacity = ConsumedCapacityUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("ItemCollectionMetrics", targetDepth))
                    {
                        putItemResult.ItemCollectionMetrics = ItemCollectionMetricsUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(putItemResult);
                }
            }


            return(putItemResult);
        }
       private static void UnmarshallResult(JsonUnmarshallerContext context,QueryResponse response)
       {
         
           int originalDepth = context.CurrentDepth;
           int targetDepth = originalDepth + 1;
           while (context.Read())
           {
             
             if (context.TestExpression("Items", targetDepth))
             {
               context.Read();
               response.Items = new List<Dictionary<string,AttributeValue>>();
                       DictionaryUnmarshaller<string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new DictionaryUnmarshaller<string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(),AttributeValueUnmarshaller.GetInstance());
               while (context.Read())
               {
                 JsonToken token = context.CurrentTokenType;                
                 if (token == JsonToken.ArrayStart)
                 {
                   continue;
                 }
                 if (token == JsonToken.ArrayEnd)
                 {
                   break;
                 }
                  response.Items.Add(unmarshaller.Unmarshall(context));
               }
               continue;
             }
 
             if (context.TestExpression("Count", targetDepth))
             {
               context.Read();
               response.Count = IntUnmarshaller.GetInstance().Unmarshall(context);
               continue;
             }
 
             if (context.TestExpression("LastEvaluatedKey", targetDepth))
             {
               context.Read();
               response.LastEvaluatedKey = new Dictionary<String,AttributeValue>();
               KeyValueUnmarshaller<string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> unmarshaller = new KeyValueUnmarshaller<string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance());
               while (context.Read())
               {
                 JsonToken token = context.CurrentTokenType;
                 if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                 {
                     continue;
                 }
                 if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                 {
                     break;
                 }
                 KeyValuePair<string, AttributeValue> kvp = unmarshaller.Unmarshall(context);
                   response.LastEvaluatedKey.Add(kvp.Key, kvp.Value);
               }
               continue;
             }
 
             if (context.TestExpression("ConsumedCapacity", targetDepth))
             {
               context.Read();
               response.ConsumedCapacity = ConsumedCapacityUnmarshaller.GetInstance().Unmarshall(context);
               continue;
             }
 
               if (context.CurrentDepth <= originalDepth)
               {                   
                   return;
               }
           }
                       
           return;
       }                        
Пример #30
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, GetSubscriptionAttributesResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Attributes/entry", targetDepth))
                    {
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        response.Attributes.Add(kvp.Key, kvp.Value);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return;
                }
            }



            return;
        }
       private static void UnmarshallResult(JsonUnmarshallerContext context,BatchGetItemResponse response)
       {
         
           int originalDepth = context.CurrentDepth;
           int targetDepth = originalDepth + 1;
           while (context.Read())
           {
             
             if (context.TestExpression("Responses", targetDepth))
             {
               context.Read();
               response.Responses = new Dictionary<String,List<Dictionary<string,AttributeValue>>>();
               if (context.CurrentTokenType == JsonToken.Null)
               {
                   continue;
               }
               KeyValueUnmarshaller<string, List<Dictionary<string,AttributeValue>>, StringUnmarshaller, ListUnmarshaller<Dictionary<string,AttributeValue>, DictionaryUnmarshaller<string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>>> unmarshaller = new KeyValueUnmarshaller<string, List<Dictionary<string,AttributeValue>>, StringUnmarshaller, ListUnmarshaller<Dictionary<string,AttributeValue>, DictionaryUnmarshaller<string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>>>(StringUnmarshaller.GetInstance(), new ListUnmarshaller<Dictionary<string,AttributeValue>, DictionaryUnmarshaller<string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>>(new DictionaryUnmarshaller<string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(),AttributeValueUnmarshaller.GetInstance())));
               while (context.Read())
               {
                 JsonToken token = context.CurrentTokenType;
                 if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                 {
                     continue;
                 }
                 if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                 {
                     break;
                 }
                 KeyValuePair<string, List<Dictionary<string,AttributeValue>>> kvp = unmarshaller.Unmarshall(context);
                   response.Responses.Add(kvp.Key, kvp.Value);
               }
               continue;
             }
 
             if (context.TestExpression("UnprocessedKeys", targetDepth))
             {
               context.Read();
               response.UnprocessedKeys = new Dictionary<String,KeysAndAttributes>();
               if (context.CurrentTokenType == JsonToken.Null)
               {
                   continue;
               }
               KeyValueUnmarshaller<string, KeysAndAttributes, StringUnmarshaller, KeysAndAttributesUnmarshaller> unmarshaller = new KeyValueUnmarshaller<string, KeysAndAttributes, StringUnmarshaller, KeysAndAttributesUnmarshaller>(StringUnmarshaller.GetInstance(), KeysAndAttributesUnmarshaller.GetInstance());
               while (context.Read())
               {
                 JsonToken token = context.CurrentTokenType;
                 if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                 {
                     continue;
                 }
                 if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                 {
                     break;
                 }
                 KeyValuePair<string, KeysAndAttributes> kvp = unmarshaller.Unmarshall(context);
                   response.UnprocessedKeys.Add(kvp.Key, kvp.Value);
               }
               continue;
             }
 
             if (context.TestExpression("ConsumedCapacity", targetDepth))
             {
               context.Read();
               response.ConsumedCapacity = new List<ConsumedCapacity>();
               if (context.CurrentTokenType == JsonToken.Null)
               {
                   continue;
               }
                 ConsumedCapacityUnmarshaller unmarshaller = ConsumedCapacityUnmarshaller.GetInstance();
               while (context.Read())
               {
                 JsonToken token = context.CurrentTokenType;                
                 if (token == JsonToken.ArrayStart)
                 {
                   continue;
                 }
                 if (token == JsonToken.ArrayEnd)
                 {
                   break;
                 }
                  response.ConsumedCapacity.Add(unmarshaller.Unmarshall(context));
               }
               continue;
             }
 
               if (context.CurrentDepth <= originalDepth)
               {                   
                   return;
               }
           }
                       
           return;
       }                        
Пример #32
0
        public Endpoint Unmarshall(XmlUnmarshallerContext context)
        {
            Endpoint endpoint      = new Endpoint();
            int      originalDepth = context.CurrentDepth;
            int      targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("EndpointArn", targetDepth))
                    {
                        endpoint.EndpointArn = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Attributes/entry", targetDepth))
                    {
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        endpoint.Attributes.Add(kvp.Key, kvp.Value);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(endpoint);
                }
            }



            return(endpoint);
        }
Пример #33
0
        public DeploymentCommand Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            DeploymentCommand deploymentCommand = new DeploymentCommand();



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

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

                if (context.TestExpression("Args", targetDepth))
                {
                    context.Read();
                    deploymentCommand.Args = new Dictionary <String, List <string> >();
                    KeyValueUnmarshaller <string, List <string>, StringUnmarshaller, ListUnmarshaller <string, StringUnmarshaller> > unmarshaller = new KeyValueUnmarshaller <string, List <string>, StringUnmarshaller, ListUnmarshaller <string, StringUnmarshaller> >(StringUnmarshaller.GetInstance(), new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.GetInstance()));
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, List <string> > kvp = unmarshaller.Unmarshall(context);
                        deploymentCommand.Args.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

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


            return(deploymentCommand);
        }
Пример #34
0
        public BatchGetItemResult Unmarshall(JsonUnmarshallerContext context)
        {
            BatchGetItemResult batchGetItemResult = new BatchGetItemResult();

            batchGetItemResult.Responses        = null;
            batchGetItemResult.UnprocessedKeys  = null;
            batchGetItemResult.ConsumedCapacity = 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("Responses", targetDepth))
                    {
                        batchGetItemResult.Responses = new Dictionary <String, List <Dictionary <string, AttributeValue> > >();
                        KeyValueUnmarshaller <string, List <Dictionary <string, AttributeValue> >, StringUnmarshaller, ListUnmarshaller <Dictionary <string, AttributeValue>, DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> > > unmarshaller = new KeyValueUnmarshaller <string, List <Dictionary <string, AttributeValue> >, StringUnmarshaller, ListUnmarshaller <Dictionary <string, AttributeValue>, DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> > >(StringUnmarshaller.GetInstance(), new ListUnmarshaller <Dictionary <string, AttributeValue>, DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller> >(new DictionaryUnmarshaller <string, AttributeValue, StringUnmarshaller, AttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), AttributeValueUnmarshaller.GetInstance())));
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, List <Dictionary <string, AttributeValue> > > kvp = unmarshaller.Unmarshall(context);
                                batchGetItemResult.Responses.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("UnprocessedKeys", targetDepth))
                    {
                        batchGetItemResult.UnprocessedKeys = new Dictionary <String, KeysAndAttributes>();
                        KeyValueUnmarshaller <string, KeysAndAttributes, StringUnmarshaller, KeysAndAttributesUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, KeysAndAttributes, StringUnmarshaller, KeysAndAttributesUnmarshaller>(StringUnmarshaller.GetInstance(), KeysAndAttributesUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, KeysAndAttributes> kvp = unmarshaller.Unmarshall(context);
                                batchGetItemResult.UnprocessedKeys.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("ConsumedCapacity", targetDepth))
                    {
                        batchGetItemResult.ConsumedCapacity = new List <ConsumedCapacity>();
                        ConsumedCapacityUnmarshaller unmarshaller = ConsumedCapacityUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                batchGetItemResult.ConsumedCapacity.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(batchGetItemResult);
                }
            }


            return(batchGetItemResult);
        }
Пример #35
0
        public Message Unmarshall(XmlUnmarshallerContext context)
        {
            Message unmarshalledObject = new Message();
            int     originalDepth      = context.CurrentDepth;
            int     targetDepth        = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Attribute", targetDepth))
                    {
                        var unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        var item         = unmarshaller.Unmarshall(context);
                        unmarshalledObject.Attributes.Add(item);
                        continue;
                    }
                    if (context.TestExpression("Body", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.GetInstance();
                        unmarshalledObject.Body = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("MD5OfBody", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.GetInstance();
                        unmarshalledObject.MD5OfBody = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("MD5OfMessageAttributes", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.GetInstance();
                        unmarshalledObject.MD5OfMessageAttributes = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("MessageAttribute", targetDepth))
                    {
                        var unmarshaller = new KeyValueUnmarshaller <string, MessageAttributeValue, StringUnmarshaller, MessageAttributeValueUnmarshaller>(StringUnmarshaller.GetInstance(), MessageAttributeValueUnmarshaller.GetInstance());
                        var item         = unmarshaller.Unmarshall(context);
                        unmarshalledObject.MessageAttributes.Add(item);
                        continue;
                    }
                    if (context.TestExpression("MessageId", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.GetInstance();
                        unmarshalledObject.MessageId = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ReceiptHandle", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.GetInstance();
                        unmarshalledObject.ReceiptHandle = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(unmarshalledObject);
                }
            }

            return(unmarshalledObject);
        }
        public DeploymentCommand Unmarshall(JsonUnmarshallerContext context)
        {
            DeploymentCommand deploymentCommand = new DeploymentCommand();

            deploymentCommand.Args = 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("Name", targetDepth))
                    {
                        deploymentCommand.Name = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Args", targetDepth))
                    {
                        deploymentCommand.Args = new Dictionary <String, List <string> >();
                        KeyValueUnmarshaller <string, List <string>, StringUnmarshaller, ListUnmarshaller <string, StringUnmarshaller> > unmarshaller = new KeyValueUnmarshaller <string, List <string>, StringUnmarshaller, ListUnmarshaller <string, StringUnmarshaller> >(StringUnmarshaller.GetInstance(), new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.GetInstance()));
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, List <string> > kvp = unmarshaller.Unmarshall(context);
                                deploymentCommand.Args.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(deploymentCommand);
                }
            }


            return(deploymentCommand);
        }
       private static void UnmarshallResult(JsonUnmarshallerContext context,BatchWriteItemResponse response)
       {
         
           int originalDepth = context.CurrentDepth;
           int targetDepth = originalDepth + 1;
           while (context.Read())
           {
             
             if (context.TestExpression("UnprocessedItems", targetDepth))
             {
               context.Read();
               response.UnprocessedItems = new Dictionary<String,List<WriteRequest>>();
               if (context.CurrentTokenType == JsonToken.Null)
               {
                   continue;
               }
               KeyValueUnmarshaller<string, List<WriteRequest>, StringUnmarshaller, ListUnmarshaller<WriteRequest, WriteRequestUnmarshaller>> unmarshaller = new KeyValueUnmarshaller<string, List<WriteRequest>, StringUnmarshaller, ListUnmarshaller<WriteRequest, WriteRequestUnmarshaller>>(StringUnmarshaller.GetInstance(), new ListUnmarshaller<WriteRequest, WriteRequestUnmarshaller>(WriteRequestUnmarshaller.GetInstance()));
               while (context.Read())
               {
                 JsonToken token = context.CurrentTokenType;
                 if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                 {
                     continue;
                 }
                 if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                 {
                     break;
                 }
                 KeyValuePair<string, List<WriteRequest>> kvp = unmarshaller.Unmarshall(context);
                   response.UnprocessedItems.Add(kvp.Key, kvp.Value);
               }
               continue;
             }
 
             if (context.TestExpression("ItemCollectionMetrics", targetDepth))
             {
               context.Read();
               response.ItemCollectionMetrics = new Dictionary<String,List<ItemCollectionMetrics>>();
               if (context.CurrentTokenType == JsonToken.Null)
               {
                   continue;
               }
               KeyValueUnmarshaller<string, List<ItemCollectionMetrics>, StringUnmarshaller, ListUnmarshaller<ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller>> unmarshaller = new KeyValueUnmarshaller<string, List<ItemCollectionMetrics>, StringUnmarshaller, ListUnmarshaller<ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller>>(StringUnmarshaller.GetInstance(), new ListUnmarshaller<ItemCollectionMetrics, ItemCollectionMetricsUnmarshaller>(ItemCollectionMetricsUnmarshaller.GetInstance()));
               while (context.Read())
               {
                 JsonToken token = context.CurrentTokenType;
                 if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                 {
                     continue;
                 }
                 if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                 {
                     break;
                 }
                 KeyValuePair<string, List<ItemCollectionMetrics>> kvp = unmarshaller.Unmarshall(context);
                   response.ItemCollectionMetrics.Add(kvp.Key, kvp.Value);
               }
               continue;
             }
 
             if (context.TestExpression("ConsumedCapacity", targetDepth))
             {
               context.Read();
               response.ConsumedCapacity = new List<ConsumedCapacity>();
               if (context.CurrentTokenType == JsonToken.Null)
               {
                   continue;
               }
                 ConsumedCapacityUnmarshaller unmarshaller = ConsumedCapacityUnmarshaller.GetInstance();
               while (context.Read())
               {
                 JsonToken token = context.CurrentTokenType;                
                 if (token == JsonToken.ArrayStart)
                 {
                   continue;
                 }
                 if (token == JsonToken.ArrayEnd)
                 {
                   break;
                 }
                  response.ConsumedCapacity.Add(unmarshaller.Unmarshall(context));
               }
               continue;
             }
 
               if (context.CurrentDepth <= originalDepth)
               {                   
                   return;
               }
           }
                       
           return;
       }