private void buttonDownload_Click(object sender, EventArgs e) { if (!UrlDownloader.DownloadStatus) { if (playlist.SelectedIndex != -1) { string directory = Settings.Default.path; string filename; if (SoundCloud.MyTracklist[playlist.SelectedIndex].artist != "" && SoundCloud.MyTracklist[playlist.SelectedIndex].artist != null && SoundCloud.MyTracklist[playlist.SelectedIndex].title != "" && SoundCloud.MyTracklist[playlist.SelectedIndex].title != null) { filename = String.Format("{0} - {1}.mp3", SoundCloud.MyTracklist[playlist.SelectedIndex].artist, SoundCloud.MyTracklist[playlist.SelectedIndex].title); } else { filename = String.Format("{0}.mp3", SoundCloud.MyTracklist[playlist.SelectedIndex].buferTitle); } UrlDownloader.Downloader(SoundCloud.MyTracklist[playlist.SelectedIndex].stream_url + "?client_id=" + SoundCloud.clientID, directory, filename); UrlDownloader.webClient.DownloadFileCompleted += WebClient_DownloadFileCompleted; } } }