示例#1
0
        private void HotComic(string url, PublicThing comicDecoder)
        {
            mainFrame.SelectedPageIndex = 0;
            tabControl1.TabPages.Clear();
            SetGifVisable();

            Task task = new Task(() =>
            {
                try
                {
                    lock (getLock)
                    {
                        var response = AnalyseTool.HttpGet(url);

                        if (response == "")
                        {
                            SetGifHidden();
                            return;
                        }
                        var comicTop = comicDecoder.GetTopComic(response);
                        SetProgressBar(comicTop);
                    }
                }
                catch (Exception ex)
                {
                }
            });

            task.Start();
        }
示例#2
0
        public override DownLoadComic GetDownImageList(string response)
        {
            var           retMsg = "";
            DownLoadComic comic  = new DownLoadComic();

            Regex [] regex = new Regex[4];
            regex[0] = new Regex(@"id=""hdPageCount""\svalue=""(?<count>\d+)""");
            regex[1] = new Regex(@"id=""hdVolID""\svalue=""(?<sid>\d+)""");
            regex[2] = new Regex(@"id=""hdS""\svalue=""(?<hds>\d+)""");
            regex[3] = new Regex(@"id=""hdPageIndex""\svalue=""(?<index>\d+)""");
            var comicCout    = Convert.ToInt32(regex[0].Match(response).Groups["count"].Value);
            var sid          = Convert.ToInt32(regex[1].Match(response).Groups["sid"].Value);
            var s            = Convert.ToInt32(regex[2].Match(response).Groups["hds"].Value);
            var currtntIndex = Convert.ToInt32(regex[3].Match(response).Groups["index"].Value);

            List <string> urlList  = new List <string>();
            List <string> htmlList = new List <string>();
            var           html     = "";

            for (int i = currtntIndex; i < comicCout; i++)
            {
                html = hostAttach + "/" + "cool" + sid + "/" + i.ToString() + ".html?s=" + s;
                htmlList.Add(html);
            }

            foreach (var i in htmlList)
            {
                retMsg = AnalyseTool.HttpGet(i, Encoding.UTF8);
                urlList.Add(GetImageUrl(retMsg));
            }

            comic.ImageList = urlList;
            comic.Count     = urlList.Count;
            return(comic);
        }
示例#3
0
        private string GenerateAjax(string response)
        {
            var DM5_CID        = "";
            var DM5_MID        = "";
            var DM5_PAGE       = "";
            var DM5_ViewSign   = "";
            var DM5_ViewSignDt = "";
            var DM5_CURL       = "";
            var ImageCount     = "";
            var retStr         = "";

            DM5_CID        = Regex.Match(response, @"DM5_CID\s*=\s*(?<data>\d+)").Groups["data"].Value;
            DM5_MID        = Regex.Match(response, @"DM5_MID\s*=\s*(?<data>\d+)").Groups["data"].Value;
            DM5_PAGE       = Regex.Match(response, @"DM5_PAGEINDEX\s*=\s*(?<data>\d+)").Groups["data"].Value;
            DM5_ViewSign   = Regex.Match(response, @"DM5_VIEWSIGN\s*=\s*""(?<data>\w+)""").Groups["data"].Value;
            DM5_ViewSignDt = Regex.Match(response, @"DM5_VIEWSIGN_DT\s*=\s*""(?<data>[\w\-\s\:\+\%]*)""").Groups["data"].Value;
            DM5_CURL       = Regex.Match(response, @"DM5_CURL\s*=\s*""(?<data>[\w-/]*)""").Groups["data"].Value;
            ImageCount     = Regex.Match(response, @"DM5_IMAGE_COUNT\s*=\s*(?<data>\d+)").Groups["data"].Value;

            retStr = hostAttach + DM5_CURL + "chapterfun.ashx?cid=" + DM5_CID + "&page=" + DM5_PAGE + "&key=" + ""
                     + "&language=1&gtk=6&_cid=" + DM5_CID + "&_mid=" + DM5_MID + "&_dt=" + DM5_ViewSignDt + "&_sign=" + DM5_ViewSign;

            retStr = AnalyseTool.HttpGet(retStr, hostAttach + DM5_CURL);
            DecodeOne(retStr);
            return(retStr);
        }
