How to trap it if the settings file doesnt exist?

Oct 7, 2008 at 6:06 PM
One thing I'm having trouble with is the ability to trap it if the user deletes the settings file.. So on the xbox and pc, even zune, what can I use to determine if the file is present, and if not send me a flag to write out a new default file?
Oct 8, 2008 at 9:11 AM
I don't think you really need to bother on the Xbox or Zune, neither have ways or a reason for the end user to delete a settings file.

On Windows, you can use File.Exists(string path) to determine if a file exists, just put in the path to the ini file and it will return a bool indicating if the file exists or not.
In fact, from looking at the source code for this, you could throw a try/catch block around your loading code and catch the FileNotFound exception yourself, since EasyConfig does not appear to handle that. Then you can do what you want, and that works on all 3 platforms.