private void ParserYYets(CQ doc) { if (null != Links) { Links.Clear(); Links = null; } Links = new List<DBEpisode>(); string[] str = System.Web.HttpUtility.HtmlDecode(doc.Select("title")[0].InnerText).Split(','); this.Title = str[0] + "," + str[1]; var items = doc.Select("ul[class=resod_list]"); foreach (IDomElement item in items) { var season = item.GetAttribute("season"); if (season.CompareTo("103") == 0) season = "預告片區"; else season = "第 " + season + " 季"; foreach (IDomElement epi in item.ChildElements) { var format = epi.GetAttribute("format"); var epiIdx = epi.GetAttribute("episode"); var title = epi.ChildElements.ElementAt(0).ChildElements.ElementAt(1).ChildElements.ElementAt(0).GetAttribute("title"); var downloads = epi.ChildElements.ElementAt(1).ChildElements.ElementAt(0); foreach (var download in downloads.ChildElements) { if (download.NodeName.ToLower() == "a") { var href = download.GetAttribute("href"); if ((href == null) || (href.Length <= 0)) continue; var kind = System.Web.HttpUtility.HtmlDecode(download.InnerText); var dbepi = new DBEpisode(); dbepi.Format = format; dbepi.Link = href; dbepi.Name = title; dbepi.Season = season; dbepi.Kind = kind; Links.Add(dbepi); } } } } }
private void AddToTreeView(DBEpisode lnk, bool badd) { var nodeSeason = GetNode(tvLinks.Nodes, lnk.Season); if (null == nodeSeason) { if (badd) nodeSeason = tvLinks.Nodes.Add(lnk.Season); else nodeSeason = tvLinks.Nodes.Insert(0, lnk.Season); } var nodeFormat = GetNode(nodeSeason.Nodes, lnk.Format); if (null == nodeFormat) nodeFormat = nodeSeason.Nodes.Add(lnk.Format); var nodeKind = GetNode(nodeFormat.Nodes, lnk.Kind); if (null == nodeKind) nodeKind = nodeFormat.Nodes.Add(lnk.Kind); var node = nodeKind.Nodes.Add(lnk.Name); node.ToolTipText = lnk.Link; node.Checked = lnk.Download; }