View your WP7 App’s Isolated Storage Structure (with source code)
August 12, 2010 10 Comments
Working with the Isolated Storage within the Windows Phone 7 emulator can be quite tricky. Firstly, there are often exceptions thrown that don’t always explain what the root cause of the error is. Secondly, it’s often difficult to figure out the structure of your Isolated Storage, especially as more directories and files are created. Therefore, I decided to write a quick class (IsoViewer.cs) which makes it easier to get an overview of the structure of your Isolated Storage.
It will display the directories present and their subdirectories. It will also display all the files within the folders. The class is easy to use and, by default, displays the structure using Debug.WriteLine so you’ll be able to see it within the Output window of Visual Studio. Of course, this can easily be changed, so you can route the information to an external file or have it displayed elsewhere. In order to use the class, simply add it to your project and call it with IsoViewer.GetIsolatedStorageView(pattern, IsolatedStorageFile) – simple. To display all files, simply use “*” as the pattern. The class is static, so there’s no need to create an instance of it.
Hope you find this useful! If you have any problems with the code, feel free to comment and I’ll try and get them fixed.
A small update – If you don’t have any directories, and only files in the root directory, then the files aren’t displayed. Add “if (directories.Length == 0) GetFiles(root, “*”, storeFile);” on Line 49 (after initialisation of string directories) to fix this. (I’ve updated the source code in the download already)