public MainForm() { library = Library.Load(); if (library == null) { library = new Library(); library.Save(); } library.LibraryChanged += library_LibraryChanged; settings = Settings.Load(SETTINGSPATH); if (settings == null) settings = new Settings(); MMDeviceEnumerator enumerator = new MMDeviceEnumerator(); defaultAudioDevice = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Console); this.musicPlayer.OpenCompleted += equalizerSettings_ShouldSet; this.equalizerSettings = EqualizerSettings.Load(EQUALIZERPATH); if (this.equalizerSettings == null) { this.equalizerSettings = new EqualizerSettings(); this.equalizerSettings.Save(EQUALIZERPATH); } this.equalizerSettings.ValueChanged += equalizerSettings_ShouldSet; SetUpGlobalHotkeys(); InitializeComponent(); }
public SongPropertiesWindow(MainForm mainForm, Song song, int clickedIndex, IPlaylist currentPlaylist, Library library) { this.mainForm = mainForm; this.song = song; this.currentIndex = clickedIndex; this.currentPlaylist = currentPlaylist; this.library = library; InitializeComponent(); }
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); }
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); }
public MultiSongPropertiesWindow(MainForm mainForm, List<Song> songs, IPlaylist 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); }
/// <summary> /// Load playlist from file. Returns null if it fails: /// </summary> /// <param name="path"></param> /// <param name="library"></param> /// <returns></returns> public static new RatingFilterPlaylist Load(String path, Library library) { Stream stream = null; RatingFilterPlaylist loadedPlaylist = null; try { stream = File.OpenRead(path); XmlSerializer serializer = new XmlSerializer(typeof(RatingFilterPlaylist)); loadedPlaylist = (RatingFilterPlaylist)serializer.Deserialize(stream); } catch { return null; } finally { if (stream != null) stream.Close(); } RatingFilterPlaylist pl = new RatingFilterPlaylist(library, loadedPlaylist.Name, new List<string>(), loadedPlaylist.AllowedRating, loadedPlaylist.IncludeHigher); library.LibraryChanged += pl.library_LibraryChanged; return pl; }
public Playlist(Library library, string name) : this(library, name, new List<string>()) { }
public Playlist(Library library) : this(library, "PlaylistName") { }
/// <summary> /// Load playlist from file. Returns null if it fails: /// </summary> /// <param name="path"></param> /// <param name="library"></param> /// <returns></returns> public static Playlist Load(String path, Library library) { Stream stream = null; Playlist loadedPlaylist = null; try { stream = File.OpenRead(path); XmlSerializer serializer = new XmlSerializer(typeof(Playlist)); loadedPlaylist = (Playlist)serializer.Deserialize(stream); } catch { return null; } finally { if (stream != null) stream.Close(); } Playlist pl = new Playlist(library, loadedPlaylist.Name, loadedPlaylist.songPaths); library.LibraryChanged += pl.library_LibraryChanged; pl.CurrentIndex = loadedPlaylist.CurrentIndex; List<string> toBeRemoved = new List<string>(); foreach (string filePath in pl.songPaths) if (!library.PathDictionary.Keys.Contains(filePath)) toBeRemoved.Add(filePath); foreach (string filePath in toBeRemoved) pl.Remove(filePath); return pl; }
public RatingFilterPlaylist(Library library, string name, int ratingCutoff, bool andHigher) : this(library, name, new List<string>(), ratingCutoff, andHigher) { }