Пример #1
0
        public Dorm(string cookie, MainForm mainForm)
        {
            this.cookie = cookie;
            this.mainForm = mainForm;

            for (int i = 0; i < MAXPAGE; i++)
                boards[i] = new DormBoard();

            setBoard();
        }
Пример #2
0
        private void setBoard(int sPage = 1, int ePage = 3)
        {
            for (int i = 0; i < 3 * 10; i++)
            {
                boards[i] = new DormBoard();
            }

            for (int pageNum = sPage; pageNum <= ePage; pageNum++)
            {
                // http://dorm.unist.ac.kr/admin/board/view.asp?intNowPage=1&board_nm=dorm_notice&idx=2885

                string url = "http://dorm.unist.ac.kr/admin/board/list.asp?board_nm=dorm_notice&intNowPage=" + pageNum;
                if (!getResponse(url))
                    return;

                doc = (IHTMLDocument2)new HTMLDocument();
                doc.clear();
                doc.write(resResult);
                doc.close();

                IEnumerable<IHTMLElement> tags = ElementsByTagName(doc, "tr");
                string[] rows = new string[5];

                for (int i = 1; i < tags.Count(); i++)
                {
                    string html=tags.ElementAt(i).innerHTML;
                    boards[i].link = html.Split('\'')[0];

                }
            }
        }