public static Playlist MakePlaylist(string path, Library library, Settings settings) { try { using (var sr = new StreamReader(path)) { string type = sr.ReadLine(); switch (type) { case "Playlist": return new Playlist(sr, library); case "ShuffleQueue": return new ShuffleQueue(sr, library, settings); case "FilterPlaylist": return new FilterPlaylist(sr, library); default: return null; } } } catch (Exception ex) { ErrorLogger.Log(ex); return null; } }
public MainForm() { library = Library.Load(); if (library == null) { library = new Library(); library.Save(); } library.Changed += library_LibraryChanged; settings = Settings.Load(SettingsPath) ?? new Settings(); musicPlayer.OpenCompleted += equalizerSettings_ShouldSet; musicPlayer.OpenCompleted += musicPlayer_ShouldPlay; musicPlayer.DeviceVolume = settings.DeviceVolume; equalizerSettings = EqualizerSettings.Load(EqualizerPath); if (equalizerSettings == null) { equalizerSettings = new EqualizerSettings(); equalizerSettings.Save(EqualizerPath); } equalizerSettings.ValueChanged += equalizerSettings_ShouldSet; SetUpGlobalHotkeys(); lfmHandler = new LastfmHandler(); if (settings.ScrobblingEnabled) lfmHandler.ResumeSessionAsync(); InitializeComponent(); SetControlReferences(); }
public Playlist(Library library, string name, List<Song> songs) { this.Name = name; this.songs = songs; Init(library); }
public static Library CreateLibrary() { Library lib = new Library(); AddSongsToLibrary(lib); return lib; }
public FilterPlaylist(Library library, string name, List<Filter> filters) : base(library, name) { this.library = library; Filters = filters ?? new List<Filter>(); FilterLibrary(); }
public void LibraryCreate() { int numSongsExpected = 0; string nameExpected = "Library"; Library lib = new Library(); Assert.AreEqual(lib.NumSongs, numSongsExpected); Assert.AreEqual(lib.Name, nameExpected); }
private void AddSongsToLibrary(Library lib) { var song = new Song(@"Songs\empty10sec.mp3"); song.Rating = 3; lib.Add(song); song = new Song(@"Songs\empty10sec2.mp3"); song.Rating = 1; lib.Add(song); }
public SongPropertiesWindow(MainForm mainForm, Song song, int clickedIndex, PlaylistBase currentPlaylist, Library library) { this.mainForm = mainForm; this.song = song; this.currentIndex = clickedIndex; this.currentPlaylist = currentPlaylist; this.library = library; InitializeComponent(); }
public MultiSongPropertiesWindow(MainForm mainForm, List<Song> songs, PlaylistBase currentPlaylist, Library library) { this.mainForm = mainForm; this.songs = songs; this.currentPlaylist = currentPlaylist; this.library = library; this.saveProperties = new Dictionary<string, bool>(); InitializeComponent(); save_ComboBox.SelectedIndex = 0; for (int i = 2; i < save_ComboBox.Items.Count; i++) this.saveProperties.Add(save_ComboBox.Items[i].ToString(), false); }
public FilterPlaylist(StreamReader sr, Library library) { this.library = library; Filters = new List<Filter>(); ReadHeader(sr); ResetSortVariables(); songs = new List<Song>(); this.sortDictionaries = new List<Dictionary<string, List<Song>>>(); FilterLibrary(); Sorting.CreateSortDictionaries(songs, this.sortDictionaries); }
public void LibrarySave() { Library lib = new Library(); lib.Add(new Song(@"Songs\empty10sec.mp3")); try { lib.Save(); } catch { Assert.Fail(); } }
public Playlist(StreamReader sr, Library library) { ReadHeader(sr); var paths = new List<string>(); string current; while ((current = sr.ReadLine()) != null) paths.Add(current); songs = new List<Song>(); foreach (string path in paths) songs.Add(library.PathDictionary[path]); Init(library); }
public ShuffleQueue(StreamReader sr, Library library, Settings settings) : base(sr, library) { this.library = library; this.Settings = settings; }
public SearchResult(Library library) : base(library, "Search Results") { this.library = library; }
public FilterPlaylist(Library library, string name) : this(library, name, null) { this.library = library; Filters = new List<Filter>(); }
public Playlist(Library library) : this(library, "PlaylistName") { }
private static void AddSongsToLibrary(Library lib) { var song = new Song(@"Songs\empty10sec.mp3"); song.Rating = 3; song.DateAdded = DateTime.Now.AddDays(-1); lib.Add(song); song = new Song(@"Songs\empty10sec2.mp3"); song.DateAdded = DateTime.Now.AddDays(-8); lib.Add(song); song = new Song(@"Songs\empty10sec3.mp3"); song.DateAdded = DateTime.Now.AddMonths(-3); song.Rating = 5; lib.Add(song); }
public ShuffleQueue(Library library, Settings settings) : base(library, "Shuffle Queue") { Settings = settings; this.library = library; }
private Library SetupLibrary() { var lib = new Library(); AddSongsToLibrary(lib); return lib; }
protected void Init(Library library) { this.libraryDictionary = library.PathDictionary; library.Changed += library_LibraryChanged; ResetSortVariables(); this.sortDictionaries = new List<Dictionary<string, List<Song>>>(); Sorting.CreateSortDictionaries(this.songs, this.sortDictionaries); }
public Playlist(Library library, string name) : this(library, name, new List<Song>()) { }
public void FilterPlaylistLibraryChange() { var lib = new Library(); var fpl = new FilterPlaylist(lib, "fpl 4"); fpl.Filters.Add(new StringFilter("genre", "noise", true)); fpl.FilterLibrary(); Assert.AreEqual(0, fpl.NumSongs); AddSongsToLibrary(lib); lib.Changed += (s, e) => { }; fpl.FilterLibrary(); Assert.AreEqual(2, fpl.NumSongs); }
public ShuffleQueue(Library library, Settings settings, List<Song> songs) : base(library, "Shuffle Queue", songs) { Settings = settings; this.library = library; }