示例#4
0
        private void DecodeCategory(string listUrl)//解析每一栏的标签页
        {
            Task task = new Task(() =>
            {
                var msg           = AnalyseTool.HttpGet(listUrl);
                decoder           = DecoderDistrution.GiveDecoder(listUrl);
                decoder.BackUrl   = listUrl;
                var cateCollect   = decoder.FindComicByCategory(msg);
                resource.NextPage = cateCollect.NextPageUrl;
                resource.LastPage = cateCollect.LastPageUrl;

                progressBar1.Invoke(new Action(() =>
                {
                    progressBar1.Value   = 0;
                    progressBar1.Maximum = cateCollect.ComicQueue.Count;
                    resultListView.Items.Clear();
                }));

                ViewStruct view = new ViewStruct();
                view.Queue      = cateCollect.ComicQueue;
                view.ViewAdd    = resultListView;

                if (m_exitLoad == false)
                {
                    m_exitLoad = true;
                }

                getThread = new Thread(new ParameterizedThreadStart(GetImagesList));
                getThread.Start(view);
            });

            task.Start();
        }
示例#5
0
        private void FenLei(string url, PublicThing comicDecoder)//通用分类方法
        {
            var count = 0;

            DevExpress.XtraTab.XtraTabPage tab;
            mainFrame.SelectedPageIndex = 0;

            Task task = new Task(() =>
            {
                try
                {
                    lock (getLock)
                    {
                        var response = AnalyseTool.HttpGet(url);

                        if (response == "")
                        {
                            MessageBox.Show("加载图片失败");
                            return;
                        }

                        tabControl1.Invoke(new Action(() =>
                        {
                            var cateInfo = comicDecoder.GiveCategoryInfo(response);
                            tabControl1.TabPages.Clear();
                            resource.CategoryCollect = cateInfo.ComicList;

                            foreach (var i in cateInfo.ComicList)
                            {
                                tab      = new DevExpress.XtraTab.XtraTabPage();
                                tab.Text = i.Key;
                                tabControl1.TabPages.Add(tab);

                                if (count++ > 15)
                                {
                                    break;
                                }
                            }
                        }));

                        if (resource.CategoryCollect.Count > 0)
                        {
                            var key = "";

                            foreach (var i in resource.CategoryCollect)
                            {
                                key = i.Key;
                                break;
                            }
                        }
                    }
                }
                catch
                {
                }
            });

            task.Start();
        }
示例#6
0
        public void GetNetComic(DownLoadFile downFile)
        {
            Task task = new Task(() =>
            {
                FileStream file;
                var path           = "";
                var decoder        = DecoderDistrution.GiveDecoder(downFile.ComicUrl);
                var response       = AnalyseTool.HttpGet(downFile.ComicUrl);
                decoder.currentUrl = downFile.ComicUrl;
                var ds             = decoder.GetDownImageList(response);
                path = DownLoadPath + "\\" + ComicName + "\\";

                if (File.Exists(path) == false)
                {
                    Directory.CreateDirectory(path);
                }

                int errorCount = 0;
                int read       = 0;
                int count      = 0;

                foreach (var i in ds.ImageList)
                {
                    file       = new FileStream(path + (count++) + ".jpg", FileMode.Create);
                    var stream = DownLoad(i, SourceUrl);

                    while (stream == null && errorCount < 3)
                    {
                        Thread.Sleep(100);
                        stream = DownLoad(i, SourceUrl);
                        errorCount++;
                    }

                    byte[] buffer = new byte[32768];

                    while ((read = stream.Read(buffer, 0, buffer.Length)) > 0)
                    {
                        file.Write(buffer, 0, read);
                    }

                    if (addFileEvent != null)
                    {
                        addFileEvent(this, file.Name);
                    }

                    file.Flush();
                    stream.Flush();
                    file.Close();
                    stream.Close();
                }
            });

            task.Start();
        }
