示例#1
0
 /// <summary>
 /// Adds a custom setting
 /// </summary>
 /// <param name="setting">PowerSetting to add</param>
 public void AddSetting(PowerSetting setting)
 {
     if (_settings.ContainsKey(setting.Name))
     {
         throw new ArgumentException("settings already contain key", setting.Name);
     }
     _settings.Add(setting.Name, setting);
 }
示例#2
0
 /// <summary>
 /// Gets a custom PowerScheduler setting
 /// </summary>
 /// <param name="name">setting name</param>
 /// <returns>requested PowerSetting</returns>
 public PowerSetting GetSetting(string name)
 {
     if (_settings.ContainsKey(name))
     {
         return(_settings[name]);
     }
     else
     {
         PowerSetting setting = new PowerSetting(name);
         AddSetting(setting);
         return(setting);
     }
 }