public void AddItems(Music_Song item) { if (File.Exists(item.Link_Music)) { if (!IsExist(item)) { Listmusic.Add(item); } } }
public void Remove(Music_Song music_Song) { for (int i = 0; i < Listmusic.Count; i++) { if (music_Song.Link_Music == Listmusic[i].Link_Music) { Listmusic.RemoveAt(i); break; } } }
public bool IsExist(Music_Song item) { foreach (Music_Song music_Song in Listmusic) { if (item.Link_Music == music_Song.Link_Music) { return(true); } } return(false); }
public void AddItems(Music_Song item) { item.Date_Add = DateTime.Now.ToString(); foreach (Music_Song music_Song in Listmusic) { if (music_Song.Link_Music == item.Link_Music) { Listmusic.Remove(music_Song); break; } } Listmusic.Add(item); Listmusic = Listmusic.OrderByDescending(L => L.Date_Add).ToList(); Export(); }
private ListMusicRecently() { using (StreamWriter sw = new StreamWriter(path, true)) sw.Close(); using (StreamReader sr = new StreamReader(path)) { string lines; while ((lines = sr.ReadLine()) != null) { string[] words = lines.Split('\t'); if (File.Exists(words[0])) { Music_Song music_Song = new Music_Song(words[0]); music_Song.Date_Add = words[1]; Listmusic.Add(music_Song); } } sr.Close(); } }
public void AddItems(Music_Song item) { Listmusic.Add(item); export(); }