示例#1
0
        /// <summary>
        /// API调试台
        /// </summary>
        static async Task Main()
        {
            string i = await MusicLib.GetUrlAsync("0032UZe62rZk9K");

            Console.WriteLine(i);
            Console.ReadLine();
        }
示例#2
0
        /// <summary>
        /// API调试台
        /// </summary>
        static async System.Threading.Tasks.Task Main()
        {
            Settings.LoadUSettings("2728578956");
            var d = await MusicLib.GetUrlAsync("004DHn5044x7Oy");

            Console.WriteLine(d);
            Process.Start(d);
            Console.ReadLine();
        }
示例#3
0
文件: Main.cs 项目: 0xblack/Lemon-App
        /// <summary>
        /// API调试台
        /// </summary>
        static async System.Threading.Tasks.Task Main()
        {
            Settings.LoadUSettings("2728578956");
            string mid = "001SCzwZ4MdpL6";
            string url = await MusicLib.GetUrlAsync(mid);

            Console.WriteLine(url);
            Process.Start(url);

            Console.ReadLine();
        }
 public async void Download()
 {
     await Task.Run(async() =>
     {
         string Url = await MusicLib.GetUrlAsync(Id);
         Console.WriteLine(Path + "  " + Downloading + "\r\n" + Url);
         HttpWebRequest Myrq = (HttpWebRequest)WebRequest.Create(Url);
         var myrp            = (HttpWebResponse)Myrq.GetResponse();
         Console.WriteLine(myrp.StatusCode.ToString());
         var totalBytes = myrp.ContentLength;
         GetSize(Getsize(totalBytes));
         Stream st = myrp.GetResponseStream();
         Stream so = new FileStream(Path, FileMode.Create);
         long totalDownloadedByte = 0;
         byte[] by = new byte[1048576];
         int osize = await st.ReadAsync(by, 0, (int)by.Length);
         while (osize > 0)
         {
             if (stop)
             {
                 break;
             }
             if (Downloading)
             {
                 totalDownloadedByte = osize + totalDownloadedByte;
                 await so.WriteAsync(by, 0, osize);
                 osize    = await st.ReadAsync(by, 0, (int)by.Length);
                 Progress = (int)((float)totalDownloadedByte / (float)totalBytes * 100);
                 ProgressChanged(Progress);
                 Console.WriteLine("downloading:" + Progress);
             }
         }
         st.Close();
         so.Close();
         myrp.Close();
         Finished();
     });
 }