How to store/reload appication settings

Hello all,

For my CNC project, i’m searching a way to store some configurable settings.
I think storing them to the SD card is a good option, because then you have the possibility to edit the file on your pc etc.
there are some snapshots around, but i can decide which method to use, yet. But also Pin locations when that is possible.
I hoping to have a class/object with all the values to be accessible trough the application.

It would be nice when i can access those values very easy within my application. i have already seen the options of hashtable etc.
But most values i need to store are just numbers and booleans etc.

Although i have already search the forum and codeshare, i hope you can give me some ideas how you are doing this kind of things?
What kind of options do i have?

thank you very much.
Niels

SD card would be one option.
EWR if available is another option.

Or you can use something like this:
http://www.ghielectronics.com/catalog/product/389

There is even a tiny file system implemented for it:
http://www.tinyclr.com/codeshare/entry/559

Sorry i forgot to mention i use the FEZ Cerbuino Bee
So i belief EWR is not available on it, is it not?

I would use flash module or SD card

We have many codeshare solutions. Check them out:

http://www.tinyclr.com/codeshare/search?q=settings

If power is reliable i would suggest SD, file system available, easy exchange, nothing but advantages.

Is there an easy way to save/restore properties from a SD file? Like an Ini file or so.
I have seen something on codeshare but that does only store Strings, but need to store numbers etc.

The medium where i store it is not that important atm the way how is what i like to know :wink:

@ Architect; i know there are some on codeshare, i just like to know your (and others) solutions and why you use that. So i better decide what i going to use.

Not like a ini file where y can specify what element y want read / write as we know this now but as a simple file (like the windows 3.0 day’s)
Have a look at:

and then explore the file stream options, i just read the complete file most of the times and the split it up by line, then check line by line.

If it is a text settings file everything there will be strings. You just need to convert values of numeric settings to proper types after you read them.

Here is one ini file implementation
http://www.tinyclr.com/codeshare/entry/380

SD Card is great if you might want to modify settings from external.
Lets say you have messed up some settings (like IP settings)
You simply put the card into a PC and correct the settings.
This also allows me to define system settings which I don’t like to be changed from within the NETMF App.

Just an update on this topic.

Today i found the json library from Mike Jones on the codeshare. And i think i will use that to store my settings to the SD card,

The only think i found out that it is not ready to use, there are a lot of debug messages while deserializing. Now i’m trying to cleanup the package to make it simpler.

One of the thinks i’m wondering is, why he has a base public class where he call’s a the same function’s in a static class the following structure, I dont say it is wrong or so, i just want to understand and maybe learn from it.


namespace IndianaJones.NETMF.Json
{
	/// <summary>
	/// .NET Micro Framework JSON Serializer and Deserializer.
	/// </summary>
	public class Serializer
	{
		private PropertyTable _propertyTable;
		private DateTimeFormat _dateFormat;

		public Serializer() { }

        /// <summary>
		/// Serializes an object into a Json string.
		/// </summary>
		/// <param name="o"></param>
		/// <returns></returns>
		public string Serialize(object o)
		{
			return JsonPrimitives.Serialize(o);
		}
    
        public bool Deserialize(string json, object o )
        {
  			bool success = true;
            Type T = o.GetType();
            if (!T.IsClass || T.Name == "string") { return false; }
            return JsonPrimitives.Deserialize(json, o, T);
        }
	}

	public static class JsonPrimitives
	{
		#region Deserialize Methods

        public static bool Deserialize(string json, object o, Type T)
		{
        }

        #endregion

		#region Serialize Methods
		
		public static string Serialize(object o) { }

		#endregion

	}
}

thanks
Niels