示例#1
0
        public void DownloadFile(string url, song fileName)
        {
            var bgThread = new Thread(() =>
            {
                _sw = new Stopwatch();
                _sw.Start();

                using (var webClient = new WebClient())
                {
                    webClient.Headers.Add("User-Agent: Other");

                    webClient.DownloadFileCompleted +=
                        DownloadCompleted;
                    webClient.DownloadProgressChanged +=
                        DownloadStatusChanged;
                    if (_sortArtist)
                    {
                        var ArtistPath = _path + "\\" + HelperClass.CleanFileName(fileName.Artist);
                        System.IO.Directory.CreateDirectory(ArtistPath);
                        webClient.DownloadFileAsync(new Uri(url), ArtistPath + "\\" + HelperClass.CleanFileName(fileName.GetSongInfo()) + ".mp3");
                    }
                    else
                    {
                        webClient.DownloadFileAsync(new Uri(url), _path + fileName.GetSongInfo() + ".mp3");
                    }
                }
            });

            bgThread.Start();
        }
示例#2
0
 private void btOK_Click(object sender, EventArgs e)
 {
     if (tbKey.Text.Length > 0)
     {
         var exploded = HelperClass.DecryptSong(tbKey.Text).Split('╣');
         Song = new song(exploded[3], exploded[0], true, exploded[2], exploded[1]);
         MessageBox.Show(Song.GetSongInfo());
     }
 }