public void AddTunable(TunableStore newSetting, bool replace) { List <TunableStore> list; if (!Tunables.TryGetValue(newSetting.ParentType, out list)) { list = new List <TunableStore>(); Tunables.Add(newSetting.ParentType, list); } for (int i = list.Count - 1; i >= 0; i--) { TunableStore oldSetting = list[i]; if (oldSetting.IsEqual(newSetting)) { if (!replace) { return; } mTunables.Remove(oldSetting); list.RemoveAt(i); break; } } list.Add(newSetting); mTunables.Add(newSetting); }
public TunableStore GetTunable(TunableStore setting) { List <TunableStore> list; if (Tunables.TryGetValue(setting.ParentType, out list)) { foreach (TunableStore store in list) { if (setting.IsEqual(store)) { return(store); } } } return(null); }