private List <Character> LFGFetchPage(int Index) { using (var w = new WebClient()) { string Raw; w.Encoding = System.Text.Encoding.UTF8; w.Headers.Add(h_UserAgent); if (Index == -1) { Raw = w.DownloadString(IndexPage); return(TableLoader.ReadTableData(Raw)); } else { Raw = w.UploadString(string.Format(NextPage, Index), RQ); return(TableLoader.ReadTableData(Raw)); } } }
private static List <Character> LFGFetchAll() { using (var w = new WebClient()) { string Raw; List <Character> lfg = new List <Character>(); w.Encoding = System.Text.Encoding.UTF8; //Download first page w.Headers.Add(h_UserAgent); Raw = w.DownloadString(IndexPage); lfg.AddRange(TableLoader.ReadTableData(Raw)); //Download all remaining bool HasData = true; int Index = 0; w.Headers.Add(h_ContentType); Console.WriteLine(); while (HasData) { Console.Write(Index + " "); Raw = w.UploadString(string.Format(NextPage, Index), RQ); if (Raw.Length == 0) { HasData = false; break; } lfg.AddRange(TableLoader.ReadTableData(Raw)); Index++; } Console.WriteLine(); return(lfg); } }