コード例 #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (AutorunCheck()) checkBox1.Checked = true;

            StreamData sd = new StreamData();
            ConfigRead cr = new ConfigRead();
            ParseConfig pc = new ParseConfig();

            List<List<string>> ConfigList = new List<List<string>>();
            List<List<string>> ParsedList = new List<List<string>>();
            List<string> ResultList = new List<string>();

            string config = cr.Index();

            //

            ConfigList = pc.Index(config);

            ParsedList.Add( sd.Parse("technology"));
            ParsedList.Add( sd.Parse("city"));
            ParsedList.Add( sd.Parse("status"));
            ParsedList.Add( sd.Parse("link"));
            ResultList = FindLookingItems(ConfigList, ParsedList);

            OutputData(ResultList);

        }
コード例 #2
0
        public List<string> Parse(string type)
        {
            List<string> Arr = new List<string>();
            CQ cq = CQ.Create(Read());
            ParseConfig pc = new ParseConfig();
            switch (type)
            {
                case "link":

                    foreach (IDomObject obj in cq.Find("div.clearfix h2.card-courses_title a "))
                    {
                        Arr.Add(obj.GetAttribute("href"));
                    }
                    break;

                case "technology":

                    foreach (IDomObject obj in cq.Find("div.row dl.col-xs-6:nth-child(2) dd"))
                    {
                        Arr.Add(WebUtility.HtmlDecode( pc.DeleteExcess(obj.InnerText) ));
                        
                    }
                    break;

                case "city":

                    foreach (IDomObject obj in cq.Find("div.row dl.col-xs-6:nth-child(3) dd"))
                    {
                        Arr.Add(WebUtility.HtmlDecode(pc.DeleteExcess(obj.InnerText) ));
                    }
                    break;

                case "status":

                    foreach (IDomObject obj in cq.Find("div.card-courses_label .label"))
                    {
                        Arr.Add(WebUtility.HtmlDecode(pc.DeleteExcess(obj.InnerText) ));
                    }
                    break;
                default:

                    Arr.Add("-1");
                    break;
            }

            return Arr;
        }