public List <Models.threadclass.File> parseThread(Models.threadclass.Rootobject thread) { var fileList = new List <Models.threadclass.File>(); foreach (var item in thread.threads[0].posts) { if (item.files.Count() > 0) { foreach (var file in item.files) { file.path = "https://2ch.hk/" + thread.Board + "/" + file.path; fileList.Add(file); } } } return(fileList); }
public void loadThread(Uri url) { var thread = new Models.threadclass.Rootobject(); try { string s = url.AbsoluteUri; var wb = new WebClient { Encoding = Encoding.UTF8 }; wb.Headers.Add(HttpRequestHeader.Cookie, Data.CoocieValue); var json = wb.DownloadString(url.AbsoluteUri.Substring(0, s.LastIndexOf(".")) + ".json"); thread = JsonConvert.DeserializeObject <Models.threadclass.Rootobject>(json); } catch { } threadForDownload = thread; }