internal static AwsImage FromXmlNode(XmlNode node)
        {
            AwsImageType imageType;
            Enum.TryParse<AwsImageType>(node.Name, out imageType);

            string url = null;
            string height = null;
            string width = null;

            foreach (XmlNode child in node.ChildNodes)
                if (child.Name.Equals("URL", StringComparison.CurrentCultureIgnoreCase))
                    url = child.Value ?? child.InnerText;
                else if (child.Name.Equals("Height", StringComparison.CurrentCultureIgnoreCase))
                    height = child.Value ?? child.InnerText;
                else if (child.Name.Equals("Width", StringComparison.CurrentCultureIgnoreCase))
                    width = child.Value ?? child.InnerText;

            var image = new AwsImage
            {
                Type = imageType,
                URL = url,
                Height = XmlHelper.GetInt(height),
                Width = XmlHelper.GetInt(width)
            };

            return image;
        }
        internal static AwsImageSet FromXmlNode(XmlNode node)
        {
            var imageSet = new AwsImageSet();

            AwsImageSetCategory category;

            if (Enum.TryParse <AwsImageSetCategory>(XmlHelper.GetAttributeValue(node, "Category"), out category))
            {
                imageSet.Category = category;
            }

            foreach (XmlNode imageNode in node.ChildNodes)
            {
                imageSet.Images.Add(AwsImage.FromXmlNode(imageNode));
            }

            return(imageSet);
        }
Exemple #3
0
        internal static AwsImage FromXmlNode(XmlNode node)
        {
            AwsImageType imageType;

            Enum.TryParse <AwsImageType>(node.Name, out imageType);

            string url    = null;
            string height = null;
            string width  = null;

            foreach (XmlNode child in node.ChildNodes)
            {
                if (child.Name.Equals("URL", StringComparison.CurrentCultureIgnoreCase))
                {
                    url = child.Value ?? child.InnerText;
                }
                else if (child.Name.Equals("Height", StringComparison.CurrentCultureIgnoreCase))
                {
                    height = child.Value ?? child.InnerText;
                }
                else if (child.Name.Equals("Width", StringComparison.CurrentCultureIgnoreCase))
                {
                    width = child.Value ?? child.InnerText;
                }
            }

            var image = new AwsImage
            {
                Type   = imageType,
                URL    = url,
                Height = XmlHelper.GetInt(height),
                Width  = XmlHelper.GetInt(width)
            };

            return(image);
        }