Same thing as AMS.Profile, but with the ability to change entry and section names inside an .ini file.
Here are the features that don't exist on the original that I added:
Ini.ChangeSectionName(string, string)
- You give the original name and the new name, and the old is replaced by the new.
Ini.ChangeEntryName(string, string, string)
- You give the specific section, the original entry name, and the new entry name, and the old is replaced by the new.
Ini.AddSection(string)
- Adds a new section to the current INI file without having to remove temporary entries for later use.
IniReader.ReadConfig(string)
- Reads an ini-config file into a structurized dictionary. (format: <string, <string, string>>)
- Uses the
StreamReader
class to get the original file contents. - Replaces the section name found in the file string with the new name.
- Uses the
File
class to delete the original file and create a new blank one. - Uses the
StreamWriter
class to re-write the file with the new section name.
This is an iteration loop by the way.
- Gets the value of the entry in the current iteration.
- Uses
Ini.RemoveEntry(string, string)
in the original dll to remove the entry in the current iteration. - Re-creates the entry with its original value in the current iteration, and uses the new name specified if it matches the original name given.
There is a nested loop in this by the way.
- Uses
Ini.GetSectionNames()
to get every section. - Creates a dictionary for storing all entries of the current section.
- Uses
Ini.GetEntryNames(string)
to get every entry in the current section iteration. - Stores each entry and its value in the current section dictionary.
- Stores the entry dictionary for the current section and the current section name in the config info.
I have tested both methods with an ini file containing several sections, and several entries for each section. I made everything was in order every time there was a change in the file without something be added.