示例#7
0
        private void searchBtn_Click(object sender, EventArgs e)
        {
            var response = "";
            var url      = "";
            var name     = "";

            if (searchControl.Text == "")
            {
                return;
            }

            var keyWord = HttpUtility.UrlEncode(searchControl.Text, Encoding.UTF8);

            foreach (RadioButton r in flowControl.Controls)
            {
                if (r.Checked)
                {
                    name = r.Name;
                    break;
                }
            }

            SetGifVisable();

            Task task = new Task(() =>
            {
                lock (getLock)
                {
                    switch (name)
                    {
                    case "hanhanCheck": url = "http://www.hhimm.com/comic/?act=search&st=" + keyWord; break;

                    case "manhuarenCheck": url = "http://www.1kkk.com/search?title=" + keyWord; break;

                    case "k886Check": url = "https://www.k886.net/search-index?searchType=1&q=" + keyWord; break;

                    case "jiulingCheck": url = "http://m.90mh.com/search/?keywords=" + keyWord; break;

                    case "veryDmCheck": url = "http://www.veryimapp.com/index.php?r=comic%2Fsearch&keyword=" + keyWord; break;

                    case "manhuaduiCheck": url = "https://www.manhuadui.com/search/?keywords=" + keyWord; break;

                    case "mangebzCheck": url = "http://www.mangabz.com/search?title=" + keyWord; break;
                    }

                    response = AnalyseTool.HttpGet(url);
                    decoder  = DecoderDistrution.GiveDecoder(url);
                    SearchComic(response);
                }
            });

            task.Start();
        }
示例#8
0
        private List <string> GenerateImage(string response)
        {
            var DM5_CID        = "";
            var DM5_MID        = "";
            var DM5_PAGE       = "";
            var DM5_ViewSign   = "";
            var DM5_ViewSignDt = "";
            var DM5_CURL       = "";
            var ImageCount     = "";
            var retStr         = "";

            List <string> dataList;

            dataList = new List <string>();

            DM5_CURL = Regex.Match(response, @"DM5_CURL\s*=\s*""(?<data>[\w-/]*)""").Groups["data"].Value;
            var nextPageUrl = hostAttach + DM5_CURL.Substring(0, DM5_CURL.LastIndexOf("/")) + "-p2";

            DM5_CURL       = Regex.Match(response, @"DM5_CURL\s*=\s*""(?<data>[\w-/]*)""").Groups["data"].Value;
            DM5_CID        = Regex.Match(response, @"DM5_CID\s*=\s*(?<data>\d+)").Groups["data"].Value;
            DM5_MID        = Regex.Match(response, @"DM5_MID\s*=\s*(?<data>\d+)").Groups["data"].Value;
            DM5_PAGE       = Regex.Match(response, @"DM5_PAGEINDEX\s*=\s*(?<data>\d+)").Groups["data"].Value;
            DM5_ViewSign   = Regex.Match(response, @"DM5_VIEWSIGN\s*=\s*""(?<data>\w+)""").Groups["data"].Value;
            DM5_ViewSignDt = Regex.Match(response, @"DM5_VIEWSIGN_DT\s*=\s*""(?<data>[\w\-\s\:\+\%]*)""").Groups["data"].Value;
            DM5_ViewSignDt = System.Web.HttpUtility.UrlEncode(DM5_ViewSignDt, System.Text.Encoding.UTF8);
            ImageCount     = Regex.Match(response, @"DM5_IMAGE_COUNT\s*=\s*(?<data>\d+)").Groups["data"].Value;

            var nextDir = DM5_CURL;
            var jsUrl   = hostAttach + nextDir + "chapterfun.ashx?cid=" + DM5_CID + "&page=" + DM5_PAGE + "&key=" + ""
                          + "&language=1&gtk=6&_cid=" + DM5_CID + "&_mid=" + DM5_MID + "&_dt=" + DM5_ViewSignDt + "&_sign=" + DM5_ViewSign;

            retStr = AnalyseTool.HttpGet(jsUrl);

            if (retStr == "")
            {
                return(null);
            }

            int total = Convert.ToInt32(ImageCount);

            dataList = DecodeOne(retStr);

            if (dataList.Count < Convert.ToInt32(ImageCount))
            {
                response = AnalyseTool.HttpGet(nextPageUrl);
                dataList.AddRange(GenerateImage(response));
            }
            return(dataList);
        }
