我正在尝试读取包含我从mic捕获的音频数据的文件。现在,当我使用以下查询查询应用程序商店时,我可以看到保存在IsolatedStorage中的文件列表。
查询:
var f = userStore.GetFileNames();
foreach (var df in f) {
System.Diagnostics.Debug.WriteLine(df);
}
查询结果:
Audio.sdf
Audio1.wav
Audio2.wav
但是当我尝试阅读文件" Audio1.wav"使用此查询:
FileStream = new IsolatedStorageFileStream(FileName, FileMode.Open, userStore);
我收到以下错误:
An exception of type 'System.IO.IOException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
A first chance exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.ni.dll
An exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
System.IO.IsolatedStorage.IsolatedStorageException: [IsolatedStorage_Operation_ISFS]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50829.0&File=mscorlib.dll&Key=IsolatedStorage_Operation_ISFS
at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, IsolatedStorageFile isf)
at System.IO.IsolatedStorage.IsolatedStorageFile.OpenFile(String path, FileMode mode)
at AudioRecorder.MainPage.start_player()
任何帮助?
答案 0 :(得分:0)
试试这个,它可能对你有帮助。授予FileAccess权限。 当我们想要读取文件时,我们使用FileAccess.Read!您可以从http://msdn.microsoft.com/en-us/library/4z36sx0f%28v=VS.90%29.aspx
中找到所有FileAccess可能性的列表using (IsolatedStorageFileStream fileStream = userStore.OpenFile(FilePath, FileMode.Open, FileAccess.Read))
{
//your code
}