private void BtnMulu_Click(object sender, EventArgs e) { //string cn = "第二八八章 危险的地方"; //string num = Chinese2Num(cn); //listBox1.Items.Add(num); //return; string novalurl = txtNameURL.Text; //novalurl = "https://www.qb5.tw/shu/100487.html"; if (string.IsNullOrWhiteSpace(novalurl)) { AlertMessage("小说目录路径不能为空"); return; } //抓取目录页面dom string html = HttpHelpr.HttpGet(novalurl, "", "1", "utf-8"); string charset = DownFiles.GetEncode(html); if (charset != "utf-8") { html = HttpHelpr.HttpGet(novalurl, "", "1", charset); } string muluroot = DownFiles.GetMuluRoot(html); MatchCollection sMC = DownFiles.GetMulu(muluroot); Dictionary <string, string> list = DownFiles.RemoteUrlList(sMC); foreach (var item in list) { listBox1.Items.Add(item.Value + DownFiles.Chinese2Num(item.Key)); } AlertMessage("读取完成" + list.Count.ToString()); }
string path = "C://Noval//DownFile//" + DateTime.Now.ToString("yyyy-MM-dd") + "//";//AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/") + "DownFile/"; private void Btn_StartRead_Click(object sender, EventArgs e) { //string str = "第二四零 这里我有些熟悉"; //string msg=DownFiles.Chinese2Num(str); //MessageBox.Show(msg); //return; this.progressBar1.Maximum = 0; this.progressBar1.Value = 0; txtDownDirectry.Text = ""; string novalurl = txtNameURL.Text; string xsname = "我的小说" + DateTime.Now.ToString("yyyyMMddHHmmss"); processNum = Convert.ToInt32(numericUpDown1.Value); if (processNum == 0) { processNum = 2; } if (string.IsNullOrWhiteSpace(novalurl)) { Accomplish("小说目录路径不能为空"); return; } //novalurl = "https://www.ddxsku.com/files/article/html/36/36102/index.html"; //抓取整本小说 string html = HttpHelpr.HttpGet(novalurl, "", "1", "utf-8"); charset = DownFiles.GetEncode(html); if (charset != "utf-8") { html = HttpHelpr.HttpGet(novalurl, "", "1", charset); } string title = DownFiles.GetNovelName(html); xsname = string.IsNullOrEmpty(title) ? xsname : title; string muluroot = DownFiles.GetMuluRoot(html); MatchCollection sMC = DownFiles.GetMulu(muluroot); list = DownFiles.RemoteUrlList(sMC); path1 = path + xsname + "//"; if (list.Count != 0) { int taskCount = list.Count; this.progressBar1.Maximum = taskCount; this.progressBar1.Value = 0; new Thread(ParallelFunction) { IsBackground = true }.Start(); txtDownDirectry.Text = path1; } else { Accomplish("没有提取到章节地址"); } }