コード例 #1
0
        /// <summary>
        /// 获取小说章节线程
        /// </summary>
        public void Thread_Get_Fiction_Poster()
        {
            _i_Success = 0;
            _i_Fail    = 0;
            List <tb_fiction_info> _ltfi = _1_DAL.Cls_Fiction_Info._o_Get_Fiction_List_By_Query("limit 0,50000");

            _i_All_Count = _ltfi.Count();

            Tbx_Msg.BeginInvoke(new Action(() =>
            {
                Lab_All.Text = _i_All_Count.ToString();
            }));

            _4_ScrawlCore._0_BQG.Cls_Fiction_Poster _cfp = new _4_ScrawlCore._0_BQG.Cls_Fiction_Poster();
            foreach (tb_fiction_info _tfi in _ltfi)
            {
                Show_Msg("开始获取小说编号为【" + _tfi.col_fiction_id + "】的小说封皮", 0);
                if (_cfp._b_Get_Fiction_Poster(Environment.CurrentDirectory + "//Poster//" + _tfi.col_fiction_id.ToString() + ".jpg", _tfi.col_url_poster))
                {
                    _i_Success += 1;
                    Show_Msg("获取成功!封皮链接:" + _tfi.col_url_poster, 1);
                }
                else
                {
                    _i_Fail += 1;
                    Show_Msg("获取失败!", 2);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 显示消息
        /// </summary>
        /// <param name="_msg"></param>
        public void Show_Msg(string _msg, int _i_type = 0)
        {
            string _s_Type = "";

            switch (_i_type)
            {
            case 0:
                _s_Type = "INFO";
                break;

            case 1:
                _s_Type = " OK ";
                break;

            case 2:
                _s_Type = "ERR ";
                break;

            default:
                _s_Type = "NULL";
                break;
            }
            Tbx_Msg.BeginInvoke(new Action(() =>
            {
                Tbx_Msg.AppendText(DateTime.Now.ToString("[yyyy-MM-dd hh:mm:ss]=>") + "(" + _s_Type + ")"
                                   + _msg + "\r\n");
                Lab_Success.Text = _i_Success.ToString();
                Lab_Fail.Text    = _i_Fail.ToString();
                PgB_Main.Value   = (int)((_i_Success + _i_Fail) * 100 / _i_All_Count);
            }));
        }
コード例 #3
0
 private void Btn_Get_Fiction_Poster_Click(object sender, EventArgs e)
 {
     if (_th_Main != null && _th_Main.IsAlive)
     {
         _th_Main.Abort();
         _th_Main.Join();
         _th_Main = null;
     }
     else
     {
         Tbx_Msg.Clear();
         _th_Main = new Thread(Thread_Get_Fiction_Poster);
         _th_Main.Start();
     }
 }
コード例 #4
0
        private void Button1_Click(object sender, EventArgs e)
        {
            //_4_ScrawlCore._0_BQG.Cls_HomePage _sc = new _4_ScrawlCore._0_BQG.Cls_HomePage("https://www.qu.la/book/3/");
            //tb_fiction_info _tfi= _sc._o_Get_Fiction_Info();
            //_1_DAL.Cls_Fiction_Info._b_Insert_Fiction_Info(_tfi);
            if (Nud_Max_Val.Value <= Nud_Min_Val.Value)
            {
                MessageBox.Show("爬取范围有误!", "提示");
                return;
            }

            if (TH_Main != null && TH_Main.IsAlive)
            {
                TH_Main.Abort();
                TH_Main.Join();
                TH_Main = null;
            }
            else
            {
                Tbx_Msg.Clear();
                TH_Main = new Thread(TH_Get_Fiction_Info);
                TH_Main.Start();
            }
        }