示例#1
0
        private int imagesTotal = 0; //图片总数

        private void Reset()
        {
            link = new LinkOperating();
            lblLinkCount.Text = link.LinkCount().ToString();
            IsChange          = false;
            page         = new PageOperating();
            link         = new LinkOperating();
            titleAndLink = new Hashtable();
            generaLink   = new Queue();
            webQueue     = new Queue();
            status       = new LinkStatus();
        }
示例#2
0
        public static PageOperating Start()
        {
            PageOperating page = new PageOperating();

            StreamReader reader = new StreamReader("link.txt");
            string       tmp    = "";

            while ((tmp = reader.ReadLine()) != null)
            {
                if (tmp != "")
                {
                    page.GetPage(tmp);
                }
            }

            reader.Dispose();
            reader.Close();

            return(page);
        }
示例#3
0
        private void Parse()
        {
            page         = ParsePage.Start();//解析下载页面
            titleAndLink = page.TitleAndLink;
            generaLink   = page.GeneraLink;
            lblInfo.Invoke(new MethodInvoker(delegate {
                lblInfo.Text = "解析完成了喵~~ 正在下载图片...";
            }));

            Init();

            lvwLinkShow.Invoke(new MethodInvoker(delegate
            {
                foreach (DictionaryEntry de in titleAndLink)
                {
                    if (((Queue)de.Value).Count == 0)
                    {
                        continue;
                    }
                    for (int i = 0; i < lvwLinkShow.Items.Count; ++i)
                    {
                        if (lvwLinkShow.Items[i].SubItems[0].Text == ((string[])((Queue)de.Value).Peek())[0])
                        {
                            lvwLinkShow.Items[i].SubItems[1].Text = ((Queue)de.Value).Count.ToString();
                        }
                    }
                }
            }));

            imagesTotal = generaLink.Count;
            status.Add(generaLink);//储存链接到查询类

            for (int i = 0; i < threadCount; ++i)
            {
                ThreadStart ts = new ThreadStart(Process);
                m_ImagesThread[i] = new Thread(ts);
                m_ImagesThread[i].IsBackground = true;
                m_ImagesThread[i].Start();
            }
        }