public static LaunchPermissionUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new LaunchPermissionUnmarshaller();
            }

            return(instance);
        }
Ejemplo n.º 2
0
        public ImageAttribute Unmarshall(XmlUnmarshallerContext context)
        {
            ImageAttribute imageAttribute = new ImageAttribute();
            int            originalDepth  = context.CurrentDepth;
            int            targetDepth    = originalDepth + 1;

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

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

                        continue;
                    }
                    if (context.TestExpression("launchPermission/item", targetDepth))
                    {
                        imageAttribute.LaunchPermissions.Add(LaunchPermissionUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("productCodes/item", targetDepth))
                    {
                        imageAttribute.ProductCodes.Add(ProductCodeUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("kernel/value", targetDepth))
                    {
                        imageAttribute.KernelId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("ramdisk/value", targetDepth))
                    {
                        imageAttribute.RamdiskId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("description/value", targetDepth))
                    {
                        imageAttribute.Description = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("sriovNetSupport/value", targetDepth))
                    {
                        imageAttribute.SriovNetSupport = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("blockDeviceMapping/item", targetDepth))
                    {
                        imageAttribute.BlockDeviceMappings.Add(BlockDeviceMappingUnmarshaller.GetInstance().Unmarshall(context));

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



            return(imageAttribute);
        }