如题,报错
Operation not permitted on IsolatedStorageFileStream
代码如下:
void _cam_CaptureImageAvailable(object sender, ContentReadyEventArgs e)
{
string fileName = DateTime.Now.ToShortTimeString() + ".jpg";
_library.SavePictureToCameraRoll(fileName, e.ImageStream);
e.ImageStream.Seek(0, SeekOrigin.Begin);
using (IsolatedStorageFile isStore = IsolatedStorageFile.GetUserStoreForApplication())
{
if (!isStore.FileExists(fileName))
{
using (IsolatedStorageFileStream targetStream = isStore.OpenFile(fileName, FileMode.OpenOrCreate, FileAccess.Write))
{
byte[] readBuffer = new byte[4096];
int bytesRead = -1;
while ((bytesRead = e.ImageStream.Read(readBuffer, 0, readBuffer.Length)) > 0)
{
targetStream.Write(readBuffer, 0, bytesRead);
}
}
}
}
e.ImageStream.Close();
}
当真是无法解决,甚是苦恼,有经验的同学帮助下,谢谢啦
是文件路径名称不对