public GroupUsageItem(ParamGroup group) { this.group = group; if (this.group.Name == null) { groupName = "Miscellaneous"; } else { groupName = this.group.Name.Substring(0, 1).ToUpper() + this.group.Name.Substring(1); } if (this.group.Required) { groupName += " (One Required)"; } }
static HgbstUtilConfig() { Db_type = null; DebugMode = false; QuietMode = false; Db_pass = null; Db_user = null; Db_name = null; Db_server = null; ReparentVals = null; ListTree = null; paramMap = new Hashtable(StringComparer.InvariantCulture); groupMap = new Hashtable(StringComparer.InvariantCulture); nameMap = new NameValueCollection(); var paramGroup = new ParamGroup {Required = false}; groupMap.Add("Miscellaneous", paramGroup); var properties = typeof (HgbstUtilConfig).GetProperties(); foreach (var propertyInfo in properties) { var configParamAttributes = propertyInfo.GetCustomAttributes(typeof (ConfigParamAttribute), false); if (configParamAttributes.Length <= 0) continue; var configParamAttribute = (ConfigParamAttribute) configParamAttributes[0]; configParamAttribute.Property = propertyInfo; paramMap.Add(configParamAttribute.ParamNameLong, configParamAttribute); nameMap.Add(configParamAttribute.ParamNameShort, configParamAttribute.ParamNameLong); nameMap.Add(configParamAttribute.ParamNameLong, configParamAttribute.ParamNameShort); if (configParamAttribute.Group != null && configParamAttribute.Group != "Miscellaneous") { if (groupMap.ContainsKey(configParamAttribute.Group) == false) { paramGroup = new ParamGroup {Name = configParamAttribute.Group, Required = configParamAttribute.GroupRequired}; paramGroup.ParamNames.Add(configParamAttribute.ParamNameLong); groupMap.Add(configParamAttribute.Group, paramGroup); } else { paramGroup = (ParamGroup) groupMap[configParamAttribute.Group]; if (configParamAttribute.GroupRequired && paramGroup.Required == false) paramGroup.Required = true; paramGroup.ParamNames.Add(configParamAttribute.ParamNameLong); } } else { paramGroup = (ParamGroup) groupMap["Miscellaneous"]; paramGroup.ParamNames.Add(configParamAttribute.ParamNameLong); } } }