示例#1
0
        public static Chapter ByTitle(Manga manga, string Title)
        {
            foreach (Chapter c in manga.chapters)
            {
                if (c.title == Title)
                {
                    return(c);
                }
            }

            return(new Chapter());
        }
示例#2
0
        private static void SelectManga(object sender, EventArgs e)
        {
            Button button       = (Button)sender;
            Manga  currentManga = (Manga)Program.form.pic[Convert.ToInt32(button.Text)].Tag;

            if (Program.manga_jp == null)
            {
                Program.manga_jp = currentManga;
            }
            else
            {
                Program.manga_ru = currentManga;
                ReadingMode_Bilingual form = new ReadingMode_Bilingual();
                form.Show();
            }

            Console.WriteLine("selected");
        }
示例#3
0
        public static void Searcher(object sender)
        {
            Form1 form = (Form1)sender;

            form.Invoke(new Del(() => form.AutoScroll = false));
            //IHtmlParser manga = new extenshion_lhscan();
            IHtmlParser manga = null;

            form.Invoke(new MethodInvoker(() => manga = (IHtmlParser)form.comboBox1.SelectedItem));

            List <Manga> buffer = new List <Manga>();

            manga.SearchByName(form.textBox1.Text);

            List <string> searchResultTitles = manga.getTitles();
            List <string> searchResultUrls   = manga.getUrls();
            List <string> searchResultImg    = manga.getImg();

            int y = 65;

            for (int i = 0; i < searchResultTitles.Count; i++)
            {
                Manga buf = new Manga(searchResultTitles[i], searchResultUrls[i], searchResultImg[i], manga);
                form.pic.Add(new PictureBox());
                form.lab.Add(new Label());
                form.buttons.Add(new Button());

                form.pic[i].SetBounds(40, y, 85, 110);
                form.lab[i].SetBounds(150, y, 300, 40);
                form.buttons[i].SetBounds(460, y, 20, 20);
                y += 130;

                form.pic[i].SizeMode = PictureBoxSizeMode.StretchImage;
                //form.pic[i].Tag = searchResultUrls[i];
                form.pic[i].Tag    = buf;
                form.pic[i].Click += new EventHandler(Link);

                form.buttons[i].Text   = i.ToString();
                form.buttons[i].Click += new EventHandler(SelectManga);
                form.Invoke(new Del(() => form.Controls.Add(form.buttons[i])));

                try
                {
                    WebRequest  req      = WebRequest.Create(searchResultImg[i]);
                    WebResponse response = req.GetResponse();
                    Stream      stream   = response.GetResponseStream();
                    form.pic[i].Image = Image.FromStream(stream);
                }
                catch
                {
                    form.pic[i].Image = Image.FromFile("default.jpg");
                }

                form.Invoke(new Del(() => form.Controls.Add(form.pic[i]))); //

                //form.lab[i].AutoSize = true;
                form.lab[i].Text = searchResultTitles[i];

                form.Invoke(new Del(() => form.Controls.Add(form.lab[i]))); //
            }
            form.Invoke(new Del(() => form.AutoScroll = true));

            //form.Invoke(new Del(() => form.mangas = buffer));
        }