Paul Johnston - 2010-10-21 16:18:36
According to Wikipedia the INI comment character is the semi-colon so no # chars
So I'd like to see this syntax of INI file be read and re-written:
------------------------------------------------------------------
;FILEcomment: This file is used for the ACME XXXYYY program
;It is usually stored in c:\settings\XXXYYY
;For more on this program see: http://ourdocs/XXXYYY/
;SECTIONcomment: This is the main config section
;If you don't see it here it don't exist
[config]
;KEYWORDcomment: this points to your passwords file
;Make sure you keep it encrypted
dirpath=c:\secure\allmypasswords.txt ;VALUEcomment: ignore this
------------------------------------------------------------------
Even though I can see the usefulness of the inline/VALUE comment, for the sake of keeping this simple I'd rather see the KEYWORDcomment implemented. However, sometimes the value stored is a simple numeric value that relates to something from a dropdown box and it could be good to keep that info (i.e. "SENTBY=0 ;EMAIL" or "SENTBY=1 ;FAX", etc.)
So, obviously whenever reading the file, you may have to turn the parts into objects with each class having a CommentLines array. And, whenever writing, you'd have to write the CommentLines first before each.
Maybe add an extra param to the INI Manager constructor to allow for the more complicated use of comments.