Example #1
0
 public void RemoveAll()
 {
     this.outputSongs = new BindingList <Song>();
     this.pathDictionary.Clear();
     Sorting.CreateSortDictionaries(this.outputSongs, this.sortDictionaries);
     this.OnLibraryChanged(new LibraryChangedEventArgs());
 }
Example #2
0
 public void RemoveAll()
 {
     this.songPaths    = new List <string>();
     this.outputSongs  = new BindingList <Song>();
     this.CurrentIndex = 0;
     Sorting.CreateSortDictionaries(this.outputSongs, this.sortDictionaries);
 }
Example #3
0
 public RatingFilterPlaylist(Library library, string name, List <string> songPaths, int ratingCutoff, bool includeHigher)
     : base(library, name, songPaths)
 {
     this.library       = library;
     this.allowedRating = ratingCutoff;
     this.IncludeHigher = includeHigher;
     UpdateSongPaths();
     base.outputSongs = base.GetAllSongs();
     Sorting.CreateSortDictionaries(outputSongs, this.sortDictionaries);
 }
Example #4
0
        public Playlist(Library library, string name, List <string> songPaths)
        {
            this.libraryDictionary  = library.PathDictionary;
            library.LibraryChanged += library_LibraryChanged;
            this.Name      = name;
            this.songPaths = songPaths;
            ResetSortVariables();

            this.outputSongs      = GetSongsFromLibrary();
            this.sortDictionaries = new List <Dictionary <string, List <Song> > >();
            Sorting.CreateSortDictionaries(this.outputSongs, this.sortDictionaries);
        }
Example #5
0
        /// <summary>
        /// Searches for string in all string fields and returns matches in a list
        /// </summary>
        /// <param name="searchString"></param>
        /// <returns></returns>
        public BindingList <Song> Search(string searchString)
        {
            ResetSortVariables();
            searchString = searchString.ToLower().Trim();

            Sorting.CreateSortDictionaries(new BindingList <Song>(pathDictionary.Values.ToList()), this.sortDictionaries);
            this.outputSongs = new BindingList <Song>();

            for (int i = 0; i < 4; i++)
            {
                AddUniqueSearchResults(searchString, sortDictionaries[i]);
            }

            Sorting.CreateSortDictionaries(this.outputSongs, this.sortDictionaries);

            return(this.outputSongs);
        }
Example #6
0
        public Library(List <Song> songs)
        {
            if (songs != null)
            {
                this.outputSongs = new BindingList <Song>(songs);
            }
            else
            {
                this.outputSongs = new BindingList <Song>();
            }

            this.pathDictionary = SongListToPathDictionary();
            this.CurrentIndex   = 0;
            ResetSortVariables();

            sortDictionaries = new List <Dictionary <string, List <Song> > >();
            Sorting.CreateSortDictionaries(this.outputSongs, this.sortDictionaries);
        }
Example #7
0
        void addFilesWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            List <Song> newLibrary = new List <Song>(this.outputSongs.ToList());

            newLibrary.AddRange(newSongs);
            this.outputSongs = new BindingList <Song>(newLibrary);

            foreach (Song s in newSongs)
            {
                if (!pathDictionary.Keys.Contains(s.Path))
                {
                    pathDictionary.Add(s.Path, s);
                }
            }

            this.outputSongs.RaiseListChangedEvents = true;
            Save();

            Sorting.CreateSortDictionaries(this.outputSongs, this.sortDictionaries);

            this.outputSongs.ResetBindings();
            OnLibraryChanged(new LibraryChangedEventArgs());
        }
Example #8
0
 public void ResetSearchDictionaries()
 {
     Sorting.CreateSortDictionaries(this.outputSongs, this.sortDictionaries);
 }