-
1 Attachment(s)
INIFile class
This is something i wrote for myself recently and figure others might find useful too, as already since creating this i've found many quick uses for it (i find it easiest to compile it as a dll and reference it when needed).
With this class, simply create an instance(providing a fully qualified filename) and start accessing variables right away with functions .setValue(<group name>,<key name>,<new value>) .getValue(<group name>,<key name>) or .Group(<group name>)
Group will return an INIGroup class which also has .setValue and .getValue (without the group parameter).
If you use .getValue and it doesn't exist, you will simply be returned an empty string. All file operations are handled by the class, when you set a value it will be changed in the ini file, when you instantiate the class it will read from the file. These operations can also be forced.
NOTE: Terminology of group key and value, example INI below
[GROUP]
key=value
NOTE: there is also a few more functions i havn't mentioned to play with like .Group(<group>).GetKey(<index>)
code written in C# 2005