I'm seeing a new trend of plugins including ini parser to manage their config files. Thing is, RPH has it's own system to handle this. Using ini parser is absolutely not needed.
If you are one of those devs reading this, I will show how you can use RPH's system instead.
First, make a simple static file such as Settings.cs in your project. In this settings file you will manage everything to do with the config, and it's pretty darn simple.
I personally suggest making it static because in my own personal use case I find it better to never be instantiated. Inside this class:
Simply make a bunch of public/internal declarations for the values you want.
Create a LoadSettings() and optionally a SaveSettings() method.
Initialize the ini file. You want to use its path. Most common is in the same path as the dll. (This requires the Rage import!) Example:
Assign the values and set the defaults. You can use IntelliSense to see what is what in the ini.* Example:
First string is the section name, and the second is the key name. You can have multiple keys per section. Example:
The third option is the default value. This is important because if the file is missing, or broken it will use the default value.
That's it for reading an ini file. All you do now is run the LoadSettings() in your main class when the plugin is loaded and it will set all of the variables to their corresponding ini value. Since the class is static, and the values are internal or public you can access them anywhere in your plugin and the value will always be correct.
You can optionally edit an ini file. It's pretty much the same. You initialize the file, then you write instead of read. Here is how it can look:
In this case, you can actually set those values you made in the Settings.cs and when you run the method, it will save them to the ini file. It's the exact same as reading the ini except in reverse.
Here is how the important parts of my settings file look:
That's it! Now we load the ini at startup by running your new load method. My example:
And now those settings are loaded! Keep in mind you can run this method at anytime, so if you have a button or console command to reload the config, you can! It works live.
Here is how you can access the setting in your code: