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("Конец");//Последняя страница } } }
private void Form1_Load(object sender, EventArgs e) { HtmlParsing.GenresToTreeView(); HtmlParsing.GetCoverToList("list/genre/art"); if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()) { HtmlParsing.autonome = true; } }
/// <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; }
private void ToolStripButton6_Click(object sender, EventArgs e) { foreach (string str in Manga.Chapters)//скачиваем текущую главу { var point = str.LastIndexOf("v") + 3; var vol = str.Substring(point, str.Length - point); if (vol == (ComboboxChapterlist.SelectedItem.ToString())) { Manga.CurrentChapter = currentChapter; HtmlParsing.DownLoadManga(str, Manga); } } MessageBox.Show("Том загружен"); }
/// <summary> /// Клик по дереву с жанрами /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TreeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { section = Section.Genres; TreeNode treeNode = e.Node; var nodeName = treeNode.Text; // imageListCatalog.Images.Clear(); foreach (GenreCatalog genre in HtmlParsing.genrelist) { if (genre.GenreName == nodeName) { HtmlParsing.GetCoverToList(genre.GenreLink); } } // progressBar1.Value = 100; // progressBar1.Visible = false; }
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]; } } }
private void timer1_Tick(object sender, EventArgs e) { if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()) { if (!internetCheck) { HtmlParsing.GenresToTreeView(); HtmlParsing.GetCoverToList("list/genre/art"); internetCheck = true; } lblNetCheck.ForeColor = Color.Green; lblNetCheck.Text = "Online"; } else { if (internetCheck) { internetCheck = false; MessageBox.Show("Нет подключения"); } lblNetCheck.ForeColor = Color.Red; lblNetCheck.Text = "Offline"; } }
/// <summary> /// По клику на иконку в листе собираем информацию получаем список глав /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListViewCatalog_Click(object sender, EventArgs e)///Загружаем главы в обьект манги по клику { try { if (listViewCatalog.SelectedItems.Count == 1) { if (internetCheck) { foreach (MangaInCatalog mangaInCatalog in HtmlParsing.mangalist) { if (listViewCatalog.SelectedItems[0].Text == mangaInCatalog.MangaName) { if (!HtmlParsing.autonome) { if (section != Section.Downloads) { HtmlParsing.GetChaptersList(mangaInCatalog); mangaInCatalog.CurrentChapter = mangaInCatalog.Chapters[0];//Получение главы mangaInCatalog.CurrentPage = 0; } } if (File.Exists(Environment.CurrentDirectory + "/bookmarks.txt")) { using (StreamReader streamReader = File.OpenText(Environment.CurrentDirectory + "/bookmarks.txt")) { while (!streamReader.EndOfStream) { var str = streamReader.ReadLine(); var arr = str.Split('~'); if (arr[0] == mangaInCatalog.MangaName) { mangaInCatalog.CurrentChapter = arr[1]; mangaInCatalog.CurrentPage = Convert.ToInt32(arr[2]); } } } } } } btnToRead.Visible = true; HtmlParsing.MangaInfo();//Показать информацию о манге pnlName.Visible = true; pnlAbout.Visible = true; pnlGenres.Visible = true; btnToRead.Visible = true; pictureBoxPage.Visible = true; if (!mangaselect) { listViewCatalog.Size = new Size(listViewCatalog.Size.Width - 300, listViewCatalog.Size.Height); } mangaselect = true; } } else if (listViewCatalog.SelectedItems.Count == 0) { //btnToRead.Visible = false; //pnlName.Visible = false; //pnlAbout.Visible = false; //pnlGenres.Visible = false; //pictureBoxPage.Visible = true; //if (!mangaselect) // listViewCatalog.Size = new Size(listViewCatalog.Size.Width + 300, listViewCatalog.Size.Height); //mangaselect = false; } } catch { MessageBox.Show("Нет интернета"); } }