示例#9
0
        private string GetDomain()
        {
            string serverUrl = "";
            string configUrl = "http://www.90mh.com/js/config.js";
            string response  = AnalyseTool.HttpGet(configUrl);

            if (response == null)
            {
                serverUrl = "http://img.zzszs.com.cn";
            }

            string temp = response.Substring(response.IndexOf("domain"));

            temp      = temp.Substring(temp.IndexOf("[") + 1, temp.IndexOf("]") - temp.IndexOf("[") - 1);
            serverUrl = temp.Replace("\"", "");
            return(serverUrl);
        }
示例#10
0
        private void searchBtn_Click(object sender, EventArgs e)
        {
            var response = "";
            var url      = "";
            var name     = "";
            var keyWord  = HttpUtility.UrlEncode(searchControl.Text, Encoding.UTF8);

            RadioButton[] radio = { k886Check, kanCheck, hanhanCheck, jingmingyanCheck };

            foreach (RadioButton r in radio)
            {
                if (r.Checked)
                {
                    name = r.Name;
                    break;
                }
            }

            Task task = new Task(() =>
            {
                switch (name)
                {
                case "hanhanCheck": url = "http://www.hhmmoo.com/comic/?act=search&st=" + keyWord; break;

                //case "jingmingyanCheck": url = "http://www.jmydm.com/comic/s.aspx"; response = AnalyseTool.PostWebRequest(url, "tbSTxt=" + keyWord);break;
                case "kanCheck": url = "http://www.manhuagui.com/s/" + keyWord + ".html"; break;

                case "k886Check": url = "https://www.k886.net/search-index?searchType=1&q=" + keyWord; break;
                }

                response = AnalyseTool.HttpGet(url);
                decoder  = DecoderDistrution.GiveDecoder(url);
                SearchComic(response);
            });

            task.Start();
        }
示例#11
0
        private void HotComic(string url, PublicThing comicDecoder)
        {
            mainFrame.SelectedPageIndex = 0;
            tabControl1.TabPages.Clear();
            runGif.Visible = true;

            Task task = new Task(() =>
            {
                var response = AnalyseTool.HttpGet(url);

                if (response == "")
                {
                    runGif.Invoke(new Action(() =>
                    {
                        runGif.Visible = false;
                    }));
                    return;
                }
                var comicTop = comicDecoder.GetTopComic(response);
                SetProgressBar(comicTop);
            });

            task.Start();
        }
示例#12
0
        private void StartNewDownLoad(List <DownLoadFile> downloadFile, PublicThing decoder)//开始全新下载
        {
            var fullPath = "";

            downlistCollection = new List <DownListBox>();

            try
            {
                Task task = new Task(() =>
                {
                    DownListBox downlist = null;

                    foreach (var i in downloadFile)
                    {
                        DownTask downTask = new DownTask();
                        var url           = i.ComicUrl;
                        var response      = AnalyseTool.HttpGet(url);
                        var down          = decoder.GetDownImageList(response);//解析图片真实地址

                        if (filePanel.InvokeRequired)
                        {
                            this.Invoke(new Action(() =>
                            {
                                downlist          = new DownListBox();
                                downTask.ReferUrl = url;
                                downlist.SetMaxPage(down.ImageList.Count); //下载最大值
                                downlist.Title    = i.ComicName;           //漫画名字
                                downlist.Location = new Point(0, panelPos);
                                downlist.Pages    = down.ImageList.Count;
                                filePanel.Controls.Add(downlist);
                            }));
                        }

                        downlistCollection.Add(downlist);                //添加到控件集合
                        downTask.ComicName            = i.ComicName;
                        downTask.downLoadOneFinished += DownOneFinsihed; //下载完成一个图片
                        downTask.downFinished        += DownAllFinished;
                        downTask.downPaused          += DownPause;
                        downTask.ImageFiles           = down.ImageList;

                        if (File.Exists(i.SavePath) == false)
                        {
                            fullPath = i.SavePath + i.ComicName + "\\";
                            Directory.CreateDirectory(i.SavePath + i.ComicName + "\\");
                        }

                        downlist.FilePath     = fullPath;
                        downTask.DownLoadPath = fullPath;
                        time = DateTime.Now;
                        downTask.DownLoadStart();
                        panelPos = panelPos + downlist.Height;
                    }
                });

                task.Start();
            }
            catch (Exception ex)
            {
                Console.WriteLine("开始下载出错:{0}", ex.Message);
            }
        }
