public void addAnimeToList(AnimeList filteredList) { for (int i = 0; i < filteredList.getAllTitle().Count(); i++) { if (!animeList.ContainsKey(filteredList.getAnimeList().Values.ToArray()[i].getTitle())) { animeList.Add(filteredList.getAnimeList().Values.ToArray()[i].getTitle(), filteredList.getAnimeList().Values.ToArray()[i]); } } }
public void saveAnimeListToFile(string path) { using (StreamWriter writer = (File.Exists(path)) ? File.AppendText(path) : File.CreateText(path)) { foreach (Anime anime in animeList.getAnimeList().Values) { writer.Write(anime.getTitle() + "#" + anime.buildStringOfFansubs() + "#" + anime.getEpisode() + "#" + anime.buildStringOfSub() + "#" + anime.buildStringOfVoice() + "#" + anime.buildStringOfSource() + "#" + anime.getDescription() + "#" + anime.getPathImg() + "#" + anime.buildStringOfEpisode() + "§\n"); } writer.Close(); } }
public void removeAnimeWhichIsNotInTheList(AnimeList filteredList) { var list = animeList.Keys.Intersect(filteredList.getAnimeList().Keys); List <string> keys = new List <string>(); foreach (KeyValuePair <string, Anime> entry in animeList) { if (!list.Contains(entry.Key)) { keys.Add(entry.Key); } } foreach (string key in keys) { animeList.Remove(key); } }
private void button1_Click(object sender, RoutedEventArgs e) { AnimeList filteredList = new AnimeList(); filteredList.addAnimeToList(animeList.getAnimeList()); MainWindow mWindow = Owner as MainWindow; if (checkBox1.IsChecked.Value) { filteredList.removeAnimeWhichIsNotInTheList(animeList.getGerSubAnime()); } if (checkBox2.IsChecked.Value) { filteredList.removeAnimeWhichIsNotInTheList(animeList.getEngSubAnime()); } if (checkBox3.IsChecked.Value) { filteredList.removeAnimeWhichIsNotInTheList(animeList.getJapDubAnime()); } if (checkBox4.IsChecked.Value) { filteredList.removeAnimeWhichIsNotInTheList(animeList.getEngDubAnime()); } if (checkBox5.IsChecked.Value) { filteredList.removeAnimeWhichIsNotInTheList(animeList.getGerDubAnime()); } if (!checkBox1.IsChecked.Value && !checkBox2.IsChecked.Value && !checkBox3.IsChecked.Value && !checkBox4.IsChecked.Value && !checkBox5.IsChecked.Value) { mWindow.listBox1.ItemsSource = animeList.getSortedAllTitle(); } else { mWindow.listBox1.ItemsSource = filteredList.getSortedAllTitle(); } this.Hide(); }
public void removeAnimeWhichIsNotInTheList(AnimeList filteredList) { var list = animeList.Keys.Intersect(filteredList.getAnimeList().Keys); List<string> keys = new List<string>(); foreach (KeyValuePair<string, Anime> entry in animeList) { if(!list.Contains(entry.Key)) { keys.Add(entry.Key); } } foreach (string key in keys) { animeList.Remove(key); } }