开发者

WP7 Isolated Storage

开发者 https://www.devze.com 2023-01-25 13:23 出处:网络
I\'m trying to grab my files from isolated storage but unfortunatly it is pulling in all the files not 开发者_C百科just the specified ones from the pattern.

I'm trying to grab my files from isolated storage but unfortunatly it is pulling in all the files not 开发者_C百科just the specified ones from the pattern.

I'm using:

foreach (string fileName in storage.GetFileNames("*.item"))

Is this a known bug or am I just doing something wrong?

PS. The use of wildcards is essential

Any help very much apprieciated,

Thanks!


I'm not sure why it is not working. But you can try this one as well:

storage.GetFileNames().Select(fileName => fileName.EndsWith("item"));


There is a IsolatedStorage search pattern bug in the final SDK release. Have a look at this post - http://blogs.compactframework.de/Peter.Nowak/2010/09/18/WP7+Final+SDK+Bug+IsolatedStorageFile+And+Ldquosearchpatternrdquo+And+A+Fix.aspx

HTH, indyfromoz


This is a known issue. You'll need to either structure your files into folders if you want to limit what's retrieved or test/filter the filenames before loading them.


Looks like a bug in the CTP/Beta versions of IsolatedStorageFile.GetFileNames(string pattern)...

http://blogs.compactframework.de/Peter.Nowak/Trackback.aspx?guid=4d8d9b73-619f-43c7-bf6c-12429327206b


This API bug has been fixed in the release of the Windows Phone 7.1 SDK (Otherwise known as the "Mango" release).

Your code will work fine now.

0

精彩评论

暂无评论...
验证码 换一张
取 消