public void searchDatabase(string[] data) { try { dataGrid.Rows.Clear(); string[] keyWords = Regex.Split(txtFilesSearchBox.Text, @"\s+"); foreach (string file in data) { var dataJson = DatabaseFiles.FromJson(file); if (GetWords(txtFilesSearchBox.Text.ToLower()).Any(x => dataJson.URL.ToLower().Contains(x))) { dataGrid.Rows.Add(dataJson.Title, dataJson.Type, dataJson.Host, dataJson.URL); } } tab.SelectedTab = tabFiles; } catch { MessageBox.Show("Unable to search database. Please try again in a moment."); } }
private void titleFilesSubtitles_ClickButtonArea(object Sender, MouseEventArgs e) { selectedFiles = "Subtitles"; titleFilesMovies.ColorFillSolid = Color.Transparent; titleFilesMovies.BorderColor = Color.Transparent; titleFilesSeries.ColorFillSolid = Color.Transparent; titleFilesSeries.BorderColor = Color.Transparent; titleFilesAnime.ColorFillSolid = Color.Transparent; titleFilesAnime.BorderColor = Color.Transparent; titleFilesSubtitles.ColorFillSolid = Color.FromArgb(27, 27, 27); titleFilesSubtitles.BorderColor = Color.FromArgb(27, 27, 27); titleFilesTorrents.ColorFillSolid = Color.Transparent; titleFilesTorrents.BorderColor = Color.Transparent; dataGrid.Rows.Clear(); foreach (string file in dataFilesSubtitles) { var data = DatabaseFiles.FromJson(file); dataGrid.Rows.Add(data.Title, data.Type, data.Host, data.URL); } }
private void btnSearchFiles_ClickButtonArea(object Sender, MouseEventArgs e) { if (selectedFiles == "Series") { if (!(txtFilesSearchBox.Text == "")) { searchDatabase(dataFilesSeries); } else { foreach (string file in dataFilesSeries) { var data = DatabaseFiles.FromJson(file); dataGrid.Rows.Add(data.Title, data.Type, data.Host, data.URL); } } } else if (selectedFiles == "Movies") { if (!(txtFilesSearchBox.Text == "")) { searchDatabase(dataFilesMovies); } else { foreach (string file in dataFilesMovies) { var data = DatabaseFiles.FromJson(file); dataGrid.Rows.Add(data.Title, data.Type, data.Host, data.URL); } } } else if (selectedFiles == "Anime") { if (!(txtFilesSearchBox.Text == "")) { searchDatabase(dataFilesAnime); } else { foreach (string file in dataFilesAnime) { var data = DatabaseFiles.FromJson(file); dataGrid.Rows.Add(data.Title, data.Type, data.Host, data.URL); } } } else if (selectedFiles == "Subtitles") { if (!(txtFilesSearchBox.Text == "")) { searchDatabase(dataFilesSubtitles); } else { foreach (string file in dataFilesSubtitles) { var data = DatabaseFiles.FromJson(file); dataGrid.Rows.Add(data.Title, data.Type, data.Host, data.URL); } } } else if (selectedFiles == "Torrents") { if (!(txtFilesSearchBox.Text == "")) { searchDatabase(dataFilesTorrents); } else { foreach (string file in dataFilesTorrents) { var data = DatabaseFiles.FromJson(file); dataGrid.Rows.Add(data.Title, data.Type, data.Host, data.URL); } } } }
void worker_DoWork(object sender, DoWorkEventArgs e) { try { // if (File.Exists(pathData + "open-movies.json")) { if (IsBelowThreshold(pathData + "open-movies.json", 12) == true) // if anime db older than 12 hours then write db { client.DownloadFile(new Uri(linkMovies), pathData + "open-movies.json"); } } else { client.DownloadFile(new Uri(linkMovies), pathData + "open-movies.json"); } dataMoviesJson = File.ReadAllLines(pathData + "open-movies.json"); // // if (File.Exists(pathData + "open-movies-files.json")) { if (IsBelowThreshold(pathData + "open-movies-files.json", 12) == true) // if movies db older than 12 hours then write db { client.DownloadFile(new Uri(linkFilesMovies), pathData + "open-movies-files.json"); } } else { client.DownloadFile(new Uri(linkFilesMovies), pathData + "open-movies-files.json"); } dataFilesMovies = File.ReadAllLines(pathData + "open-movies-files.json"); // // if (File.Exists(pathData + "open-series-files.json")) { if (IsBelowThreshold(pathData + "open-series-files.json", 12) == true) // if series db older than 12 hours then write db { client.DownloadFile(new Uri(linkFilesSeries), pathData + "open-series-files.json"); } } else { client.DownloadFile(new Uri(linkFilesSeries), pathData + "open-series-files.json"); } dataFilesSeries = File.ReadAllLines(pathData + "open-series-files.json"); // // if (File.Exists(pathData + "open-anime-files.json")) { if (IsBelowThreshold(pathData + "open-anime-files.json", 12) == true) // if anime db older than 12 hours then write db { client.DownloadFile(new Uri(linkFilesAnime), pathData + "open-anime-files.json"); } } else { client.DownloadFile(new Uri(linkFilesAnime), pathData + "open-anime-files.json"); } dataFilesAnime = File.ReadAllLines(pathData + "open-anime-files.json"); // // if (File.Exists(pathData + "open-subtitles-files.json")) { if (IsBelowThreshold(pathData + "open-subtitles-files.json", 12) == true) // if anime db older than 12 hours then write db { client.DownloadFile(new Uri(linkFilesSubtitles), pathData + "open-subtitles-files.json"); } } else { client.DownloadFile(new Uri(linkFilesSubtitles), pathData + "open-subtitles-files.json"); } dataFilesSubtitles = File.ReadAllLines(pathData + "open-subtitles-files.json"); // // if (File.Exists(pathData + "open-torrents-files.json")) { if (IsBelowThreshold(pathData + "open-torrents-files.json", 12) == true) // if anime db older than 12 hours then write db { client.DownloadFile(new Uri(linkFilesTorrents), pathData + "open-torrents-files.json"); } } else { client.DownloadFile(new Uri(linkFilesTorrents), pathData + "open-torrents-files.json"); } dataFilesTorrents = File.ReadAllLines(pathData + "open-torrents-files.json"); // foreach (string file in dataFilesMovies.Take(10000)) { var data = DatabaseFiles.FromJson(file); dataGrid.Rows.Add(data.Title, data.Type, data.Host, data.URL); } } catch (Exception ex) { MessageBox.Show("Unable to load movies.\n\n" + ex.Message); } }