I have some files in IsolatedStorage in my application. The file types are different, say doc,xls,ppt,pdf,mp3,mov,jpg,png etc.. I need to open these files. How can I do this.
Try to open it with name and its extensions
byte[] data;
using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream isfs = isf.OpenFile(image.jpg, FileMode.Open, FileAccess.Read))
{
data = new byte[isfs.Length];
isfs.Read(data, 0, data.Length);
isfs.Close();
}
}
MemoryStream ms = new MemoryStream(data);
BitmapImage bi = new BitmapImage();
bi.SetSource(ms);
Image img = new image();
img.source = bi
if it is an image try to set the source of a bitmap image as memory stream ms.