Exemple #1
0
        public bool HasEntriesOfType(ConfigEntryType type)
        {
            if (entriesByType == null || entriesByType.Count <= 0)
            {
                return(false);
            }

            return(entriesByType.ContainsKey(type) && entriesByType[type].Count > 0);
        }
Exemple #2
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
     });
 }
Exemple #3
0
 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);
 }
Exemple #4
0
        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);
            }
        }
Exemple #5
0
 public List <ConfigurationEntry> GetEntriesOfType(ConfigEntryType type)
 {
     entriesByType.TryGetValue(type, out List <ConfigurationEntry> entries);
     return(entries);
 }
Exemple #6
0
 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;
 }