示例#1
0
        public static VolumeStatusEventUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new VolumeStatusEventUnmarshaller();
            }

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

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

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

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

                        continue;
                    }
                    if (context.TestExpression("volumeStatus", targetDepth))
                    {
                        volumeStatusItem.VolumeStatus = VolumeStatusInfoUnmarshaller.GetInstance().Unmarshall(context);

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

                        continue;
                    }
                    if (context.TestExpression("actionsSet/item", targetDepth))
                    {
                        volumeStatusItem.Actions.Add(VolumeStatusActionUnmarshaller.GetInstance().Unmarshall(context));

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



            return(volumeStatusItem);
        }