public static Library SearchInLibrary(Library library, SearchObject so) { Library newLibrary = new Library("Résultats - " + DateTime.Now.ToString()); if (so != null) { List<Music> musics = library.Search(so); foreach (Music music in musics) newLibrary.AddLibraryObject(music); } return newLibrary; }
public static SearchObject CreateSearchObject() { SearchWindow fenetre = new SearchWindow(); fenetre.ShowDialog(); if (fenetre.SearchItems.Count == 0) { return null; } SearchObject so = new SearchObject(); foreach(string key in fenetre.SearchItems.Keys) { so.AddSearchTerm(key, fenetre.SearchItems[key]); } return so; }
public List<Music> Search(SearchObject so) { List<Music> ListResult = new List<Music>(); foreach(LibraryObject libObj in MasterList) { ListResult.AddRange(libObj.Search(so)); } return ListResult; }
public List<Music> Search(SearchObject so) { if (so.Compare(this)) return new List<Music> { this }; else return new List<Music>(); }