private static UIComponent ProcessProperty <T>(this UIHelperBase group, IOptionsWrapper <T> options, string propertyName, string description, Func <string, string> translator = null)
        {
            if (translator != null)
            {
                description = translator.Invoke(description);
            }
            UIComponent component         = null;
            var         checkboxAttribute = options.GetOptions().GetAttribute <T, CheckboxAttribute>(propertyName);

            if (checkboxAttribute != null)
            {
                component = group.AddCheckbox <T>(options, description, propertyName, checkboxAttribute);
            }
            var textfieldAttribute = options.GetOptions().GetAttribute <T, TextfieldAttribute>(propertyName);

            if (textfieldAttribute != null)
            {
                component = group.AddTextfield <T>(options, description, propertyName, textfieldAttribute);
            }
            var enumDropDownAttribute = options.GetOptions().GetAttribute <T, EnumDropDownAttribute>(propertyName);

            if (enumDropDownAttribute != null)
            {
                component = group.AddEnumDropdown <T>(options, description, propertyName, enumDropDownAttribute, translator);
            }
            var dynamicDropDownAttribute = options.GetOptions().GetAttribute <T, DynamicDropDownAttribute>(propertyName);

            if (dynamicDropDownAttribute != null)
            {
                component = group.AddDynamicDropdown <T>(options, description, propertyName, dynamicDropDownAttribute, translator);
            }
            var sliderAttribute = options.GetOptions().GetAttribute <T, SliderAttribute>(propertyName);

            if (sliderAttribute != null)
            {
                component = group.AddSlider <T>(options, description, propertyName, sliderAttribute);
            }
            var buttonAttribute = options.GetOptions().GetAttribute <T, ButtonAttribute>(propertyName);

            if (buttonAttribute != null)
            {
                component = group.AddButton <T>(description, buttonAttribute);
            }
            var labelAttribute = options.GetOptions().GetAttribute <T, LabelAttribute>(propertyName);

            if (labelAttribute != null)
            {
                component = group.AddLabel <T>(description);
            }
            //TODO: more control types

            var descriptionAttribute = options.GetOptions().GetAttribute <T, DescriptionAttribute>(propertyName);

            if (component != null && descriptionAttribute != null)
            {
                component.tooltip = (translator == null || descriptionAttribute is DontTranslateDescriptionAttribute) ? descriptionAttribute.Description : translator.Invoke(descriptionAttribute.Description);
            }
            return(component);
        }
 private static UIComponent ProcessProperty <T>(this UIHelperBase group, string name, string description) where T : IModOptions
 {
     if (OptionsWrapper <T> .Options.IsCheckbox(name))
     {
         return(group.AddCheckbox <T>(description, name, OptionsWrapper <T> .Options.GetCheckboxAction(name)));
     }
     if (OptionsWrapper <T> .Options.IsTextField(name))
     {
         return(group.AddTextField <T>(description, name, OptionsWrapper <T> .Options.GetTextFieldAction(name)));
     }
     if (OptionsWrapper <T> .Options.IsDropdown(name))
     {
         return(group.AddDropdown <T>(description, name, OptionsWrapper <T> .Options.GetDropdownItems(name), OptionsWrapper <T> .Options.GetDropdownAction(name)));
     }
     if (OptionsWrapper <T> .Options.IsDynamicDropdown(name))
     {
         return(group.AddDynamicDropdown <T>(description, name, OptionsWrapper <T> .Options.GetDynamicDropdownItems(name), OptionsWrapper <T> .Options.GetDynamicDropdownAction(name)));
     }
     //TODO: more control types
     return(null);
 }