private async void PlaylistAddPlaylist() { View?.SetPage(TabPage.PlayList); var ofd = new System.Windows.Forms.OpenFileDialog(); ofd.Filter = "Playlists | " + App.Playlists; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string ext = Path.GetExtension(ofd.FileName); string[] result = null; switch (ext) { case ".pls": result = await PlaylistLoaders.LoadPls(ofd.FileName); break; case ".m3u": result = await PlaylistLoaders.LoadM3u(ofd.FileName); break; case ".wpl": result = await PlaylistLoaders.LoadWPL(ofd.FileName); break; case ".asx": result = await PlaylistLoaders.LoadASX(ofd.FileName); break; } PlayList.AddRange(result); } }
public async void DoLoad(IEnumerable <string> items) { View?.SetPage(TabPage.PlayList); if (items == null) { items = Environment.GetCommandLineArgs(); } foreach (var item in items) { var ext = Path.GetExtension(item).ToLower(); if (!string.IsNullOrEmpty(ext) && App.Playlists.Contains(ext)) { string[] result = null; switch (ext) { case ".pls": result = await PlaylistLoaders.LoadPls(item); break; case ".m3u": result = await PlaylistLoaders.LoadM3u(item); break; case ".wpl": result = await PlaylistLoaders.LoadWPL(item); break; case ".asx": result = await PlaylistLoaders.LoadASX(item); break; } PlayList.AddRange(result); } else if (App.Formats.Contains(ext)) { PlayList.Add(item); } else { MessageBox.Show(Properties.Resources.Playlist_UnsupportedListFormat, Properties.Resources.Playlist_UnsupportedListFormatTitle, MessageBoxButton.OK, MessageBoxImage.Error); } } }
public async Task DoOpenList(string file, bool apend) { string ext = Path.GetExtension(file); IEnumerable <string> result = null; switch (ext) { case ".pls": result = await PlaylistLoaders.LoadPls(file); break; case ".m3u": case ".m3u8": result = await PlaylistLoaders.LoadM3u(file); break; case ".wpl": result = await PlaylistLoaders.LoadWPL(file); break; case ".asx": result = await PlaylistLoaders.LoadASX(file); break; } if (result != null) { if (!apend) { List.Clear(); } List.AddRange(result); } }