I have a folder with content in my solution, it contains lots of subdirectories. I need to copy this folder into IsolatedStorage. I read msdn forum message where it was said that there are no means to get folder content from code. How do I solve this problem?
Share
The forum ist right. There is no way to enumerate “Content” resources.
You could set build action “Resource” or “Embedded Resource” as some answers suggest – then there are ways to enumerate the resources using ResourceManager or similar means. But I wouldn’t recommend it as this will embed all resources into your assembly bloating it and making your app slow to load.
Here is a similar question (about enumerating image files). No solution though. The answer of Matt contains the only workaround: Prepare a list of filenames at design time and build this list into the app. Then instead of enumerating the files at runtime you read the filenames one by one from this list.
If you need this just for developing and testing then like the others I also recommend looking at the ISETool. You setup your app once with a reference storage and use the tool to save the state of the isolated storage. When you need to restore the state from isolated storage you can use the tool to copy the saved one back to the phone or emulator. An example for doing this can be found in this blog post.