I have a Xml config file with true
and false
statements in it. I need a function
which will return the bool
value.
<Configs>
<steerWithMouse>true</steerWithMouse>
<debug>false</debug>
</Configs>
The function would need a string
value for the node to go after. So something like this:
bool steerWithMouse = ReadConfigs("SteerWithMouse");
bool debug = ReadConfigs("debug");
public bool ReadConfigs(string config) {
try {
//Where the code should go.
}
catch {
//If the program fails to find or load the file correctly.
ModConsole.Error("Falied to load configs file."); //The console.
steerWithMouse = true;
debug = false;
}
}
Due to my inexperience in Xml files I have only meet frustration when trying to do this. It either didn't say anything, didn't compile or returned the whole document. I would gladly accept some help with this.