Esempio n. 1
0
        public List<Link> GetLinks(string urlHead,int pageNeededNumber)
        {
            List<Link> links = new List<Link>();
            string url ;
            for (int i = 0; i < pageNeededNumber; i++)
            {
                url = urlHead + 50 * i;
                WebPage page = new WebPage(url);
                links.AddRange(page.getSpecialLinksByUrl("/p/", 50));
            }

            StreamWriter sw = new StreamWriter("C:\\Users\\LENOVO\\Desktop\\urls3.0.txt",false,Encoding.UTF8);
            for (int i = 0; i < links.Count; i++)
            {
                sw.Write(links[i].NavigateUrl + "\r\n");
            }
            sw.Close();

            return links;
        }
Esempio n. 2
0
 public static List<Control> GetControls(this Control control, bool includeChildren)
 {
     Control[] ctrlArr = new Control[control.Controls.Count];
     control.Controls.CopyTo(ctrlArr, 0);
     List<Control> controls = new List<Control>(ctrlArr);
     if (includeChildren)
     {
         foreach (Control ctrl in ctrlArr)
         {
             controls.AddRange(ctrl.GetControls(includeChildren));
         }
     }
     return controls;
 }
Esempio n. 3
0
        private List<string> GetSegmentWords(List<string> content)
        {
            Segment segment = new Segment();

            List<string> segmentWords = new List<string>();
            foreach (string s in content)
            {
                ICollection<WordInfo> words = segment.DoSegment(s);
                List<string> sWords = new List<string>();
                foreach (WordInfo wordInfo in words)
                {
                    if (wordInfo == null)
                    {
                        continue;
                    }
                    sWords.Add(wordInfo.Word);
                }
                segmentWords.AddRange(sWords);
            }
            return segmentWords;
        }