Exemplo n.º 1
0
        public InventoryConfiguration Unmarshall(XmlUnmarshallerContext context)
        {
            InventoryConfiguration inventoryConfiguration = new InventoryConfiguration();
            int currentDepth = context.get_CurrentDepth();
            int num          = currentDepth + 1;

            if (context.get_IsStartOfDocument())
            {
                num += 2;
            }
            while (context.Read())
            {
                if (context.get_IsStartElement() || context.get_IsAttribute())
                {
                    if (context.TestExpression("Destination", num))
                    {
                        inventoryConfiguration.Destination = InventoryDestinationUnmarshaller.Instance.Unmarshall(context);
                    }
                    else if (context.TestExpression("IsEnabled", num))
                    {
                        inventoryConfiguration.IsEnabled = BoolUnmarshaller.get_Instance().Unmarshall(context);
                    }
                    else if (context.TestExpression("Filter", num))
                    {
                        inventoryConfiguration.InventoryFilter = InventoryFilterUnmarshaller.Instance.Unmarshall(context);
                    }
                    else if (context.TestExpression("Id", num))
                    {
                        inventoryConfiguration.InventoryId = StringUnmarshaller.get_Instance().Unmarshall(context);
                    }
                    else if (context.TestExpression("IncludedObjectVersions", num))
                    {
                        inventoryConfiguration.IncludedObjectVersions = InventoryIncludedObjectVersions.FindValue(StringUnmarshaller.get_Instance().Unmarshall(context));
                    }
                    else if (context.TestExpression("Field", num + 1))
                    {
                        inventoryConfiguration.InventoryOptionalFields.Add(InventoryOptionalField.FindValue(StringUnmarshaller.get_Instance().Unmarshall(context)));
                    }
                    else if (context.TestExpression("Schedule", num))
                    {
                        inventoryConfiguration.Schedule = InventoryScheduleUnmarshaller.Instance.Unmarshall(context);
                    }
                }
                else if (context.get_IsEndElement() && context.get_CurrentDepth() < currentDepth)
                {
                    return(inventoryConfiguration);
                }
            }
            return(inventoryConfiguration);
        }
        public InventoryConfiguration Unmarshall(XmlUnmarshallerContext context)
        {
            InventoryConfiguration response = new InventoryConfiguration();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("Destination", targetDepth))
                    {
                        response.Destination = InventoryDestinationUnmarshaller.Instance.Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("IsEnabled", targetDepth))
                    {
                        response.IsEnabled = BoolUnmarshaller.Instance.Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Filter", targetDepth))
                    {
                        response.InventoryFilter = InventoryFilterUnmarshaller.Instance.Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Id", targetDepth))
                    {
                        response.InventoryId = StringUnmarshaller.Instance.Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("IncludedObjectVersions", targetDepth))
                    {
                        response.IncludedObjectVersions = InventoryIncludedObjectVersions.FindValue(StringUnmarshaller.Instance.Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("Field", targetDepth + 1))
                    {
                        response.InventoryOptionalFields.Add(InventoryOptionalField.FindValue(StringUnmarshaller.Instance.Unmarshall(context)));

                        continue;
                    }
                    if (context.TestExpression("Schedule", targetDepth))
                    {
                        response.Schedule = InventoryScheduleUnmarshaller.Instance.Unmarshall(context);

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(response);
                }
            }



            return(response);
        }