1
我试图下载并保存从互联网.mp3文件,但卡住了与流从外部链接:如何在Windows Phone 7上从互联网上保存MP3文件?
private void saveSound()
{
IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication();
using (var fs = new IsolatedStorageFileStream("123.mp3", FileMode.Create, iso))
{
//Here should be this Stream from the Internet...
//Uri: "http://my-site.com/mega-popular-song.mp3"
StreamResourceInfo rs = new StreamResourceInfo(stream, "audio/mpeg");
int count = 0;
byte[] buffer = new byte[4096];
while (0 < (count = rs.Stream.Read(buffer, 0, buffer.Length)))
{
fs.Write(buffer, 0, count);
}
fs.Close();
}
}
应此流的是什么样的?下载和保存.mp3文件的最佳方法是什么?
我相信你需要从“webClient”对象和Complete事件处理程序的参数中获取流。 – Bob 2012-02-15 11:11:52