private void ParseForum(IHtmlDocument document) { IHtmlCollection <IElement> forumsElements = document.GetElementById("ctl00_cphRoblox_PostView1_ctl00_Whereami1").QuerySelectorAll("nobr > a"); string forumUrl = forumsElements[forumsElements.Length - 1].Attributes["href"].Value; string formName = forumsElements[forumsElements.Length - 1].TextContent; MatchCollection forumMatches = Regex.Matches(forumUrl, "[0-9]+", RegexOptions.IgnoreCase); string forumGroupUrl; string formGroupName; int forumGroupId; MatchCollection forumGroupMatches; if (forumsElements.Length == 2) { formGroupName = "ROBLOX Forum"; forumGroupId = 0; } else { forumGroupUrl = forumsElements[1].Attributes["href"].Value; forumGroupMatches = Regex.Matches(forumGroupUrl, "[0-9]+", RegexOptions.IgnoreCase); formGroupName = forumsElements[1].TextContent; forumGroupId = int.Parse(forumGroupMatches[0].Value); } Forum = new RobloxForum(forumGroupId, formName); ForumGroup = new RobloxForumGroup(int.Parse(forumMatches[0].Value), formGroupName); }
internal Forum ToDbForum(RobloxForumGroup forumGroup) { List <RobloxForum> forums = new List <RobloxForum>() { this }; return(new Forum(Id, Name, forumGroup.ToDbForum(forums))); }