Vestigial Organs
by in CodeSOD on 2023-12-20Matt inherited some C# code that reads from a JSON config file.
public ServerJsonLoader(string configFile)
{
using (StreamReader reader = File.OpenText(configFile))
{
JObject config = ... //snip
if (config.GetValue("inputs") != null)
{
this.mixedConfig = config;
//Inputs
var inputs = ... //snip
//Outputs
if (config.GetValue("outputs") != null)
{
var outputs = ... //snip
}
}
else
{
if(config.GetValue("inputs") != null)
this.serverConfig = config;
if (config.GetValue("outputs") != null)
this.clientConfig = config;
}
}
}