In Windows Phone 8, things got better of the front of reading the file system. It’s actually gotten closer to the Windows 8 with the inclusion of WinRT, and it now possible to read the content of files that were pretty hard (or impossible) to access directly before.


Reading the app package content files

There are some times when you need to access the content of the xap directly, and in Windows Phone 7, you were pretty limited to the use of the IsolatedStorage, but really did not have access to the content of the Xap, except for some location such as images or XmlDocument and the SQL CE engine using the appdata:/ scheme.

Things have changed in Windows Phone 8, and here’s how to read the WMAppManifest.xml file by yourself :


   var file = await StorageFile.GetFileFromPathAsync(

   using (var stream = new StreamReader(await file.OpenStreamForReadAsync()))
      var content = await stream.ReadToEndAsync();

That way, you can access anything located in your package, and use it like any other file. Also note that this technique is also working on Windows 8.


Reading the content of the IsolatedStorage

The IsolatedStorage class is just a wrapper around the file system that was introduced in .NET a while back, but since it is now possible to access the file system using WinRT, it is possible to read the isolated storage folder content directly.

It’s just a matter of using Windows.Storage.ApplicationData.Current.LocalFolder and replicating the code above, which will make for a very portable code between Windows 8 and Windows Phone 8.