現在、このコードを使用して、medaiを独立したストレージに保存しています。メディアがローカルの場合、これはfrineで動作しますが、httpアドレスからmedaiを取得しようとするとURiKindにエラーが発生します。私は絶対から変わった。相対的な、しかしダイスはまだありません。HTTPからリソースを取得してIso Stoarageに保存
提案がありますか?
FYI - ファイル名= http://www.domain.com/media.wma
エラー: 'uriString' パラメーターは、絶対URIを表すので、相対URIを作成できません。
または:絶対的なUriが予想されます。
private void DownloadToIsoStore(string fileName)
{
string ringtonePath = GetRingtonePath();
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
// If the file already exists, no need to "download", just return
if (isoStore.FileExists(fileName))
{
return;
}
StreamResourceInfo sr = Application.GetResourceStream(new Uri(fileName, UriKind.Relative));
using (BinaryReader br = new BinaryReader(sr.Stream))
{
// Simulate "downloading" medai file
byte[] data = br.ReadBytes((int)sr.Stream.Length);
// Save to local isolated storage
SaveToIsoStore(fileName, data);
}
}
あなたはApplication.Get **リソース**ストリームは何だと思いますか? – SLaks