Getting an exception when working with directoryInfo in C# / XNA -


think have problem windows phone application. in application have static method returns me collection of textures located in specific folder. when launch application on wp 8 emulator it`s worked well, when launch on wp 7 emulator exception message "directory not exist". in fact directory existing. tell me why happends ?

here attached code:

namespace hornbook_v2 {     public static class contentloader     {         public static dictionary<string, t> loadtextures<t>(this contentmanager contentmanager, string contentfolder)         {             //load directory info, abort if none             directoryinfo dir = new directoryinfo(contentmanager.rootdirectory + "\\" + contentfolder);              //  exception happends here!!!             if (!dir.exists)                 throw new directorynotfoundexception();              //init resulting list             dictionary<string, t> result = new dictionary<string, t>();              //load files matches file filter             fileinfo[] files = dir.getfiles("*.*");             foreach (fileinfo file in files)             {                 string key = path.getfilenamewithoutextension(file.name);                  //result[key] = contentmanager.load<t>(contentmanager.rootdirectory + "/" + contentfolder + "/" + key);                 result[key] = contentmanager.load<t>(contentfolder + "/" + key);             }              //return result             return result;         }          } } 

you try using isolatedstorage api, if 1 directoryexists check this:

edit

if need port isolatedstorage, this msdn page may of use:


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -