예제 #1
0
        public static TriggerUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new TriggerUnmarshaller();
            }

            return(instance);
        }
예제 #2
0
        public EnvironmentResourceDescription Unmarshall(XmlUnmarshallerContext context)
        {
            EnvironmentResourceDescription environmentResourceDescription = new EnvironmentResourceDescription();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

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

                        continue;
                    }
                    if (context.TestExpression("AutoScalingGroups/member", targetDepth))
                    {
                        environmentResourceDescription.AutoScalingGroups.Add(AutoScalingGroupUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("Instances/member", targetDepth))
                    {
                        environmentResourceDescription.Instances.Add(InstanceUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("LaunchConfigurations/member", targetDepth))
                    {
                        environmentResourceDescription.LaunchConfigurations.Add(LaunchConfigurationUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("LoadBalancers/member", targetDepth))
                    {
                        environmentResourceDescription.LoadBalancers.Add(LoadBalancerUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("Triggers/member", targetDepth))
                    {
                        environmentResourceDescription.Triggers.Add(TriggerUnmarshaller.GetInstance().Unmarshall(context));

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



            return(environmentResourceDescription);
        }