Exemplo n.º 1
0
        public static InstanceStatusEventUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new InstanceStatusEventUnmarshaller();
            }

            return(instance);
        }
        public InstanceStatus Unmarshall(XmlUnmarshallerContext context)
        {
            InstanceStatus instanceStatus = new InstanceStatus();
            int            originalDepth  = context.CurrentDepth;
            int            targetDepth    = originalDepth + 1;

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

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

                        continue;
                    }
                    if (context.TestExpression("availabilityZone", targetDepth))
                    {
                        instanceStatus.AvailabilityZone = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("eventsSet/item", targetDepth))
                    {
                        instanceStatus.Events.Add(InstanceStatusEventUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("instanceState", targetDepth))
                    {
                        instanceStatus.InstanceState = InstanceStateUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("systemStatus", targetDepth))
                    {
                        instanceStatus.SystemStatus = InstanceStatusSummaryUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("instanceStatus", targetDepth))
                    {
                        instanceStatus.Status = InstanceStatusSummaryUnmarshaller.GetInstance().Unmarshall(context);

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



            return(instanceStatus);
        }