/// <summary> /// Method to add a track to Player /// </summary> /// <param name="track"></param> private void AddTrack(XmlTrack track) { string albumName = track.AlbumArtist; if (string.IsNullOrEmpty(albumName)) { albumName = Path.GetFileName(Path.GetDirectoryName(track.Location)); } XmlAlbumArtist tempBand = GetBand(albumName); if (tempBand == null) { tempBand = new XmlAlbumArtist(albumName); Library.Add(tempBand.Name, tempBand); AlbumArtists.Add(tempBand); } XmlAlbum tempAlbum = tempBand.GetAlbum(track.GetAlbumKey()); if (tempAlbum == null) { tempAlbum = new XmlAlbum(track.GetAlbumKey()); Library[albumName].AddAlbum(tempAlbum); Albums.Add(tempAlbum); } XmlDisc tempDisc = tempAlbum.GetDisc(track.GetDiscKey()); if (tempDisc == null) { tempDisc = new XmlDisc(track.GetDiscKey()); Library[albumName].GetAlbum(track.GetAlbumKey()).AddDisc(tempDisc); Discs.Add(tempDisc); } if (Library[albumName].GetAlbum(track.GetAlbumKey()).GetDisc(track.GetDiscKey()).AddTrack(track)) { Tracks.Add(track); } }
/// <summary> /// Method to add a track to Player /// </summary> /// <param name="track"></param> private void AddTrack(XmlTrack track) { string albumName = track.AlbumArtist; if (string.IsNullOrEmpty(albumName)) albumName = Path.GetFileName(Path.GetDirectoryName(track.Location)); XmlAlbumArtist tempBand = GetBand(albumName); if (tempBand == null) { tempBand = new XmlAlbumArtist(albumName); Library.Add(tempBand.Name, tempBand); AlbumArtists.Add(tempBand); } XmlAlbum tempAlbum = tempBand.GetAlbum(track.GetAlbumKey()); if (tempAlbum == null) { tempAlbum = new XmlAlbum(track.GetAlbumKey()); Library[albumName].AddAlbum(tempAlbum); Albums.Add(tempAlbum); } XmlDisc tempDisc = tempAlbum.GetDisc(track.GetDiscKey()); if (tempDisc == null) { tempDisc = new XmlDisc(track.GetDiscKey()); Library[albumName].GetAlbum(track.GetAlbumKey()).AddDisc(tempDisc); Discs.Add(tempDisc); } if (Library[albumName].GetAlbum(track.GetAlbumKey()).GetDisc(track.GetDiscKey()).AddTrack(track)) { Tracks.Add(track); } }