windows phone 7 文件列表 IsolatedStorage [英] windows phone 7 File Listing IsolatedStorage

查看:29
本文介绍了windows phone 7 文件列表 IsolatedStorage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想获取目录中的文件列表时遇到问题

i have a problem when i want get list of file in a directory

这是我的代码

try
        {
            using (var store = IsolatedStorageFile.GetUserStoreForApplication())
            {
                StringBuilder sb = new StringBuilder();
                string subDir = Path.Combine("NotesYours", "Notes");
                if (store.DirectoryExists(subDir))
                {

                    string searchPath = Path.Combine(subDir, "*");
                    string[] fileInSubDir = store.GetFileNames(searchPath);
                    tbtbtes.Text = fileInSubDir.Length.ToString();
                }
                else
                {
                    MessageBox.Show("dir not exist");
                }
            }
        }
        catch (IsolatedStorageException)
        {

        }

如果fileInSubDir的长度为零,而我之前已经创建了三个文件,所以它必须是fileInSubDir的长度为三,而不是零

length if fileInSubDir is zero, whereas i have created three file before, So it must be the Length of fileInSubDir is Three, not zero

请帮帮我:(

推荐答案

我记得有一个错误,这意味着在 GetFileNames 中仅使用 * 通配符搜索无法正常工作.
您是否已验证文件是否存在或尝试使用较不通用的搜索词?

I half remember a bug which meant wildcard searches just using * in GetFileNames didn't work correctly.
Have you verified that the files are there or tried using a less generic search term?

这篇关于windows phone 7 文件列表 IsolatedStorage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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