コード例 #1
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();
        }
コード例 #2
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();
        }
コード例 #3
0
        public static PublicThing GiveDecoder(string url)//响应的实例化
        {
            Uri uri   = new Uri(url);
            var index = uri.Host.IndexOf(".") + 1;
            var host  = uri.Host.Substring(index);

            switch (host)
            {
            case "mangabz.com": publicdecoder = new MangaBz(); break;

            case "manhuagui.com": publicdecoder = new KanManHua(); break;

            case "jmydm.com": publicdecoder = new JingMingYan(); break;

            case "hhimm.com": publicdecoder = new HanHanManhua(); break;

            case "se": publicdecoder = new YYSLManHua(); break;

            case "k886.net": publicdecoder = new KanmanhuaK886(); break;

            case "veryimapp.com": publicdecoder = new VeryDm(); break;

            case "1kkk.com": publicdecoder = new ManHuaRen(); break;

            case "manhuadui.com": publicdecoder = new ManHuaDui(); break;

            case "huhudm.com": publicdecoder = new HuHuManHua(); break;

            case "90mh.com": publicdecoder = new JiuLingManHua(); break;

            case "m.90mh.com": publicdecoder = new JiuLingManHua(); break;
            }
            return(publicdecoder);
        }
コード例 #4
0
        public static PublicThing GiveDecoder(string url)//响应的实例化
        {
            Uri uri   = new Uri(url);
            var index = uri.Host.IndexOf(".") + 1;
            var host  = uri.Host.Substring(index);

            switch (host)
            {
            case "manhuagui.com": publicdecoder = new KanManHua(); break;

            case "jmydm.com": publicdecoder = new JingMingYan(); break;

            case "hhimm.com": publicdecoder = new HanHanManhua(); break;

            case "se": publicdecoder = new YYSLManHua(); break;

            case "dmzx.com": publicdecoder = new DongManZaiXian(); break;

            case "k886.net": publicdecoder = new KanmanhuaK886(); break;

            case "verydm.com": publicdecoder = new VeryDm(); break;

            case "1kkk.com": publicdecoder = new ManHuaRen(); break;
            }
            return(publicdecoder);
        }
コード例 #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
        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();
        }
コード例 #7
0
ファイル: DownLoadForm.cs プロジェクト: schyjxy/ComicDownLoad
        public void Start(List <DownLoadFile> downloadFile, PublicThing decoder)//批量下载任务没有实现
        {
            SqlOperate sqlOperate = new SqlOperate();

            sqlOperate.CreateOrOpenDataBase("task.db");

            try
            {
                StartNewDownLoad(downloadFile, decoder);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #8
0
        public void Start(List <DownLoadFile> downloadFile, PublicThing decoder)//批量下载任务没有实现
        {
            SqlOperate sqlOperate = new SqlOperate();

            sqlOperate.CreateOrOpenDataBase("task.db");

            try
            {
                var resumeTask = CheckIfAllDownFinished(downloadFile);

                switch (resumeTask.Count)
                {
                case 0: StartNewDownLoad(downloadFile, decoder); break; //开启新的下载任务

                default: ResumeDownLoadTask(resumeTask); break;         //存在该任务,但没有下载完成,继续下载
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #9
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            Task task = new Task(() =>
            {
                while (true)
                {
                    string url = "http://www.mangabz.com";
                    url        = "http://m.90mh.com/update/";
                    decoder    = DecoderDistrution.GiveDecoder(url);
                    HotComic(url, decoder);
                    Thread.Sleep(1000 * 20);
                }
            });

            task.Start();

            //string url = "http://www.mangabz.com/m10344/";
            //url = "http://www.mangabz.com/m115462/";
            //var response = AnalyseTool.HttpGet(url);
            //PublicThing decoder = DecoderDistrution.GiveDecoder(url);
            //decoder.GetDownImageList(response);
        }
コード例 #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
        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();
            }));
        }
コード例 #14
0
        private void comicNavBar_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            string url = "";

            if (e.Link.Caption == "分类")
            {
                switch (e.Link.Group.Name)
                {
                case "jingmingyan": url = "http://www.jmydm.com/ManhuaClass-LangmanAiqing/"; break;

                case "kanmanhua": url = "https://www.manhuagui.com/list/wanjie/"; break;

                case "hanhanmanhua": url = "http://www.hhimm.com/comic/class_1.html"; break;

                case "dongman": url = "http://www.dmzx.com/rexue-all-all-all-all/"; break;

                case "yylsmanhua": url = "http://8comic.se/category/%E6%BC%AB%E7%95%AB%E5%88%86%E9%A1%9E/%E5%86%92%E9%9A%AA/"; break;

                case "k886": url = "https://www.k886.net/index-html-status-0-typeid-0-sort-"; break;

                case "feichangaiman": url = "http://comic.veryim.com/all/"; break;

                case "manhuaren": url = "http://www.1kkk.com/manhua-list/"; break;

                case "jiu0ManHua": url = "http://m.90mh.com/search/"; break;

                case "veryDm": url = "http://www.veryimapp.com/index.php?r=comic/list&show=grid&sort=update"; break;

                case "huhumanhua": url = "http://www.huhudm.com/comic/"; break;

                case "manhuadui": url = "https://www.manhuadui.com/list/riben/"; break;

                case "mangabzName": url = "http://www.mangabz.com/manga-list/"; break;
                }

                if (url.Length > 0)
                {
                    decoder = DecoderDistrution.GiveDecoder(url);
                    FenLei(url, decoder);
                }
            }
            else
            {
                if (e.Link.Caption == "热门")
                {
                    switch (e.Link.Group.Name)
                    {
                    //case "jingmingyan": url = "http://www.jmydm.com"; break;
                    case "kanmanhua": url = "https://www.manhuagui.com"; break;

                    case "hanhanmanhua": url = "http://www.hhimm.com/"; break;

                    case "yylsmanhua": url = "http://8comic.se/"; break;

                    case "dongman": url = "http://www.dmzx.com/"; break;

                    case "k886": url = "https://www.k886.net/"; break;

                    case "feichangaiman": url = "http://www.verydm.com/"; break;

                    case "manhuaren": url = "http://www.1kkk.com/manhua-jp/"; break;

                    case "manhuadui": url = "https://www.manhuadui.com/list/riben/"; break;

                    case "huhumanhua": url = "http://www.huhudm.com/"; break;

                    case "veryDm": url = "http://www.veryimapp.com/"; break;

                    case "jiu0ManHua": url = "http://m.90mh.com/update/"; break;

                    case "mangabzName": url = "http://www.mangabz.com"; break;
                        //case "jiu0ManHua": url = "http://m.90mh.com/update/"; break;
                    }

                    if (url.Length > 0)
                    {
                        decoder = DecoderDistrution.GiveDecoder(url);
                        HotComic(url, decoder);
                    }
                }
            }
        }
コード例 #15
0
ファイル: DownLoadForm.cs プロジェクト: schyjxy/ComicDownLoad
        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);
            }
        }
コード例 #16
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();
        }