public void RefreshCurrent(SyncList l) { XmlNode xmlNode = animeNodes.Item(i++); //TODO BUG check upper limits string id = xmlNode.FindChild("series_animedb_id").InnerText; SyncItem si = l.FindWithId(id); if (si != null) { FillItem(si, l.Template, xmlNode); } prog++; }
public SyncItem FindWithId(string id) { foreach (MItem mi in Items) { if (mi is SyncItem) { SyncItem si = mi as SyncItem; if (si.Id.Equals(id)) { return(si); } } } return(null); }
private void FillItem(SyncItem si, Dictionary <string, FieldTemplateItem> template, XmlNode animeNode) { //Console.WriteLine("anime node id: " + si.Id); HtmlDocument htmlDoc = new HtmlDocument(); System.Diagnostics.Stopwatch s = System.Diagnostics.Stopwatch.StartNew(); string htmlStr = webClient.DownloadString("http://myanimelist.net/anime/" + si.Id + "/"); htmlDoc.LoadHtml(htmlStr); foreach (string fieldName in template.Keys) { FieldTemplateItem fti = template[fieldName]; if (fti is SyncTemplateItem) { SyncTemplateItem sti = fti as SyncTemplateItem; si[fieldName].Value = sti.ParamList[0].Equals("XML") ? FindDataFromXML(sti, animeNode.FindChild(sti.Id)) : FindDataFromHTML(htmlDoc, sti); } } //Console.WriteLine("time: " + s.ElapsedMilliseconds); }
internal bool StartRefreshOneTask(SyncList sl, SyncItem si, int shownList) { return(StartTask(sl, SyncTask.ONE, si, shownList)); }
public void RefreshOne(SyncList l, SyncItem si) { //TODO implement prog++; }