func (prefs Preferences) SetValue(key string, value string) (Preferences, error) {
	parts := strings.Split(key, ".")
	section := parts[0] // [Core|Default]
	key = parts[1]      // Rest of the property name

	// Identify category struct by ini tag name [Core|Default]
	values := reflect.ValueOf(&prefs).Elem()
	target := findElemByName(values, section)

	// Identify field to update by ini tag name
	values = reflect.ValueOf(&prefs).Elem().FieldByName(target)
	if values == reflect.Zero(reflect.TypeOf(values)).Interface() {
		return prefs, errs.NewExitError("error: unknown section `" + section + "`")
	}
	property := findElemByName(values, key)

	// Ensure the field is not zero
	field := values.Addr().Elem().FieldByName(property)
	if field == reflect.Zero(reflect.TypeOf(field)).Interface() {
		return prefs, errs.NewExitError("error: unknown property `" + key + "`")
	}

	switch field.Type() {
	case reflect.TypeOf(true):
		v := true
		if value != "true" && value != "1" {
			v = false
		}
		field.SetBool(v)
	default:
		field.SetString(value)
	}

	return prefs, nil
}
// SetValue for ini key on preferences struct
SetValue for ini key on preferences struct
// SetValue for ini key on preferences struct
func (prefs Preferences) SetValue(key string, value string) (Preferences, error) {
	parts := strings.Split(key, ".")
	section := parts[0] 
	key = parts[1]      
	values := reflect.ValueOf(&prefs).Elem()
	target := findElemByName(values, section)
	values = reflect.ValueOf(&prefs).Elem().FieldByName(target)
	if values == reflect.Zero(reflect.TypeOf(values)).Interface() {
		return prefs, errs.NewExitError("error: unknown section `" + section + "`")
	}
	property := findElemByName(values, key)
	field := values.Addr().Elem().FieldByName(property)
	if field == reflect.Zero(reflect.TypeOf(field)).Interface() {
		return prefs, errs.NewExitError("error: unknown property `" + key + "`")
	}
	switch field.Type() {
	case reflect.TypeOf(true):
		v := true
		if value != "true" && value != "1" {
			v = false
		}
		field.SetBool(v)
	default:
		field.SetString(value)
	}
	return prefs, nil
}
func ( prefs Preferences ) SetValue ( key string , value string ) ( Preferences , error ) { parts := strings . Split ( key , " " ) section := parts [ 0 ] key = parts [ 1 ] values := reflect . ValueOf ( & prefs ) . Elem ( ) target := findElemByName ( values , section ) values = reflect . ValueOf ( & prefs ) . Elem ( ) . FieldByName ( target ) if values == reflect . Zero ( reflect . TypeOf ( values ) ) . Interface ( ) { return prefs , errs . NewExitError ( " " + section + " " ) } property := findElemByName ( values , key ) field := values . Addr ( ) . Elem ( ) . FieldByName ( property ) if field == reflect . Zero ( reflect . TypeOf ( field ) ) . Interface ( ) { return prefs , errs . NewExitError ( " " + key + " " ) } switch field . Type ( ) { case reflect . TypeOf ( true ) : v := true if value != " " && value != " " { v = false } field . SetBool ( v ) default : field . SetString ( value ) } return prefs , nil }
SetValue for ini key on preferences struct
SetValue for ini key on preferences struct
// [Core|Default] // Rest of the property name // Identify category struct by ini tag name [Core|Default] // Identify field to update by ini tag name // Ensure the field is not zero