In this tutorial we are going to revisit the concept and implementation of isolated storage as Microsoft has given us some cool new toys to play with in the Windows Phone 7.1 SDK. This tool is command line based and will allow us to peer into either an emulator or an actual attached device. Once in the device/simulator we can navigate through the applications isolated storage files and choose to export them and if you really wanted to, import storage files from your computer into the device/simulator. We will look at how to do both of those as well as list the directories and files within the application. Jump below to find out how to get started with the Isolated Storage Explorer.

 

In the Windows Phone 7 Development 101 series we did a tutorial on how to use the Isolated Storage API provided to developers in a pre-Mango development environment.  This required that we set up a isolated storage file and send and retrieve data from it upon entering the application and when the button is clicked. Now in a post Mango development environment we can use the isolated storage explorer to bring the file onto our computer and view the data like never before.  This tutorial will get us back into the feel of Windows Phone 7 Development and prepare us for what is to come. The first thing we will want to do, is download the Statistics Tracker application (free/trial is exact same as paid version unless you feel like donating) from the Windows Phone Marketplace,

 

First, we will need to navigate to the Isolated Storage Explorer Tool which is located in one of two places depending on whether you are running a 32 bit machine or a 64 bit one.  For the 32 bit machine we would want to navigate our windows explorer to the following address: Program Files\Microsoft SDKs\Windows Phone\v7.1\Tools\IsolatedStorageExplorerTool. For the 64 bit machine we can bring the windows explorer to: Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Tools\IsolatedStorageExplorerTool. Once there we will navigate back one to the Tools folder and then we can SHIFT + Left Mouse Click on the IsolatedStorageExplorerTool and choose Open command window here.  When the command window is up we can begin using the isolation storage explorer tool.

 

Once the device (HTC Titan) is attached we will access the Statistics Tracker – WP7 application by using its GUID which, unless you develop the application, you will not have access to this.  We will sow you where your applications GUID can be found though so you are able to use this when you use Isolated Storage.  We need to enter Visual Studio 2010 and open the Windows Phone application. After that we need to enter the WPAppManifest.xml file that can be found in the properties folder where we will see the following XML code.

 

<?xml version="1.0" encoding="utf-8"?>
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.1">
<App xmlns="" ProductID="{de5e00e1-e39d-40d4-bd87-ac89c3b593b5}" Title="Statistics Tracker" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="WP7StatsTracker author" Description="Sample description" Publisher="WP7StatsTracker">
<IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
<Capabilities>
<Capability Name="ID_CAP_GAMERSERVICES" />
<Capability Name="ID_CAP_IDENTITY_DEVICE" />
<Capability Name="ID_CAP_IDENTITY_USER" />
<Capability Name="ID_CAP_LOCATION" />
<Capability Name="ID_CAP_MEDIALIB" />
<Capability Name="ID_CAP_MICROPHONE" />
<Capability Name="ID_CAP_NETWORKING" />
<Capability Name="ID_CAP_PHONEDIALER" />

<Capability Name="ID_CAP_PUSH_NOTIFICATION" />
<Capability Name="ID_CAP_SENSORS" />
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
</Capabilities>
<Tasks>
<DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
</Tasks>
<Tokens>
<PrimaryToken TokenID="WP7StatsTrackerToken" TaskName="_default">
<TemplateType5>
<BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
<Count>0</Count>
<Title>Statistics Tracker</Title>
</TemplateType5>
</PrimaryToken>
</Tokens>
</App>
</Deployment>

From the “App” node we need to grab the Product ID from the attributes. The GUID of the Statistics Tracker – WP would be “ProductID=”{de5e00e1-e39d-40d4-bd87-ac89c3b593b5}”. We can now start to actually use the Isolated Storage Explorer tool. To display the directories with the Statistics Tracker – WP7 we need to type into the command line: “ISETool.exe dir de de5e00e1-e39d-40d4-bd87-ac89c3b593b5“. The “ISETool.exe” part of the command called the tools we will need. The “dir de” part of the command lets us tell the ISETool.exe that we want to list the directory (dir) and we want to focus this command on our actual device (de). Finally we enter the ProductID and then press enter to send the command to the application on the device. NOTE: if this fails then we would get an error like the following –

C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Tools\IsolatedStorageEx
plorerTool>ISETool.exe dir de de5e00e1-e39d-40d4-bd87-ac89c3b593b5
Directory Listing Error. Reason: Failed to connect to device as it is pin locked.

– this would be if your device is locked and cannot navigate to the application. Another error message that can appear would be –

Directory Listing Error. The system cannot find the file specified.

– This would indicate that the application did not create an isolated storage for itself or that the application does not exist on the current device, hence no application to cling onto. Now once we run this command and it succeeds we should end up with the following output.

Now when we want to retrieve the application isolated storage file from the application we can use another command. This command will be used to grab the file from the application and drop it onto our desktop so we are able to explore and manipulate it. To do this, the command would be – “ISETool.exe ts de de5e00e1-e39d-40d4-bd87-ac89c3b593b5 “C:\Data\IsolatedStorage”” – this would effectively use the ISETool.exe to utilize the ts method to transfer files from the physical device while placing the file into the folder specified after the ProductID. Once the command is entered you will see the following screen.

After the file is on our computer we can then navigate to the file and open it. Once open the file is free for exploration and manipulation. When our file is open, the following shows up in it.

For the next part, we want to add some data to the file so it is more robust and then we want to place the document back into the application onto the hardware. To do this we will add 7 dates and statistics to the document which will keep the same date but change the statistics. The data we will add to the file will be as follows:

  • 1-11/5/2011
  • 2-11/5/2011
  • 3-11/5/2011
  • 4-11/5/2011
  • 5-11/5/2011
  • 6-11/5/2011
  • 7-11/5/2011
  • 8-11/5/2011
  • 9-11/5/2011
Afterwards the file should look like the following image.
We now want to add the file back onto the device into the application.  To do this we need to use another command using the ISEtool.exe again. This command is – “ISETool.exe rs de de5e00e1-e39d-40d4-bd87-ac89c3b593b5  “C:\Data\IsolatedStorage\IsolatedStore”” –  the main difference between this command and the last is instead of the “ts” in the previous command, we will use “rs” in this one.  This will attach to the ProductID and send the new file into the application.  After the command is run in the command line, it should look something like this.

Once the device is equipped with our newly patched file, all we have to do to view this file is press the View Entries button under the submit button. This will bring you up to speed on how to utilize the Isolated Storage Explorer. With this knowledge now at your fingertips, you are on your way to Windows Phone developer “Mango-ness”. Stay tuned for the next tutorial coming soon. Until the next tutorial, Happy Hacking!

Share This