/// <summary> /// Adds the song that are contained in the specified directory recursively to the library. /// </summary> /// <param name="path">The path of the directory to search.</param> private void AddLocalSongs(string path) { if (path == null) { throw new ArgumentNullException(Reflector.GetMemberName(() => path)); } if (!Directory.Exists(path)) { throw new ArgumentException("The directory doesn't exist.", Reflector.GetMemberName(() => path)); } var finder = new LocalSongFinder(path); finder.SongFound += (sender, e) => { bool added; lock (this.songLocker) { added = this.songs.Add(e.Song); } if (added) { this.SongAdded.RaiseSafe(this, new LibraryFillEventArgs(e.Song, finder.TagsProcessed, finder.CurrentTotalSongs)); } }; finder.Start(); }
/// <summary> /// Adds the song that are contained in the specified directory recursively to the library. /// </summary> /// <param name="path">The path of the directory to search.</param> private void AddLocalSongs(string path) { if (path == null) { Throw.ArgumentNullException(() => path); } if (!Directory.Exists(path)) { Throw.ArgumentException("The directory doesn't exist.", () => path); } var finder = new LocalSongFinder(path); finder.SongFound += (sender, e) => { if (this.abortSongAdding) { finder.Abort(); return; } bool added; lock (this.songLock) { lock (this.disposeLock) { added = this.songs.Add(e.Song); } } if (added) { this.SongAdded.RaiseSafe(this, new LibraryFillEventArgs(e.Song, finder.TagsProcessed, finder.CurrentTotalSongs)); } }; finder.Start(); }
/// <summary> /// Adds the song that are contained in the specified directory recursively to the library. /// </summary> /// <param name="path">The path of the directory to search.</param> private void AddLocalSongs(string path) { if (path == null) Throw.ArgumentNullException(() => path); if (!Directory.Exists(path)) Throw.ArgumentException("The directory doesn't exist.", () => path); var finder = new LocalSongFinder(path); finder.SongFound += (sender, e) => { if (this.abortSongAdding) { finder.Abort(); return; } bool added; lock (this.songLock) { lock (this.disposeLock) { added = this.songs.Add(e.Song); } } if (added) { this.SongAdded.RaiseSafe(this, new LibraryFillEventArgs(e.Song, finder.TagsProcessed, finder.CurrentTotalSongs)); } }; finder.Start(); }
/// <summary> /// Adds the song that are contained in the specified directory recursively to the library. /// </summary> /// <param name="path">The path of the directory to search.</param> private void AddLocalSongs(string path) { if (path == null) throw new ArgumentNullException(Reflector.GetMemberName(() => path)); if (!Directory.Exists(path)) throw new ArgumentException("The directory doesn't exist.", Reflector.GetMemberName(() => path)); var finder = new LocalSongFinder(path); finder.SongFound += (sender, e) => { bool added; lock (this.songLocker) { added = this.songs.Add(e.Song); } if (added) { this.SongAdded.RaiseSafe(this, new LibraryFillEventArgs(e.Song, finder.TagsProcessed, finder.CurrentTotalSongs)); } }; finder.Start(); }