Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
825 views
in Technique[技术] by (71.8m points)

uwp - Accessing storage of simulator/device while debugging

I created an UWP project, where I store a file in the cache directory:

string writeFilePath = Path.Combine(ApplicationData.Current.LocalCacheFolder.Path, "test.jpg");
await Task.Run(() => File.WriteAllBytes(writeFilePath, image));

Now I want to view the saved image, but I have no access to it. How do I access it from the simulator or directly on the device (Windows 10 Mobile phone)? Perhaps one could copy the file from the device to the local PC?

I tried the IsolatedStorageExplorer, but I only get the following devices:

0               Device
1               Emulator 8.1 WVGA 4 inch 512MB(DE)
2               Emulator 8.1 WVGA 4 inch(DE)
3               Emulator 8.1 WXGA 4.5 inch(DE)
4               Emulator 8.1 720P 4.7 inch(DE)
5               Emulator 8.1 1080P 5.5 inch(DE)
6               Emulator 8.1 1080P 6 inch(DE)

Which one should I take? I'm running the app on Local Machine, but there is no entry for that. Furthermore I tried Device (it should be the Windows Mobile 10 device imho), but I only get an empty ApplicationInsights folder with the following command:

ISETool.exe ts deviceindex:0 0278a454-54cc-48fc-b709-93fbaabf2337 C:Data

How can I directly access the files/folders from the local storage?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

On Local Machine, the data files are stored in the folder

%USERPROFILE%AppDataLocalPackages{Package family name}

which usually is C:Users{UserName}AppDataLocalPackages{Package family name}, where {UserName} corresponds to the Windows user name and {Package family name} corresponds to the Windows Store application package identifier which you can find as Package family name in Packaging tab of your app's manifest file.

And the LocalCache folder inside the package folder is the cache directory you've used to save image. You can view the saved image in it.

For Simulator, it's as same as Local Machine.

For Mobile Emulator and Device, we can use some tools like IsoStoreSpy or Windows Phone Power Tools to access Isolated Storage. Use these tools we can access LocalFolder, TemporaryFolder and RoamingFolder. However LocalCacheFolder is not supported.

Isolated Storage Explorer tool is used for Mobile Emulator and Device not for Local Machine and Simulator and by default it lists, copies, and replaces files and directories in your app’s local folder which is the LocalState folder in Local Machine. So you only get an empty ApplicationInsights folder when you use it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...