예제 #1
0
        public void CopyAudioFromAnotherTrack(Track destinationTrack, Track sourceTrack)
        {
            File.Move(destinationTrack.Filename, destinationTrack.Filename + ".old");

            try
            {
                File.Copy(sourceTrack.Filename, destinationTrack.Filename);
            }
            catch (Exception)
            {
                try
                {
                    File.Move(destinationTrack.Filename + ".old", destinationTrack.Filename);
                }
                catch
                {
                    // ignored
                }
                throw;
            }

            var title       = destinationTrack.Title;
            var album       = destinationTrack.Album;
            var albumArtist = destinationTrack.AlbumArtist;
            var artist      = destinationTrack.Artist;
            var genre       = destinationTrack.Genre;
            var trackNumber = destinationTrack.TrackNumber;

            UpdateTrackDetails(destinationTrack, artist, title, album, albumArtist, genre, trackNumber, false);

            var albumCover = AlbumCoverHelper.GetAlbumCover(destinationTrack.Album);

            if (albumCover != null)
            {
                AlbumCoverHelper.SetTrackAlbumCover(destinationTrack, albumCover);
            }
            File.Delete(destinationTrack.Filename + ".old");

            LoadTrack(destinationTrack.Filename);
        }
예제 #2
0
 public void SetTrackAlbumCover(Track track, Image image)
 {
     AlbumCoverHelper.SetTrackAlbumCover(track, image);
 }