2011-12-01 81 views
0

我有一个问题,当我想获得目录Windows Phone 7的文件清单IsolatedStorage

文件的列表,这是我的代码

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的长度是3,而不是零

请帮我:(

+0

有一堆用于查找独立存储的工具。确保你已经成功保存了这三个文件。 – Ku6opr

回答

0

我记得的一半,这意味着通配符搜索只用错误GetFileNames中的无法正常工作。
您是否验证了文件存在或尝试使用较少的通用搜索词?

相关问题