public bool HasEntriesOfType(ConfigEntryType type) { if (entriesByType == null || entriesByType.Count <= 0) { return(false); } return(entriesByType.ContainsKey(type) && entriesByType[type].Count > 0); }
public static ConfigEntry Create(string key, string value, string desc, ConfigEntryType type) { if (string.IsNullOrWhiteSpace(key)) { throw new ArgumentNullException("key"); } return(new ConfigEntry() { Key = key, Value = value, Desc = desc }); }
public ConfigGroup AddOrReplace(string key, string value, ConfigEntryType type, string desc = null) { if (!Entries.ContainsKey(key)) { //add Entries[key] = ConfigEntry.Create(key, value, desc, type); return(this); } //update ConfigEntry.Reset(Entries[key], key, value, desc, type); return(this); }
public void AddCheckBoxes(ConfigEntryType type, TabPage tabPage, List <CheckBox> boxList) { if (!ConfigurationManager.Instance.HasEntriesOfType(type)) { return; } List <ConfigurationEntry> entries = ConfigurationManager.Instance.GetEntriesOfType(type); if (entries == null || entries.Count <= 0) { return; } int columnCount = 15; if (entries.Count > 42) { columnCount = 14; tabPage.AutoScroll = true; } for (int i = 0; i < entries.Count; i++) { var checkBox = new CheckBox { Location = new Point(6 + (i / columnCount) * 178, 6 + (i % columnCount) * 23), Size = new Size(175, 17), Name = entries[i].EntryName, Text = entries[i].GetDisplay(), ThreeState = true, CheckState = CheckState.Checked }; checkBox.CheckStateChanged += SettingsChanged; toolTip1.SetToolTip(checkBox, "Checked: Always Notify, Unchecked: Never notify, Dotted: Notify if mission is quick and easy."); tabPage.Controls.Add(checkBox); boxList.Add(checkBox); } }
public List <ConfigurationEntry> GetEntriesOfType(ConfigEntryType type) { entriesByType.TryGetValue(type, out List <ConfigurationEntry> entries); return(entries); }
public static void Reset(ConfigEntry entry, string key, string value, string desc, ConfigEntryType type) { if (entry == null) { throw new ArgumentNullException("entry"); } if (string.IsNullOrWhiteSpace(key)) { throw new ArgumentNullException("key"); } entry.Key = key; entry.Value = value; entry.Desc = desc; }