private void AddBook_Click(object sender, EventArgs e) { if (librarypathlabel.Text == "\\") { MessageBox.Show("Please select the Vita root directory (ux0:)."); return; } Book newBook = CheckNewBookEntry(); if (newBook != null) { AddBook mybook = new AddBook( Path.Combine( LibraryLocation, baseval1, baseval2, DLCBookTitleBase + newBook.DLCIndex.ToString(), "book" + newBook.Index.ToString().PadLeft(2, '0') ) ); mybook.ShowDialog(); DLCIndex = 1; flpCategories.Controls.Clear(); allbooks.Clear(); LibraryLocation = folderBrowserDialog1.SelectedPath; if (File.ReadLines("settings.ini").ElementAtOrDefault(0) == null) { File.AppendAllText("settings.ini", LibraryLocation); } libcheck(true); } }
private void multiModMeta_Click(object sender, EventArgs e) { var selectedBooks = DLCs .Where(d => d.Index == ((DLC)cmbDLL.SelectedItem).Index) .FirstOrDefault().Books .Where(bk => bk.Selected).ToList(); if (selectedBooks.Any()) { AddBook mybook = new AddBook(selectedBooks); mybook.ShowDialog(); } else { MessageBox.Show("Select one ore more books to continue."); } }
private void editBookDetailsToolStripMenuItem_Click(object sender, EventArgs e) { Book selBook = DLCs .Where(d => d.Index == ((DLC)cmbDLL.SelectedItem).Index) .FirstOrDefault().Books .Where(bk => bk.Index == DeleteID) .FirstOrDefault(); AddBook mybook = new AddBook(selBook); mybook.ShowDialog(); selBook = mybook.bookCtrl; DLCs.Where(d => d.Index == ((DLC)cmbDLL.SelectedItem).Index) .FirstOrDefault().Books .Where(bk => bk.Index == DeleteID) .ToList().ForEach(b => { b = selBook; }); }
private void editBookDetailsToolStripMenuItem_Click(object sender, EventArgs e) { AddBook mybook = new AddBook(allbooks[DeleteID]); mybook.ShowDialog(); }
private void AddBook_Click(object sender, EventArgs e) { if (librarypathlabel.Text == "\\") { MessageBox.Show("Please select the Vita root directory (ux0:)."); return; } Bookindex = 2; string bkindex = null; while (!NewBook) { if (DLCIndex > 6) { MessageBox.Show("Reader Book Limit has been reached!"); NewBook = true; return; } if (Bookindex > 99) { DLCIndex += 1; System.IO.Directory.CreateDirectory(LibraryLocation + baseval1 + "\\" + baseval2 + "\\" + DLCBookTitleBase + DLCIndex); Bookindex = 2; } if (Bookindex < 10) { bkindex = "0" + Bookindex.ToString(); } else { bkindex = Bookindex.ToString(); } if (!Directory.Exists(LibraryLocation + baseval1 + "\\" + baseval2 + "\\" + DLCBookTitleBase + DLCIndex + "\\" + ("book" + bkindex))) { System.IO.Directory.CreateDirectory(LibraryLocation + baseval1 + "\\" + baseval2 + "\\" + DLCBookTitleBase + DLCIndex + "\\" + ("book" + bkindex)); AddBook mybook = new AddBook(LibraryLocation + baseval1 + "\\" + baseval2 + "\\" + DLCBookTitleBase + DLCIndex + "\\" + ("book" + bkindex)); mybook.ShowDialog(); NewBook = true; DLCIndex = 1; BookNumber = 0; Bookindex = 2; flpCategories.Controls.Clear(); allbooks.Clear(); LibraryLocation = folderBrowserDialog1.SelectedPath; if (File.ReadLines("settings.ini").ElementAtOrDefault(0) == null) { File.AppendAllText("settings.ini", LibraryLocation); } libcheck(); } else { Bookindex += 1; } } BookNumber = 0; //Find the Number of Books (Count folders with book in them) const string searchQuery = "*" + "book" + "*"; var directory = new DirectoryInfo(LibraryLocation + baseval1 + "\\" + baseval2 + "\\" + DLCBookTitleBase + DLCIndex); var directories = directory.GetDirectories(searchQuery, SearchOption.AllDirectories); foreach (var d in directories) { if (Directory.GetFiles(d.FullName + "\\", "book.epub").Length != 0) { BookNumber += 1; } } LibraryBookNumber.Text = "( " + (BookNumber) + " Books )"; NewBook = false; }