示例#1
0
        /// <summary>
        /// Add all new tracks found in inputfiles
        /// </summary>
        /// <param name="inputFiles"></param>
        public void AddTracks(IEnumerable <string> inputFiles)
        {
            var albumReader = new AlbumReader();
            var existing    = Tracks.ToLookup(_ => _.Path);
            var toAdd       = albumReader.GetTracks(albumReader.GetAudioFiles(inputFiles))
                              .Where(t => !existing.Contains(t.Path));

            foreach (var track in toAdd)
            {
                track.Oid = this.GetNextOid();
            }

            Tracks = Tracks.Concat(toAdd)
                     .OrderBy(_ => _.Album)
                     .ThenBy(_ => _.TrackNumber)
                     .ToArray();
        }