public static bool Load(IConfigurable target, string iniFile) { Debug.WriteLine("Loading configuration file " + iniFile); // Reset to default target.ResetParameters(); try { // Load custom settings from INI file using (var ini = new IniReader(iniFile, true)) { ini.AddHandler((x) => { if (target.AcceptsConfigs.Any(y => y == x.Group)) { target.ApplyParameter(x); } }); ini.Parse(); } return(true); } catch { Debug.WriteLine("Failed to load configuration from " + iniFile); } return(false); // DONE :) }
public static bool Load(IConfigurable target, string iniFile) { Debug.WriteLine("Loading configuration file " + iniFile); // Reset to default target.ResetParameters(); try { // Load custom settings from INI file using (var ini = new IniReader(iniFile, true)) { ini.AddHandler((x) => { if (target.AcceptsConfigs.Any(y => y == x.Group)) { target.ApplyParameter(x); } }); ini.Parse(); } return true; } catch { Debug.WriteLine("Failed to load configuration from " + iniFile); } return false; // DONE :) }