コード例 #1
0
        public List <Character> LFGFetchPage(int Index)
        {
            using (var w = new WebClient())
            {
                w.Encoding = System.Text.Encoding.UTF8;
                String Raw;

                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));
                }
            }
        }
コード例 #2
0
        public List <Character> LFGFetchAll()
        {
            using (var w = new WebClient())
            {
                List <Character> lfg = new List <Character>();
                w.Encoding = System.Text.Encoding.UTF8;
                String Raw;

                //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);
            }
        }