Example #1
0
        private void NextPage()
        {
            if ((pageNumber + 1) < pagesCount)
            {
                pageNumber++;

                if (!File.Exists(Environment.CurrentDirectory + "/" + currentChapter + "/manga" + pageNumber + ".jpg"))
                {
                    // HtmlParsing.ReadManga(Manga, Manga.Chapters[0]);
                    HtmlParsing.pictureBoxPages.ImageLocation = HtmlParsing.mangaPages[pageNumber];
                }
                else//Если манга загружена то страница из файла из файла
                {
                    HtmlParsing.pictureBoxPages.Image = Image.FromFile(Environment.CurrentDirectory + "/" + currentChapter + "/manga" + pageNumber + ".jpg");
                }
                pictureBox1.Location = new Point(pictureBox1.Location.X, panel1.Location.Y + 50);
            }
            else//другая глава
            {
                if (Manga.Chapters.IndexOf(currentChapter) + 1 < Manga.Chapters.Count())
                {
                    currentChapter = Manga.Chapters[Manga.Chapters.IndexOf(currentChapter) + 1];
                    pageNumber     = 0;
                    HtmlParsing.ReadManga(Manga, currentChapter);
                    pagesCount = HtmlParsing.mangaPages.Count();
                    HtmlParsing.pictureBoxPages.ImageLocation = HtmlParsing.mangaPages[pageNumber];
                    //HtmlParsing.pictureBoxPages.ImageLocation = HtmlParsing.mangaPages[pageNumber];
                }
                else
                {
                    MessageBox.Show("Конец");//Последняя страница
                }
            }
        }
Example #2
0
        /// <summary>
        /// При открытии манги
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form2_Load(object sender, EventArgs e)
        {
            try
            {
                this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.Mouse_Wheel);

                pageNumber     = Manga.CurrentPage;
                currentChapter = Manga.CurrentChapter;
                // comboBox1.SelectedIndex = 0;
                if (!File.Exists(Environment.CurrentDirectory + "/" + currentChapter + "/manga" + pageNumber + ".jpg"))//если манга не загружена
                {
                    HtmlParsing.ReadManga(Manga, currentChapter);
                    HtmlParsing.pictureBoxPages.ImageLocation = HtmlParsing.mangaPages[pageNumber];//Загружаеи картинку страницы
                    pagesCount = HtmlParsing.mangaPages.Count;
                }
                else
                {
                    HtmlParsing.pictureBoxPages.Image = Image.FromFile(Environment.CurrentDirectory + "/" + currentChapter + "/manga" + pageNumber + ".jpg");
                    MessageBox.Show("Чтение из кэша");
                    pagesCount = Directory.EnumerateFiles(Environment.CurrentDirectory + "/" + currentChapter).Count() - 1;
                }

                foreach (string str in Manga.Chapters)//Загрузка томов в комбо бокс
                {
                    var point = str.LastIndexOf("v") + 3;

                    ComboboxChapterlist.Items.Add(str.Substring(point, str.Length - point));
                }

                for (int i = 0; i < ComboboxChapterlist.Items.Count; i++)//пытаемся переключить комбобокс
                {
                    var point         = currentChapter.LastIndexOf("v") + 3;
                    var boxItemText   = ComboboxChapterlist.Items[i];
                    var cutCurrentVol = currentChapter.Substring(point, currentChapter.Length - point);
                    if (boxItemText.ToString() == cutCurrentVol)
                    {
                        ComboboxChapterlist.SelectedIndex = i;
                    }
                }
            }
            catch
            {
                Console.WriteLine("Ошибочка загрузки");
            }
            // pictureBox1.Size = new Size(pictureBox1.,pictureBox1.Image.Height);
            pictureBoxSizeW     = pictureBox1.Size.Width;
            pictureBoxSizeY     = pictureBox1.Size.Height;
            pictureBoxLocationX = pictureBox1.Location.X;
            pictureBoxLocationY = pictureBox1.Location.Y;
        }
Example #3
0
        private void ComboboxChapterlist_SelectedIndexChanged(object sender, EventArgs e)
        {
            foreach (string str in Manga.Chapters)
            {
                var point = str.LastIndexOf("v") + 3;
                var vol   = str.Substring(point, str.Length - point);//глава
                //Console.WriteLine(str+"======"+vol);
                if (vol == (ComboboxChapterlist.SelectedItem.ToString()))
                {
                    HtmlParsing.ReadManga(Manga, str);
                    currentChapter = str;
                    pagesCount     = HtmlParsing.mangaPages.Count;

                    HtmlParsing.pictureBoxPages.ImageLocation = HtmlParsing.mangaPages[pageNumber];
                }
            }
        }