예제 #1
0
        public void getNoticeList()
        {
            _dict.Clear();

            String _classNum = MainForm.main.customListView2.FocusedItem.SubItems[5].Text;

            Uri _uri = new Uri("http://cyber.hanbat.ac.kr/MCourse.do?cmd=viewStudyHome&courseDTO.courseId=" + _classNum + "&" +
                               "               boardInfoDTO.boardInfoGubun=study_home&boardGubun=study_course&gubun=study_course");

            setGet setget = new setGet();

            setget.method(new setHttpProtocol(_uri));

            BoardId = Regex.Split(Regex.Split(setget._html, "boardInfoGubun=notice&boardInfoDTO.boardInfoId=")[1], "&")[0];

            _uri = new Uri("http://cyber.hanbat.ac.kr/MCourse.do?cmd=mviewBoardContentsList&boardInfoDTO.boardInfoGubun=notice&boardInfoDTO.boardInfoId=" + BoardId + "" +
                           "&boardInfoDTO.boardClass=notice&boardInfoDTO.boardType=course&courseDTO.courseId=" + _classNum);

            setget = new setGet();
            setget.method(new setHttpProtocol(_uri));

            foreach (String _notice in setget._html.Split(new String[] { "<li class=\"aa\" >" }, StringSplitOptions.RemoveEmptyEntries))
            {
                if (_notice.Contains("javascript:moveBoardView"))
                {
                    String _title = Regex.Split(Regex.Split(_notice, ";\">")[1], "<")[0];
                    String _addr  = Regex.Split(Regex.Split(_notice, "'")[1], "'")[0];
                    String _date  = Regex.Split(Regex.Split(_notice, "<li>")[2], "<")[0];

                    _dict.Add(_title, Tuple.Create <String, String>(_addr, _date));
                }
            }
        }
예제 #2
0
        public void getClassedList()
        {

            _dict.Clear();

            String _classNum = MainForm.main.customListView2.FocusedItem.SubItems[5].Text;

            Uri _uri = new Uri("http://cyber.hanbat.ac.kr/MCourse.do?cmd=viewStudyHome&courseDTO.courseId=" + _classNum + "&boardInfoDTO.boardInfoGubun=study_home&boardGubun=study_course&gubun=study_course");

            setGet setget = new setGet();
            setget.method(new setHttpProtocol(_uri));

            foreach (String _date in setget._html.Split(new String[] { "icon-time mr5" }, StringSplitOptions.RemoveEmptyEntries))
            {

                if (_date.Contains("boxTable"))
                {

                    List<CustomItem> _lst = new List<CustomItem>();

                    String _weekNum = Regex.Split(Regex.Split(_date, "></i>")[1], "<")[0];
                    String _deadline = Regex.Split(Regex.Split(_date, "<span>")[1], "</span>")[0];

                    String _keyValue = Regex.Replace(Regex.Replace((_weekNum + "\n" + _deadline), "\t", String.Empty), "\r\n", String.Empty).Trim();

                    _dict.Add(_keyValue, null);

                    foreach (String _info in _date.Split(new String[] { "boxTable" }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        if (_info.Contains("viewStudyContents"))
                        {

                            String _Uri = Regex.Split(Regex.Split(_info, "'")[1], "'")[0];
                            String _name = WindowsFormsApp2.Class.Option.StripHTML(Regex.Split(Regex.Split(_info, "<li><span class=\"fcBluesky\">")[1], "</li>")[0]);

                            String _curTime;
                            String _endTime;

                            if (!_info.Contains("학습안함"))
                            {
                                _curTime = Regex.Split(Regex.Split(Regex.Split(_info, "<ul class=\"bar\">")[1], ">")[1], "/")[0].Trim();
                                _endTime = Regex.Split(Regex.Split(Regex.Split(_info, "<ul class=\"bar\">")[1], "/ ")[2], "<")[0].Trim();
                            }
                            else
                            {
                                _curTime = "0";
                                _endTime = "1";
                            }

                            if (_curTime == "") _curTime = "1";

                            var a = (double)(getTime(_curTime));
                            var b = (double)(getTime(_endTime));

                            double _progressedVal = double.Parse(String.Format("{0:0.#}", (a / b) * 100));

                            CustomItem _item = new CustomItem();

                            _item._uri = _Uri;
                            _item._classId = _classNum;
                            _item._ClassName = _name;
                            _item._curTime = _curTime;
                            _item._endTime = _endTime;
                            _item._progress = (_progressedVal >= 100) ? 100 : _progressedVal;

                            _lst.Add(_item);

                        }
                    }

                    _dict[_keyValue] = _lst;

                }
            }

            showClasses();

        }