Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I obtain the full path of an isolated storage file

How do I obtain the fully qualified path of an isolated storage file for a WPF application?

like image 926
Bob Avatar asked Sep 23 '10 18:09

Bob


People also ask

Where is isolated storage located?

Isolated storage generally uses one of three locations to read and write data: %LOCALAPPDATA%\IsolatedStorage\ : For example, C:\Users\<username>\AppData\Local\IsolatedStorage\ , for User scope. %APPDATA%\IsolatedStorage\ : For example, C:\Users\<username>\AppData\Roaming\IsolatedStorage\ , for User|Roaming scope.

Can I delete isolated storage?

You can delete directories and files within an isolated storage file. Within a store, file and directory names are operating-system dependent and are specified as relative to the root of the virtual file system. They are not case-sensitive on Windows operating systems.


1 Answers

You can use reflection to do so, as shown in the linked forum post:

IsolatedStorageFileStream oStream =
    new IsolatedStorageFileStream(ISOLATED_FILE_NAME, FileMode.Create, isoStore);

// Get the physical path using reflection

String filePath = oStream.GetType().GetField("m_FullPath",
     BindingFlags.Instance | BindingFlags.NonPublic).GetValue(oStream).ToString();
Console.WriteLine(filePath);
like image 166
Oded Avatar answered Nov 01 '22 06:11

Oded



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!