INIFile.vbs
INIFile.vbs copied to clipboard
Limit string parsing and manipulation to loading and saving
INI file data is currently parsed from the file contents every time GetValue()
, SetValue()
, GetSections()
, or GetKeys()
is called. Further, SetValue()
completely rewrites portions of the file contents every time it is called. This is inefficient.
Instead, string parsing and manipulation should only occur when absolutely necessary: during loading and saving of the INI file. When the INI file is loaded, the string contents of the file should be parsed and loaded into data structures to represent the file's contents. When the INI file is saved, the data structures should be converted back into a string for persistence.
It would be much more efficient to look up sections and keys, add new sections and keys, or replace existing keys in a section, if they were all contained in collections, which can be indexed (for example, by using nested Dictionary
objects).