I have used a streamreader/stream writer to save to and load from txt files… That way, you can easily edit the settings file manually, if settings dont work for current user system… (make sure you overload your streamreader to be culture-independent, so it’ll run correctly on any language/ region setting)
I have also used xml… Which is probably better, and very easy to do… You can basically read data-entries from xml like its variables in a class… only of coarse the xml is a stored file
If you dont know xml it sounds like a hassle, but you will be able to do what you are talking about today if you set out to learn xml… its as easy as note-pad, almost.
I’m familiar with XML and other formats including JSON, YAML and INI. I don’t know the correct file system path on the numerous platforms, though I could look it up and write the correct code for each one. However, I imagine someone has already done this.
Maybe it’s enough to use Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData):
Or maybe I should use Properties.Settings.Default[“key”] as described at:
I guess I’m wondering if there is a “best practice” or “typical practice” for portable monogames.
Pretty sure xml is considered typical. I think even some console games use xml?
-Anyways, I hear people mention it all the time, it seems pretty conventional.
And you can just drag your xml files into the solution explorer, and store/distribute it like any other content. That goes for txt too… So you dont have to worry about various platform paths… The program just retrieves them from its own install folder.
Don’t use StorageContainer, it has been removed in the newest MG from source, so 3.6 won’t have it.
On the question of how to save stuff, I would recommend you look into XmlSerialization (or any type of serialization for that matter). Serialization allows you to save an instance of an object which is very useful since you can create a class named Settings which instance you just save/load from a file.
Sorry for digging this topic (239 days old yeah!), but I’m trying to port my game to Android and it seems that IsolatedStorageSettings class is not available and it’s strange because similiar class IsolatedStorageFile is cross-platform. Is there any similiar cross-platform class to store app settings ? Or should I write something on my own, like IsolatedStorageSettings for WP, SharedPreferences for Android etc. I know I could also use IsolatedStorageFile but I don’t want messing with saving/reading file just for settings.