private void browseDirectory_Click(object sender, EventArgs e) { if (folderBrowser.ShowDialog(this) == DialogResult.OK) { string path = folderBrowser.SelectedPath; var files = Directory.GetFiles(path).ToList(); if (files.Count == 0) { return; } files.Sort(); string animeName = path.Substring(path.LastIndexOf(slash) + 1); var episodes = new Dictionary <string, string>(); foreach (var item in files) { string fileName = item.Substring(item.LastIndexOf(slash) + 1); string episode = fileName.Replace(fileName.Substring(fileName.LastIndexOf('.')), ""); episodes.Add(episode.ToString(), item); } AnimeLoader.Add(new Anime(animeName, files.Count.ToString(), episodes)); animeList.Items.Clear(); foreach (var item in AnimeLoader.Animes) { if (item.Value.Name != "Name") { animeList.Items.Add(item.Value.Name); } } animeList.SelectedItem = animeName; } }
private void deleteButton_Click(object sender, EventArgs e) { if (animeList.SelectedItem == null || animeList.SelectedItem.ToString() == "") { return; } else { AnimeLoader.Remove(animeList.SelectedItem.ToString()); animeList.Items.Remove(animeList.SelectedItem); if (animeList.Items.Count > 0) { animeList.SelectedIndex = 0; } } }
private void Form1_Load(object sender, EventArgs e) { TrayRefresh.RefreshTrayArea(); GlobalHotkey.Subscribe(); SetButtons(); AnimeLoader.Loadlist(); icon = new NotifyIcon { Icon = Icon, Visible = false, Text = "Easy RP Helper" }; icon.MouseClick += Icon_MouseClick; icon.Text = "AnimePlayer with Discord Presence"; foreach (var item in AnimeLoader.Animes) { if (item.Value.Name != "Name") { animeList.Items.Add(item.Value.Name); } } }