简体   繁体   中英

C# + UWP: Convert Windowspath to ms-appdata uri

I'm wrting code for a tool which runs on a raspberry pi. That tool should download an HTML-File and open it in a webview.

After the download The file is located in this path:

\\192.168.2.79\c$\Data\Users\DefaultAccount\AppData\Local\Packages\f2f9d0b2-0e90-4494-bcbf-12da27846733_dd744mn1wdq44\AC\Temp\de-DE\index.html

To open it in a webview it has to look like this (example from MS-Page):

ms-appdata:///local/intro/welcome.html

how do I convert it correctly?

\\\\192.168.2.79\\c$\\Data\\Users\\DefaultAccount\\AppData\\Local\\Packages\\f2f9d0b2-0e90-4494-bcbf-12da27846733_dd744mn1wdq44\\AC\\Temp\\de-DE\\index.html . how do I convert it correctly?

Currently,there are only three folders could be accessed using ms-appdata:/// protocol.

LocalState : ms-appdata:///local/

TempState : ms-appdata:///temp/

RoamingState : ms-appdata:///roaming/

You could not convert the path that you have mentioned to ms-appsata uri directly. For your requirement , you could copy the html file to LocalState folder and convert the file path like following:

ms-appdata:///local/tem/index.html

For more you could refer to ApplicationData Class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM