问题
Is there an API available for this in .Net? What about in the Windows API? If not, has anyone come up with some hackish-way to do this yet?
回答1:
Finding the local storage folder of a Windows 8 Style application
http://blog.falafel.com/Blogs/paul-tidwell/2012/08/27/finding-the-local-storage-folder-of-a-windows-8-style-application
The path to Windows 8 Style apps is as follows:
C:\Users\{username}\AppData\Local\Packages\Microsoft.BingSports_8wekyb3d8bbwe
There is a new Windows API which uses an internal and undisclosed algorithm to create a publisher hash, which when appended to the package name becomes the family name. Family name looks like {packagename}_{publisherhash}
If you wanted another desktop application or need to share this between some set of applications you can call the API via PowerShell cmdlet like so:
(Get-AppxPackage -AllUsers -Name $name).PackageFamilyName
Write that to the registry and voila! Your application can use Environment.UserName and the path pattern above to easily find your appx local storage.
来源:https://stackoverflow.com/questions/13144479/how-do-you-access-a-metro-apps-local-storage-in-a-desktop-application-in-window