示例#13
0
        public override DownLoadComic GetDownImageList(string response)
        {
            DownLoadComic downLoad   = new DownLoadComic();
            Regex         urlRegex   = new Regex(@"MANGABZ_CURL\s*=\s*""(?<data>[\w/]*)""");
            Regex         midRegex   = new Regex(@"MANGABZ_MID\s*=\s*(?<data>\d+)");
            Regex         cidRegex   = new Regex(@"MANGABZ_CID=(?<data>\d+)");
            Regex         signRegex  = new Regex(@"MANGABZ_VIEWSIGN=""(?<data>\w+)""");
            Regex         dtRegex    = new Regex(@"MANGABZ_VIEWSIGN_DT=""(?<data>[\w\s\-\:]*)""");
            Regex         countRegex = new Regex(@"MANGABZ_IMAGE_COUNT\s*=\s*(?<data>\d+)");

            var url   = "";
            var mid   = "";
            var cid   = "";
            var sign  = "";
            var dt    = "";
            var count = Convert.ToInt32(countRegex.Match(response).Groups["data"].Value);

            var           requestUrl = "";
            string        temp       = "";
            List <string> urlList    = new List <string>();

            urlList.Add(currentUrl);

            for (int i = 1; i < count + 1; i++)
            {
                temp = currentUrl + "#ipg" + i;
                urlList.Add(temp);
            }

            int pos = 1;

            downLoad.ImageList = new List <string>();

            for (int i = 0; i < urlList.Count; i++)
            {
                response = AnalyseTool.HttpGet(urlList[i]);
                url      = urlRegex.Match(response).Groups["data"].Value;
                mid      = midRegex.Match(response).Groups["data"].Value;
                cid      = cidRegex.Match(response).Groups["data"].Value;
                sign     = signRegex.Match(response).Groups["data"].Value;

                requestUrl = host + string.Format("{0}chapterimage.ashx?cid={1}&page={2}&key=&" +
                                                  "_cid={1}&_mid={3}&_dt={4}&sign={5}", url, cid, pos++, mid, System.Web.HttpUtility.UrlEncode(dt), sign);

                var msg = AnalyseTool.HttpGet(requestUrl, currentUrl);

                if (msg == "")
                {
                    msg = AnalyseTool.HttpGet(requestUrl, currentUrl);
                }

                url = urlRegex.Match(response).Groups["data"].Value;

                if (msg != null && msg.Length > 0)
                {
                    Microsoft.JScript.ArrayObject obj = AnalyseTool.EvalJScript(msg);
                    int len = Convert.ToInt32(obj.length);

                    for (int k = 0; k < len; k++)
                    {
                        string imgUrl = obj[k].ToString();

                        if (downLoad.ImageList.Exists(o => o == imgUrl) == false)
                        {
                            downLoad.ImageList.Add(imgUrl);
                        }
                    }
                }
            }

            downLoad.Count = downLoad.ImageList.Count;
            return(downLoad);
        }
示例#14
0
        private void StartNewDownLoad(List <DownLoadFile> downloadFile, PublicThing decoder, int startIndex = 0)//开始全新下载
        {
            var fullPath = "";

            try
            {
                Task task = new Task(() =>
                {
                    DownListBox downItem = null;
                    List <DownListBox> downList;
                    downList = new List <DownListBox>();
                    ShowBallTip("正在解析,请稍等!", "提示");

                    foreach (var i in downloadFile)
                    {
                        DownTask downTask  = new DownTask();
                        var url            = i.ComicUrl;
                        var response       = AnalyseTool.HttpGet(url, url);
                        decoder.currentUrl = url;

                        if (response == "")
                        {
                            MessageBox.Show("下载时获取网页错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        var down = decoder.GetDownImageList(response);//解析图片真实地址

                        if (down == null || down.ImageList == null || down.Count == 0)
                        {
                            MessageBox.Show("获取网页数据失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        this.Invoke(new Action(() =>
                        {
                            downItem                      = SearchDownListBox(i.ComicName);
                            downTask.SourceUrl            = url;
                            downItem.deleteEvent         += downItem_deleteEvent;
                            downItem.resumeDownLoadEvent += downItem_resumeDownLoadEvent;
                            downItem.SetMaxPage(down.ImageList.Count); //下载最大值
                            downItem.Title = i.ComicName;              //漫画名字
                            downItem.Pages = down.ImageList.Count;
                            filePanel.Controls.Add(downItem);
                        }));


                        if (downlistCollection.Contains(downItem) == false)
                        {
                            downlistCollection.Add(downItem);//添加到控件集合
                        }
                        downTask.ComicName            = i.ComicName;
                        downTask.downLoadOneFinished += DownOnePicFinsihed;//下载完成一个图片
                        downTask.downFinished        += DownAllFinished;
                        downTask.downPaused          += DownPause;
                        downTask.ImageFiles           = down.ImageList;

                        if (File.Exists(i.SavePath) == false)
                        {
                            fullPath = i.SavePath + "\\" + i.ComicName + "\\";
                            Directory.CreateDirectory(i.SavePath + "\\" + i.ComicName + "\\");
                        }

                        downItem.FilePath     = fullPath;
                        downTask.DownLoadPath = fullPath;
                        downTask.DownLoadStart(startIndex);
                        taskQueue.Add(downTask);
                        AddDownRecord(downTask.ComicName, downTask.SourceUrl, downTask.DownLoadPath, downTask.ImageFiles.Count, 0, 0);//添加记录到数据库
                        downList.Add(downItem);
                    }

                    ShowBallTip("解析完成,开始下载!", "提示");
                });

                task.Start();
            }
            catch (Exception ex)
            {
                Console.WriteLine("开始下载出错:{0}", ex.Message);
            }
        }
示例#15
0
        private void FillComicInfo(ListView selectView)
        {
            var receive = "";
            var url     = "";

            if (selectView.SelectedItems == null)
            {
                return;
            }

            ListViewItemInfo item = null;

            this.Invoke(new Action(() =>
            {
                item = selectView.SelectedItems[0] as ListViewItemInfo;
                mainFrame.SelectedPageIndex = 1;
                comicNameLabel.Text         = "漫画名:" + item.Text;
                comicPicBox.Image           = showImageList.Images[selectView.SelectedItems[0].Index];
                url = item.ReferUrl;
                resource.ComicName = item.Text;
                resource.ComicHref = url;
                currentItem        = item;
            }));

            //ShowWait(checkPanel);
            decoder = DecoderDistrution.GiveDecoder(url);
            receive = AnalyseTool.HttpGet(url);
            //RemoveWait(checkPanel);

            if (receive == "")
            {
                MessageBox.Show("网络错误,获取失败");
                return;
            }

            var comicInfo = decoder.GetComicInfo(receive);

            item.UrlDictronary = comicInfo.URLDictionary;

            this.Invoke(new Action(() =>
            {
                authorLab.Text = (comicInfo.Author == null || comicInfo.Author.Length == 0) ? "略" : comicInfo.Author;
                tagLabe.Text   = "标签:  " + comicInfo.Tag;
                descLable.Text = "简介:" + comicInfo.Description;
                statusLab.Text = "连载状态:" + comicInfo.HasFinished;
                checkPanel.Controls.Clear();

                if (comicInfo.URLDictionary == null)
                {
                    descLable.Text = "简介:" + "该漫画已经下架!";
                    return;
                }

                List <Controls.CheckBoxEx> list = new List <Controls.CheckBoxEx>();

                foreach (var i in comicInfo.URLDictionary)
                {
                    var checkBox  = new Controls.CheckBoxEx();
                    checkBox.Text = i.Key;
                    list.Add(checkBox);
                }
                checkPanel.Controls.AddRange(list.ToArray());
                SetGifHidden();
            }));
        }
示例#16
0
        public override DownLoadComic GetDownImageList(string response)//遍历,需要优化
        {
            int           total = 0;
            HtmlDocument  doc   = new HtmlDocument();
            DownLoadComic comic = new DownLoadComic();

            if (response == "")
            {
                return(comic);
            }

            doc.LoadHtml(response);
            HtmlNode           node    = doc.DocumentNode.SelectSingleNode("//span[@id='k_total']");
            HtmlNodeCollection collect = doc.DocumentNode.SelectNodes("//div[@class='UnderPage']/div");

            string html     = "";
            string htmlData = "";
            string nextPage = "";

            string baseHtml = collect[2].SelectSingleNode("./mip-link").Attributes["href"].Value;

            if (baseHtml.Contains("-"))
            {
                html = baseHtml.Substring(0, baseHtml.LastIndexOf("-"));
            }
            else
            {
                html = baseHtml;
            }

            total = Convert.ToInt32(node.InnerText);
            List <string> list   = new List <string>();
            string        imgUrl = collect[2].SelectSingleNode("./mip-link/mip-img").Attributes["src"].Value;

            list.Add(imgUrl);

            DateTime time = DateTime.Now;

            List <string> urlList = new List <string>();

            for (int i = 2; i < total + 1; i++)
            {
                nextPage = html + "-" + i + ".html";
                urlList.Add(nextPage);
            }

            string[] responseArry = AnalyseTool.HttpGet(urlList.ToArray());
            Console.WriteLine("获取所有访问耗时ms:{0}", DateTime.Now.Subtract(time).TotalMilliseconds);

            foreach (var i in responseArry)
            {
                if (i == "")
                {
                    return(comic);
                }
                doc.LoadHtml(i);
                list.Add(doc.DocumentNode.SelectSingleNode("//mip-img").Attributes["src"].Value);
            }

            comic.ImageList = list;
            comic.Count     = list.Count;
            return(comic);
        }
示例#17
0
        private void FillComicInfo(ListView selectView)
        {
            int x       = 0;
            int y       = 0;
            var receive = "";

            mainFrame.SelectedPageIndex = 1;
            comicNameLabel.Text         = "漫画名:" + selectView.SelectedItems[0].Text;
            var url = resourse.SearchResultURL[selectView.SelectedItems[0].Text];

            resourse.ComicName = selectView.SelectedItems[0].Text;
            resourse.ComicHref = url;
            decoder            = DecoderDistrution.GiveDecoder(url);
            receive            = AnalyseTool.HttpGet(url);

            if (receive == "")
            {
                MessageBox.Show("网络错误,获取失败");
                return;
            }
            var comicInfo = decoder.GetComicInfo(receive);

            downUrlDic        = new Dictionary <string, string>();//存储当前漫画所有图片链接
            downUrlDic        = comicInfo.URLDictionary;
            comicPicBox.Image = showImageList.Images[selectView.SelectedItems[0].Index];
            authorLab.Text    = (comicInfo.Author == null || comicInfo.Author.Length == 0)? "略":comicInfo.Author;
            tagLabe.Text      = "标签:  " + comicInfo.Tag;
            descLable.Text    = "简介:" + comicInfo.Description;
            statusLab.Text    = "连载状态:" + comicInfo.HasFinished;
            CheckBox check;

            checkPanel.Controls.Clear();

            Task task = new Task(() =>
            {
                foreach (var i in comicInfo.URLDictionary)
                {
                    check          = new CheckBox();
                    check.AutoSize = true;
                    check.Text     = i.Key;
                    check.Location = new Point(x, y);

                    this.Invoke(new Action(() =>
                    {
                        checkPanel.Controls.Add(check);
                    }));


                    if (x + check.Width + 5 > checkPanel.Width - check.Width - 10)//如果
                    {
                        x = 0;
                        y = y + check.Height + 20;
                    }
                    else
                    {
                        x = x + check.Width + 5;
                    }
                }
            });

            task.Start();
        }
示例#18
0
        public override DownLoadComic GetDownImageList(string response)
        {
            string             nextHtml = "";
            List <string>      imageList;
            HtmlDocument       doc;
            HtmlNode           node;
            HtmlNodeCollection nodeCollect;
            DownLoadComic      comic;

            doc = new HtmlDocument();
            doc.LoadHtml(response);
            comic     = new DownLoadComic();
            imageList = new List <string>();

            try
            {
                nodeCollect = doc.DocumentNode.SelectNodes("//img");
                node        = doc.DocumentNode.SelectSingleNode("//input[@id='total']");
                var total = Convert.ToInt32(node.Attributes["value"].Value);

                node = doc.DocumentNode.SelectSingleNode("//input[@id='pos']");
                var pos = Convert.ToInt32(node.Attributes["value"].Value) + 1;
                var cid = Convert.ToInt32(doc.DocumentNode.SelectSingleNode("//input[@id='cid']").Attributes["value"].Value);
                var id  = Convert.ToInt32(doc.DocumentNode.SelectSingleNode("//input[@id='id']").Attributes["value"].Value);

                nextHtml = hostName + "/index-look-cid-" + cid.ToString() + "-id-" + id.ToString() + "-p-" + pos.ToString();

                if (nodeCollect != null && nodeCollect.Count >= 2)
                {
                    imageList = FillImageList(nodeCollect[0].Attributes["src"].Value, nodeCollect[1].Attributes["src"].Value, total);

                    if (imageList.Count == total)
                    {
                        comic.Count     = imageList.Count;
                        comic.ImageList = imageList;
                        return(comic);
                    }
                }

                foreach (HtmlNode temp in nodeCollect)
                {
                    imageList.Add(temp.Attributes["src"].Value);
                }

                for (int i = 0; i < total; i++)
                {
                    response = AnalyseTool.HttpGet(nextHtml, Encoding.UTF8);
                    doc.LoadHtml(response);
                    node        = doc.DocumentNode.SelectSingleNode("//input[@id='pos']");
                    pos         = Convert.ToInt32(node.Attributes["value"].Value) + 1;
                    cid         = Convert.ToInt32(doc.DocumentNode.SelectSingleNode("//input[@id='cid']").Attributes["value"].Value);
                    id          = Convert.ToInt32(doc.DocumentNode.SelectSingleNode("//input[@id='id']").Attributes["value"].Value);
                    nextHtml    = hostName + "/index-look-cid-" + cid.ToString() + "-id-" + id.ToString() + "-p-" + pos.ToString();
                    nodeCollect = doc.DocumentNode.SelectNodes("//img");

                    foreach (HtmlNode temp in nodeCollect)
                    {
                        if (imageList.Contains(temp.Attributes["src"].Value) == false)
                        {
                            imageList.Add(temp.Attributes["src"].Value);
                        }
                    }

                    if (imageList.Count >= total || pos == total)
                    {
                        break;
                    }
                }

                comic.Count     = imageList.Count;
                comic.ImageList = imageList;
            }
            catch (Exception ex)
            {
                Console.WriteLine("KanManHua{0}.GetDownImageList,原因:{1}", ex.Message);
            }
            return(comic);
        }