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); }
public static TwitterAccessInformation ParseXml(XElement xml) { if (xml == null) { return(new TwitterAccessInformation()); } return(new TwitterAccessInformation { ConsumerKey = SocialUtils.GetElementValue <string>(xml, "ConsumerKey"), ConsumerSecret = SocialUtils.GetElementValue <string>(xml, "ConsumerSecret"), AccessToken = SocialUtils.GetElementValue <string>(xml, "AccessToken"), AccessTokenSecret = SocialUtils.GetElementValue <string>(xml, "AccessTokenSecret") ?? SocialUtils.GetElementValue <string>(xml, "AccessSecret") }); }
public static VimeoVideo Parse(XElement xVideo) { if (xVideo == null || xVideo.Name != "video") { return(null); } return(new VimeoVideo { Id = SocialUtils.GetElementValue <int>(xVideo, "id"), Title = SocialUtils.GetElementValue <string>(xVideo, "title"), Description = SocialUtils.GetElementValue <string>(xVideo, "description"), Url = SocialUtils.GetElementValue <string>(xVideo, "url"), UploadedDate = SocialUtils.GetElementValue <DateTime>(xVideo, "upload_date"), Duration = TimeSpan.FromSeconds(SocialUtils.GetElementValue <int>(xVideo, "duration")), Width = SocialUtils.GetElementValue <int>(xVideo, "width"), Height = SocialUtils.GetElementValue <int>(xVideo, "height"), Tags = (SocialUtils.GetElementValue <string>(xVideo, "tags") ?? "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries) }); }