Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 在子文件夹@Isolated Storage-WP7中获取文件_Arrays_String_Windows Phone 7_Directory_Isolatedstorage - Fatal编程技术网

Arrays 在子文件夹@Isolated Storage-WP7中获取文件

Arrays 在子文件夹@Isolated Storage-WP7中获取文件,arrays,string,windows-phone-7,directory,isolatedstorage,Arrays,String,Windows Phone 7,Directory,Isolatedstorage,我想获取子文件夹在字符串数组中保存的所有文件 因此,我尝试了以下方法: var IOstore = IsolatedStorageFile.GetUserStoreForApplication(); string searchpath = System.IO.Path.Combine("product", ProductName); string filesInSubDirs[] = IOstore.GetFileNames(searchpath); var IOstore = Isolated

我想获取子文件夹在字符串数组中保存的所有文件

因此,我尝试了以下方法:

var IOstore = IsolatedStorageFile.GetUserStoreForApplication();
string searchpath = System.IO.Path.Combine("product", ProductName);
string filesInSubDirs[] = IOstore.GetFileNames(searchpath);
var IOstore = IsolatedStorageFile.GetUserStoreForApplication();
string searchpath = System.IO.Path.Combine("product", ProductName);
searchpath = string.Format("{0}\\*.*", searchpath);
string filesInSubDirs[] = IOstore.GetFileNames(searchpath);
但我得到了“产品”文件夹中的所有文件。我也尝试过仅使用“productname”作为参数


感谢您的帮助。

子文件夹的搜索模式需要在结尾包含“**”,以匹配任何文件,这将使您的代码如下所示:

var IOstore = IsolatedStorageFile.GetUserStoreForApplication();
string searchpath = System.IO.Path.Combine("product", ProductName);
string filesInSubDirs[] = IOstore.GetFileNames(searchpath);
var IOstore = IsolatedStorageFile.GetUserStoreForApplication();
string searchpath = System.IO.Path.Combine("product", ProductName);
searchpath = string.Format("{0}\\*.*", searchpath);
string filesInSubDirs[] = IOstore.GetFileNames(searchpath);

子文件夹的搜索模式需要在结尾包含“***”,以匹配任何文件,这将使您的代码类似于以下内容:

var IOstore = IsolatedStorageFile.GetUserStoreForApplication();
string searchpath = System.IO.Path.Combine("product", ProductName);
string filesInSubDirs[] = IOstore.GetFileNames(searchpath);
var IOstore = IsolatedStorageFile.GetUserStoreForApplication();
string searchpath = System.IO.Path.Combine("product", ProductName);
searchpath = string.Format("{0}\\*.*", searchpath);
string filesInSubDirs[] = IOstore.GetFileNames(searchpath);

一些你可能想尝试的东西。(这是一种左栏回答,对不起)。在我的dropbox客户端)中,我有一组用于System.IO.File、System.IO.FileInfo、System.IO.Directory和System.IO.DirectoryInfo的外观。它们工作得很好,我已经测试过了

基本上,可以为System.IO.IsolatedStorage添加Using或Import,然后添加PSFile、PSDirectory、PSFileInfo或PSDirectoryInfo。它让我不用记住所有的细微差别。。。例如,如果您正在查询一个目录,它知道添加一个斜杠等。顺便说一句,“PS”前缀表示“持久化存储”,这是IsolatedStorage有时被称为的(以“I”开头意味着它们是接口..没有前缀会使事情更加混乱)


无论如何,您可以从源代码中获取代码,或者我相信上一个版本为它们提供了DLL(它被称为“IsolatedStorageFacade-WP7”)

一些您可能想尝试的东西。(这是一种左栏回答,对不起)。在我的dropbox客户端)中,我有一组用于System.IO.File、System.IO.FileInfo、System.IO.Directory和System.IO.DirectoryInfo的外观。它们工作得很好,我已经测试过了

基本上,可以为System.IO.IsolatedStorage添加Using或Import,然后添加PSFile、PSDirectory、PSFileInfo或PSDirectoryInfo。它让我不用记住所有的细微差别。。。例如,如果您正在查询一个目录,它知道添加一个斜杠等。顺便说一句,“PS”前缀表示“持久化存储”,这是IsolatedStorage有时被称为的(以“I”开头意味着它们是接口..没有前缀会使事情更加混乱)


不管怎样,你可以从源代码中获取代码,或者我相信上一个版本已经为它们提供了DLL(它被称为“IsolatedStorageFacade-WP7”)

好的,当我在子文件夹中写入时,我应该使用相同的模式吗?保存时,不需要应用“.”模式,它只是用于查询。要保存,只需将路径与子文件夹和filename.hum连接即可。好的,当我在子文件夹中写入时,是否应使用相同的模式?保存时不需要应用“.”模式,它只是用于查询。要保存,只需将路径与子文件夹和文件名连接起来。