SD卡读取文件 [英] SD Card read files
问题描述
嗨论坛,
我尝试从我的SD卡读取。但我只能阅读文件夹而不是文件。
i try to read from my sd Card. But i can only read the Folders not the files.
我的错误是什么?
// Connect to the current SD card.
ExternalStorageDevice _sdCard = (await ExternalStorage.GetExternalStorageDevicesAsync()).FirstOrDefault();
if (_sdCard != null)
{
// MessageBox.Show(_sdCard.ToString());
MessageBox.Show("SD Card ok");
try
{
// Look for a folder on the SD card named RKSE.
ExternalStorageFolder routesFolder = await _sdCard.GetFolderAsync("Test");
MessageBox.Show(routesFolder.Name + " - " + routesFolder.Path);
//MessageBox.Show(_sdCard.RootFolder.Path);
// Get all files from the Routes folder.
IEnumerable<ExternalStorageFolder> routeFolders = await routesFolder.GetFoldersAsync();
IEnumerable<ExternalStorageFile> routeFiles = await routesFolder.GetFilesAsync();
routeFolders 有计数
routeFolders has count
routeFiles 没有伯爵。但文件夹中有3个文件。
routeFiles has no Count. But there are 3 files in the Folder.
需要帮助
GrußRoland
推荐答案
您列出的代码对Windows应用商店应用无效。您定位的平台是什么,以便我们可以帮助您找到合适的论坛?您是否定位Windows Phone?
The code you list is not valid for Windows Store apps. What platform are you targeting so we can get you to the right forum? Are you targeting Windows Phone?
如果您使用的是Microsoft.Phone.Storage.ExternalStorageFolder,那么您的应用需要声明它支持的文件类型。它不会看到任何未声明类型的文件。请参阅
使用自动启动应用程序Windows Phone 8的文件和URI关联 。
If you are using Microsoft.Phone.Storage.ExternalStorageFolder then your app needs to declare which file types it supports. It won't see any files of undeclared types. See Auto-launching apps using file and URI associations for Windows Phone 8.
- Rob
这篇关于SD卡读取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!