How to explore isolated storage in WP8

advertisement
In Windows phone 8, application data is always isolated by the user in a virtual file system that can be just one file in the root
directory or a tree of directories and files.
Isolated storage enables applications to create and maintain a safe client-side virtual file system for partial trust applications. In
Silverlight, all I/O operations are restricted to isolated storage and do not use the file system of the operating system
The isolated storage data compartment is an abstraction, not a specific storage location. It consists of one or more isolated storage
files, called stores, which contain the actual directory locations where data is stored. Any kind of data can be saved in the store.
Windows phone SDK provides a tool called Isolated Storage Explorer (ISETool.exe) to perform simple task (list content, copy files,
upload files) to the isolated storage of a phone app. To test the tool, we can build and deploy the app to Windows phone by using
below source code, and then test the tool against the isolated storage of the app. The app simply creates a directory that contains a
text file, and write text to the file, and then read the text from the file.
Prerequisite:




Windows 8
VS 2012
Windows phone SDK installed
A device that running Windows phone 8 and is unlocked for development.
Deploy the app
1. Connect the device with Windows 8 over USB cable
2. Build and deploy the app to WP8 with the attached code:
3. Input text in the text box and touch Write button, the app create a directory “DataFolder” and a file “LogFile.txt” in the
directory, write the input text into the file. Touch Read button, the app read all text in “LogFile.txt”, and print it on
Textblock.
4. Try to create the directory and file in the isolated storage by using the app.
Running ISETool.exe in desktop computer (Windows 8)
1. Connect the device with Windows 8 over USB cable
2. Run command prompt with administrator
3. Change directory to “C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\IsolatedStorageExplorerTool”
4. Input below command to list valid device and emulator. It indicates the device is using index 0.
ISETool.exe EnumerateDevices
5. Performing the task with the tool requires product ID to recognize which storage of the app that the command should
be performed on. Check the Product ID in “WMAppManifest.xml” that created in solution directory. In this case:
<Solution root>\PhoneApp_WriteRead_test\Properties
6. Input below commands to list directories in the storage of the app. (The index of the first command is obtained from
step 4)
ISETool.exe dir: deviceindex:0 72a9258a-1091-4f82-93f4-3a4466d3f977
ISETool.exe dir: de 72a9258a-1091-4f82-93f4-3a4466d3f977c
(Make sure the device is not in suspend mode or you’ll see this:)
7. Input below command to list the content of “DataFolder”
ISETool.exe dir:\DataFolder de 72a9258a-1091-4f82-93f4-3a4466d3f977
8. Input below command to copy all directories and files to desktop computer
ISETool.exe ts de 72a9258a-1091-4f82-93f4-3a4466d3f977 "C:\wp8\device”
9. Add some text to the LogFile.txt and input below command to replace original files in isolated storage by the files in
desktop computer. (Note: This command clean everything in the isolated storage)
ISETool.exe rs de 72a9258a-1091-4f82-93f4-3a4466d3f977 "C:\wp8\device\IsolatedStore"
10. Touch Read button in the app to make sure the LogFile.txt is replaced.
11. For detailed description and usage of ISETool.exe, please refer to:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh286408(v=vs.105).aspx
Explore the isolated storage using the GUI tool “Windows Phone Power Tool”
http://wptools.codeplex.com/
Prerequisite:


Windows phone SDK installed
Connect Windows phone with desktop computer over USB cable
This tool provides GUI to install, update the application directly via the compiled .xap files, monitor and kill the process of phone
apps, and perform basic task to isolated storage of phone apps(copy, upload and delete directories or files).
Download