public SettingsPropertyDefinition(IEnumerable <IPropertyDefinitionBase> propertyDefinitions, IPropertyGroupDefinition propertyGroupDefinition, IRef propertyReference, char subGroupDelimiter)
        {
            SubGroupDelimiter = subGroupDelimiter;

            var groups = propertyGroupDefinition.GroupName.Split(SubGroupDelimiter);

            GroupName  = string.Join(SubGroupDelimiter.ToString(), groups.Select(x => new TextObject(x).ToString()));
            GroupOrder = propertyGroupDefinition.GroupOrder;

            PropertyReference = propertyReference;

            if (PropertyReference is PropertyRef propertyRef)
            {
                Id = propertyRef.PropertyInfo.Name;
            }

            if (PropertyReference.Type == typeof(bool))
            {
                SettingType = SettingType.Bool;
            }
            else if (PropertyReference.Type == typeof(int))
            {
                SettingType = SettingType.Int;
            }
            else if (PropertyReference.Type == typeof(float))
            {
                SettingType = SettingType.Float;
            }
            else if (PropertyReference.Type == typeof(string))
            {
                SettingType = SettingType.String;
            }
            else if (SettingsUtils.IsForGenericDropdown(PropertyReference.Type))
            {
                SettingType = SettingType.Dropdown;
            }
            else if (PropertyReference.Type == typeof(Action))
            {
                SettingType = SettingType.Button;
            }

            foreach (var propertyDefinition in propertyDefinitions)
            {
                if (propertyDefinition is { } propertyBase)
                {
                    DisplayName    = new TextObject(propertyBase.DisplayName).ToString();
                    Order          = propertyBase.Order;
                    RequireRestart = propertyBase.RequireRestart;
                    HintText       = new TextObject(propertyBase.HintText).ToString();
                }
                if (propertyDefinition is SettingPropertyAttribute settingPropertyAttribute) // v1
                {
                    MinValue         = settingPropertyAttribute.MinValue;
                    MaxValue         = settingPropertyAttribute.MaxValue;
                    EditableMinValue = settingPropertyAttribute.MinValue;
                    EditableMaxValue = settingPropertyAttribute.MaxValue;
                }
                if (propertyDefinition is IPropertyDefinitionBool propertyDefinitionBool) // v2
                {
                    // Do nothing
                }
                if (propertyDefinition is IPropertyDefinitionWithMinMax propertyDefinitionWithMinMax)
                {
                    MinValue         = propertyDefinitionWithMinMax.MinValue;
                    MaxValue         = propertyDefinitionWithMinMax.MaxValue;
                    EditableMinValue = propertyDefinitionWithMinMax.MinValue;
                    EditableMaxValue = propertyDefinitionWithMinMax.MaxValue;
                }
                if (propertyDefinition is IPropertyDefinitionWithEditableMinMax propertyDefinitionWithEditableMinMax)
                {
                    EditableMinValue = propertyDefinitionWithEditableMinMax.EditableMinValue;
                    EditableMaxValue = propertyDefinitionWithEditableMinMax.EditableMaxValue;
                }
                if (propertyDefinition is IPropertyDefinitionWithFormat propertyDefinitionWithFormat)
                {
                    ValueFormat = propertyDefinitionWithFormat.ValueFormat;
                }
                if (propertyDefinition is IPropertyDefinitionWithCustomFormatter propertyDefinitionWithCustomFormatter)
                {
                    CustomFormatter = propertyDefinitionWithCustomFormatter.CustomFormatter;
                }
                if (propertyDefinition is IPropertyDefinitionWithActionFormat propertyDefinitionWithActionFormat)
                {
                    // TODO:
                }
                if (propertyDefinition is IPropertyDefinitionText propertyDefinitionText)
                {
                    // Do nothing
                }
                if (propertyDefinition is IPropertyDefinitionDropdown propertyDefinitionDropdown)
                {
                    SelectedIndex = propertyDefinitionDropdown.SelectedIndex;
                }
                if (propertyDefinition is IPropertyDefinitionWithId propertyDefinitionWithId)
                {
                    Id = propertyDefinitionWithId.Id;
                }
                if (propertyDefinition is IPropertyDefinitionGroupToggle propertyDefinitionGroupToggle)
                {
                    IsToggle = propertyDefinitionGroupToggle.IsToggle;
                }
                if (propertyDefinition is IPropertyDefinitionButton propertyDefinitionButton)
                {
                    Content = new TextObject(propertyDefinitionButton.Content).ToString();
                }
            }
        }
        public SettingsPropertyDefinition(IEnumerable <IPropertyDefinitionBase> propertyDefinitions, IPropertyGroupDefinition propertyGroupDefinition, IRef propertyReference)
        {
            GroupName    = propertyGroupDefinition.GroupName;
            IsMainToggle = propertyGroupDefinition.IsMainToggle;
            GroupOrder   = propertyGroupDefinition.GroupOrder;

            PropertyReference = propertyReference;

            if (PropertyReference.Type == typeof(bool))
            {
                SettingType = SettingType.Bool;
            }
            else if (PropertyReference.Type == typeof(int))
            {
                SettingType = SettingType.Int;
            }
            else if (PropertyReference.Type == typeof(float))
            {
                SettingType = SettingType.Float;
            }
            else if (PropertyReference.Type == typeof(string))
            {
                SettingType = SettingType.String;
            }
            else if (SettingsUtils.IsDropdown(PropertyReference.Type))
            {
                SettingType = SettingType.Dropdown;
            }

            foreach (var propertyDefinition in propertyDefinitions)
            {
                if (propertyDefinition is IPropertyDefinitionBase propertyBase)
                {
                    DisplayName    = new TextObject(propertyBase.DisplayName, null).ToString();
                    Order          = propertyBase.Order;
                    RequireRestart = propertyBase.RequireRestart;
                    HintText       = new TextObject(propertyBase.HintText, null).ToString();
                }
                if (propertyDefinition is SettingPropertyAttribute settingPropertyAttribute) // v1
                {
                    MinValue         = settingPropertyAttribute.MinValue;
                    MaxValue         = settingPropertyAttribute.MaxValue;
                    EditableMinValue = settingPropertyAttribute.MinValue;
                    EditableMaxValue = settingPropertyAttribute.MaxValue;
                }
                if (propertyDefinition is IPropertyDefinitionBool propertyDefinitionBool) // v2
                {
                }
                if (propertyDefinition is IPropertyDefinitionWithMinMax propertyDefinitionWithMinMax)
                {
                    MinValue         = propertyDefinitionWithMinMax.MinValue;
                    MaxValue         = propertyDefinitionWithMinMax.MaxValue;
                    EditableMinValue = propertyDefinitionWithMinMax.MinValue;
                    EditableMaxValue = propertyDefinitionWithMinMax.MaxValue;
                }
                if (propertyDefinition is IPropertyDefinitionWithEditableMinMax propertyDefinitionWithEditableMinMax)
                {
                    EditableMinValue = propertyDefinitionWithEditableMinMax.EditableMinValue;
                    EditableMaxValue = propertyDefinitionWithEditableMinMax.EditableMaxValue;
                }
                if (propertyDefinition is IPropertyDefinitionWithFormat propertyDefinitionWithFormat)
                {
                    ValueFormat = propertyDefinitionWithFormat.ValueFormat;
                }
                if (propertyDefinition is IPropertyDefinitionText propertyDefinitionText)
                {
                }
                if (propertyDefinition is IPropertyDefinitionDropdown propertyDefinitionDropdown)
                {
                    SelectedIndex = propertyDefinitionDropdown.SelectedIndex;
                }
            }
        }
 public SettingsPropertyDefinition(IPropertyDefinitionBase propertyDefinition, IPropertyGroupDefinition propertyGroupDefinition, IRef propertyReference, char subGroupDelimiter)
     : this(new[] { propertyDefinition }, propertyGroupDefinition, propertyReference, subGroupDelimiter)
 {
 }
 public SettingsPropertyDefinition(IPropertyDefinitionBase propertyDefinition, IPropertyGroupDefinition propertyGroupDefinition, IRef propertyReference)
     : this(new [] { propertyDefinition }, propertyGroupDefinition, propertyReference)
 {
 }