Ejemplo n.º 1
0
        public static VimeoChannel Parse(XElement xChannel)
        {
            if (xChannel == null || xChannel.Name != "channel")
            {
                return(null);
            }
            VimeoChannel channel = new VimeoChannel(xChannel)
            {
                Id                 = SocialUtils.GetElementValue <int>(xChannel, "id"),
                Name               = SocialUtils.GetElementValue <string>(xChannel, "name"),
                Description        = SocialUtils.GetElementValue <string>(xChannel, "description"),
                Logo               = SocialUtils.GetElementValue <string>(xChannel, "logo"),
                Badge              = SocialUtils.GetElementValue <string>(xChannel, "badge"),
                Url                = SocialUtils.GetElementValue <string>(xChannel, "url"),
                Rss                = SocialUtils.GetElementValue <string>(xChannel, "rss"),
                CreatedOn          = SocialUtils.GetElementValue <DateTime>(xChannel, "created_on"),
                CreatorId          = SocialUtils.GetElementValue <int>(xChannel, "creator_id"),
                CreatorDisplayName = SocialUtils.GetElementValue <string>(xChannel, "creator_display_name"),
                CreatorUrl         = SocialUtils.GetElementValue <string>(xChannel, "creator_url"),
                IsCreator          = SocialUtils.GetElementValueOrDefault <string>(xChannel, "is_creator") == "yes",
                IsMod              = SocialUtils.GetElementValueOrDefault <string>(xChannel, "is_mod") == "yes",
                TotalVideos        = SocialUtils.GetElementValue <int>(xChannel, "total_videos"),
                TotalSubscribers   = SocialUtils.GetElementValue <int>(xChannel, "total_subscribers")
            };

            if (channel.Badge == "")
            {
                channel.Badge = null;
            }
            return(channel);
        }