windows phone 7 File Listing IsolatedStorage

☆樱花仙子☆ 提交于 2019-12-25 00:50:58

问题


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

this is my code

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

        }

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

please help me :(


回答1:


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?



来源:https://stackoverflow.com/questions/8344074/windows-phone-7-file-listing-isolatedstorage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!