Exemple #1
0
        private TrackData(string name, string filePath, TimeSpan length, AlbumData album, string mimeType)
            : base(name, false)
        {
            if (!System.IO.File.Exists(filePath))
            {
                throw new ArgumentException(nameof(filePath));
            }

            Number              = 0;
            Album               = album ?? throw new ArgumentNullException(nameof(album));
            _performers         = new List <PerformerData>();
            _genres             = new List <GenreData>();
            Year                = 0;
            Length              = length;
            FilePath            = filePath;
            _sourceAlbumArtists = new List <string>();
            MimeType            = mimeType ?? throw new ArgumentNullException(nameof(mimeType));
            FrontCoverMimeType  = string.Empty;
            _frontCoverDatas    = new List <byte>();
        }
Exemple #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="trackNumber"><see cref="Number"/></param>
        /// <param name="name"><see cref="Name"/></param>
        /// <param name="album"><see cref="Album"/></param>
        /// <param name="performers"><see cref="Performers"/></param>
        /// <param name="genres"><see cref="Genres"/></param>
        /// <param name="year"><see cref="Year"/></param>
        /// <param name="length"><see cref="Length"/></param>
        /// <param name="filePath"><see cref="FilePath"/></param>
        /// <param name="sourceAlbumArtists"><see cref="SourceAlbumArtists"/></param>
        /// <param name="frontCoverDatas"><see cref="FrontCoverDatas"/></param>
        /// <param name="frontCoverMimeType"><see cref="FrontCoverMimeType"/></param>
        /// <param name="mimeType"><see cref="MimeType"/></param>
        /// <exception cref="ArgumentException"><paramref name="filePath"/> is not a valid path.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="name"/> is <c>Null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="album"/> is <c>Null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="performers"/> is <c>Null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="genres"/> is <c>Null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="sourceAlbumArtists"/> is <c>Null</c>.</exception>
        /// <exception cref="ArgumentException"><paramref name="sourceAlbumArtists"/> contains at least one <c>Null</c> value.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="mimeType"/> is <c>Null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="frontCoverMimeType"/> is <c>Null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="frontCoverDatas"/> is <c>Null</c>.</exception>
        internal TrackData(uint trackNumber, string name, AlbumData album,
                           List <PerformerData> performers, List <GenreData> genres, uint year,
                           TimeSpan length, string filePath, List <string> sourceAlbumArtists,
                           string mimeType, string frontCoverMimeType, List <byte> frontCoverDatas)
            : this(name, filePath, length, album, mimeType)
        {
            if (sourceAlbumArtists == null)
            {
                throw new ArgumentNullException(nameof(sourceAlbumArtists));
            }
            else if (sourceAlbumArtists.Contains(null))
            {
                throw new ArgumentException(nameof(sourceAlbumArtists));
            }

            Number              = trackNumber;
            _performers         = performers ?? throw new ArgumentNullException(nameof(performers));
            _genres             = genres ?? throw new ArgumentNullException(nameof(genres));
            Year                = year;
            FilePath            = filePath;
            _sourceAlbumArtists = sourceAlbumArtists;
            FrontCoverMimeType  = frontCoverMimeType ?? throw new ArgumentNullException(nameof(frontCoverMimeType));
            _frontCoverDatas    = frontCoverDatas ?? throw new ArgumentNullException(nameof(frontCoverDatas));
        }
Exemple #3
0
 /// <summary>
 /// Constructor for tracks without <see cref="TagLib.File.Tag"/>.
 /// </summary>
 /// <param name="filePath"><see cref="FilePath"/></param>
 /// <param name="length"><see cref="Length"/></param>
 /// <param name="album"><see cref="Album"/></param>
 /// <exception cref="ArgumentException"><paramref name="filePath"/> is not a valid path.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="album"/> is <c>Null</c>.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="mimeType"/> is <c>Null</c>.</exception>
 internal TrackData(string filePath, TimeSpan length, AlbumData album, string mimeType)
     : this(string.Empty, filePath, length, album, mimeType)
 {
 }