Пример #1
0
        public static EbsUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new EbsUnmarshaller();
            }

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

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

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

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

                        continue;
                    }
                    if (context.TestExpression("Ebs", targetDepth))
                    {
                        blockDeviceMapping.Ebs = EbsUnmarshaller.GetInstance().Unmarshall(context);

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

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



            return(blockDeviceMapping);
        }