调试时访问模拟器/设备的存储 [英] Accessing storage of simulator/device while debugging

查看:35
本文介绍了调试时访问模拟器/设备的存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 UWP 项目,我在缓存目录中存储了一个文件:

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));

现在我想查看保存的图像,但我无法访问它.如何从模拟器或直接在设备(Windows 10 手机)上访问它?也许可以将文件从设备复制到本地 PC?

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?

我尝试了 IsolatedStorageExplorer,但我只得到以下设备:

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)

我应该选择哪一个?我在 Local Machine 上运行该应用程序,但没有相应的条目.此外,我尝试了 Device(它应该是 Windows Mobile 10 设备恕我直言),但我只得到一个空的 ApplicationInsights 文件夹,其中包含以下命令:

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?

推荐答案

Local Machine上,数据文件存放在文件夹

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

%USERPROFILE%\AppData\Local\Packages\{Package family name}

通常是 C:\Users\{UserName}\AppData\Local\Packages\{Package family name},其中 {UserName} 对应于 Windows 用户名,{Package family name} 对应于 Windows Store 应用程序包标识符您可以在应用清单文件的 Packaging 标签中以 Package family name 的形式找到它.

which usually is C:\Users\{UserName}\AppData\Local\Packages\{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.

包文件夹内的 LocalCache 文件夹是您用来保存图像的缓存目录.您可以在其中查看保存的图像.

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.

对于模拟器,它与本地机器相同.

对于移动模拟器设备,我们可以使用一些工具,比如IsoStoreSpyWindows Phone Power Tools 以访问独立存储.使用这些工具我们可以访问LocalFolder, TemporaryFolderRoamingFolder.但是不支持 LocalCacheFolder.

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 工具用于移动模拟器和设备,而不是用于本地机器和模拟器,默认情况下,它会列出、复制和替换您应用的本地文件夹中的文件和目录,该文件夹是>LocalState 文件夹在本地机器中.因此,当您使用它时,您只会得到一个空的 ApplicationInsights 文件夹.

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.

这篇关于调试时访问模拟器/设备的存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