コード例 #1
0
ファイル: mangareader.cs プロジェクト: tensei/Manga-checker
        public MangaInfo GetInfo(string url)
        {
            MangaInfo info = new MangaInfo();
            try
            {
                WebClient web = new WebClient();
                var html = web.DownloadString(url);
                Match name = Regex.Match(html, "<h2 class=\"aname\">(.+)</h2>", RegexOptions.IgnoreCase);
                if (name.Success)
                {
                    Match chapter = Regex.Match(html, ("<a href=\"/.+/.+\">(.+) (\\d+)</a>"), RegexOptions.IgnoreCase);
                    info.Name = name.Groups[1].Value.Trim();
                    if (chapter.Success && chapter.Groups[1].Value == name.Groups[1].Value)
                    {
                        info.Chapter = chapter.Groups[2].Value.Trim();
                        info.Site = "mangareader.net";
                        info.Error = "null";
                        return info;

                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                info.Error = e.Message;
                info.Name = "ERROR";
                info.Chapter = "ERROR";
                return info;
                // do stuff here
            }
            return info;
        }
コード例 #2
0
ファイル: SearchInfo.cs プロジェクト: tensei/Manga-checker
        public MangaInfo search(string url)
        {
            var web = new WebClient();
            try
            {
                //search manga here
                if (url.ToLower().Contains("mangareader.net"))
                {
                    //mangareader code
                    //MessageBox.Show("mangareader.net link");
                    mangareader m = new mangareader();
                    info = m.GetInfo(url);
                }
                else if (url.ToLower().Contains("mangafox.me"))
                {
                    mangafox m = new mangafox();
                    info = m.GeInfo(url);
                    //info.Site = "mangafox.me";
                    //info.Error = "ERROR Site not Supported yet.";
                    //info.Name = "ERROR";
                    //info.Chapter = "ERROR";
                    ////mangafox code
                    //MessageBox.Show(info.Error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (url.ToLower().Contains("readms.com") || url.ToLower().Contains("mangastream.com"))
                {
                    mangastream m = new mangastream();
                    info = m.GeInfo(url);
                    //info.Site = "readms.com";
                    //info.Error = "ERROR Site not Supported yet.";
                    //info.Name = "ERROR";
                    //info.Chapter = "ERROR";
                    ////mangareader code
                    //MessageBox.Show(info.Error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (url.ToLower().Equals(string.Empty))
                {
                    info.Error = "URL empty";
                }
                else
                {

                    MessageBox.Show("Link not recognized :/", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    info.Error = "Link not recognized :/";
                    info.Name = "ERROR";
                    info.Chapter = "ERROR";
                    info.Site = "ERROR";
                }
                return info;
            }
            catch (Exception error)
            {
                info.Error = error.Message;
                return info;
            }
        }