Esempio n. 1
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;
        }
Esempio n. 2
0
        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);
        }
Esempio n. 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);
        }