c# - Windows Phone 7 crash when accessing directory -


i having trouble getting info on directory in windows phone 7 c#. application freezes or crashes when call:

system.io.directoryinfo dir = new system.io.directoryinfo("content/levels"); 

it freezes when try determine path of application think problem lies.

what possibly doing wrong , can fix this?

update: seems problem related sequirity issue don't know how resolve this. there possibly way find root directory withouth sequirity isue?

if makes differences these files stored in xna content pipeline.

to access file within actual xap (known "title storage"), first of must export content xna content pipeline. select file(s) content project , under properties set build action content (i believe none same thing). export directly, raw, xap , accessible within game/app.

secondly, access files title storage, can't access root directory directly on wp7. use this class access files title storage:

using (streamreader r =  new streamreader(titlecontainer.openstream("content/levels/level1.xml"))) {     //read file } 

the method returns system.io.stream can use direct access file itself.

if game needs know files within particular folder, directory enumerating , not allowed on platform, have generate beforehand @ compile time, possible using content pipeline:

http://xbox.create.msdn.com/en-us/sample/contentmanifestextensions


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -