Question

I am working on an music application and after long testing I have came to the conclusion that for the firs run I have to Load in the XAP File the Levels Data instead of downloading it from a web service because it is faster and not so time consuming.

My question is if someone knows a method to read the file listing inside an application folder.

I have written a method that copies the data from one folder to the LocalStorage of the application (IsolatedStorage) and all I need is a way to read the content of the folder.

I have to mention that this is my first app for windows phone.

Was it helpful?

Solution

If the file is in the application folder - which means it is packaged up in the xap - you should be able to get the file using the Application.GetRourceStream like I've seen with apps that have local databases they package, but want to copy over to Isolated Storage after install.

Here's an example (from this page http://msdn.microsoft.com/en-us/library/hh202860(v=vs.92).aspx):

Stream str = Application.GetResourceStream(new Uri("appdata:/MyReferenceDB.sdf", UriKind.Relative)).Stream;

appdata: is what tells it to look in the application directory. Only other option is isostore:

OTHER TIPS

So you have already copied the file from your xap resources to Isolated Storage, and you want to read the file back out of Isolated Storage? (Is there a reason you can't just load the data out of the xap, without copying it to Isolated Storage?)

Try this tutorial on files and Isolated Storage: http://www.windowsphonegeek.com/tips/all-about-wp7-isolated-storage-read-and-save-text-files (I recommend reading the whole thing, but I linked specifically to a page on creating and reading text files).

This question contains code for listing the files in your isolated storage, if you can't just hardcode your filename: windows phone 7 File Listing IsolatedStorage

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top