示例#1
0
        public Form1()
        {
            InitializeComponent();
            tumDP = new TumblrDocParse();

            tumDP.OnOnePostParsed += new EventHandler <TumblrEventArgs>(tumDP_OnePostParsed);
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            tumDP = new TumblrDocParse(proxyAddr.Text, proxyPort.Text, 10000);

            //  BackgroundWorker bw = new BackgroundWorker();
            //  bw.DoWork +=new DoWorkEventHandler(work);
            //  bw.RunWorkerAsync(blogName.Text);
            //tumDP.ArchiveToPosts(blogName.Text);


            List <string> tumPL = tumDP.ArchiveToPosts(blogName.Text);

            LBL_PostCNT.Text = tumPL.Count + "条";
            LBL_PostCNT.Update();


            for (int postIndex = 0; postIndex < tumPL.Count; postIndex++)
            {
                Console.WriteLine("******当前post是:" + postIndex);


                ListViewItem lvi = new ListViewItem();
                lvi.SubItems.Add(postIndex.ToString());
                lvi.SubItems.Add(tumPL[postIndex].ToString());
                lvi.SubItems.Add("");
                lvi.SubItems.Add("");
                listView1.Items.Add(lvi);
                listView1.Update();
                // tumDP.PostToImgs(tmpStr,"post");
                tumDP.AnalysisPost(tumPL[postIndex].ToString());
            }



            dataGridView1.DataSource = tumDP.GetImgDownTable();

            /**
             * tumImgDT.Columns.Add("tumImgIndex");
             * tumImgDT.Columns.Add("tumResType");
             * tumImgDT.Columns.Add("tumImgName");
             * tumImgDT.Columns.Add("tumImgURL");
             * tumImgDT.Columns.Add("tumImgSize");
             * tumImgDT.Columns.Add("tumImgPostName");
             * tumImgDT.Columns.Add("tumImgPostDate");
             * tumImgDT.Columns.Add("tumImgPostID");
             * tumImgDT.Columns.Add("tumImgPhotoSetID");
             * tumImgDT.Columns.Add("tumImgHash");
             * tumImgDT.Columns.Add("tumImgDownStatus");
             * tumImgDT.Columns.Add("tumImgDownTime");
             ***/


            dataGridView1.Columns["tumImgIndex"].HeaderText       = "序号";
            dataGridView1.Columns["tumImgIndex"].Width            = 75;
            dataGridView1.Columns["tumResType"].HeaderText        = "类型";
            dataGridView1.Columns["tumResType"].Width             = 75;
            dataGridView1.Columns["tumImgName"].HeaderText        = "文件名";
            dataGridView1.Columns["tumResourceURL"].HeaderText    = "资源URL";
            dataGridView1.Columns["tumResourceURL"].Width         = 700;
            dataGridView1.Columns["tumImgSize"].HeaderText        = "大小";
            dataGridView1.Columns["tumImgPostName"].HeaderText    = "Post名称";
            dataGridView1.Columns["tumImgPostDate"].HeaderText    = "Post日期";
            dataGridView1.Columns["tumImgPostID"].HeaderText      = "PostID";
            dataGridView1.Columns["tumNumbericPostID"].HeaderText = "纯数字PostID";
            dataGridView1.Columns["tumImgHash"].HeaderText        = "哈希";
            dataGridView1.Columns["tumImgDownStatus"].HeaderText  = "状态";
            dataGridView1.Columns["tumImgDownTime"].HeaderText    = "下载完成时间";

            /**
             * HttpWebRequest tDwnReq = tdp.getHttpWebRequest( tmpHNC.Attributes["data-imageurl"].Value) ;
             *
             * HttpWebResponse tDwnRes= tDwnReq.GetResponse() as HttpWebResponse;
             * Stream responseStream =tDwnRes.GetResponseStream();
             * Stream stream = new FileStream("c:\\t\\"+i+".jpg", FileMode.Create);
             * byte[] bArr = new byte[1024];
             * int size = responseStream.Read(bArr, 0, (int)bArr.Length);
             * while (size > 0)
             * {
             *  stream.Write(bArr, 0, size);
             *  size = responseStream.Read(bArr, 0, (int)bArr.Length);
             * }
             * stream.Close();
             * responseStream.Close();
             * i++;
             **/
        }