Skip to content

Enums or string validator #16

@Pegoth

Description

@Pegoth

Want to use this for my mod as I like the look of the menu, but I need to use the InputKey enum, so I would love to have either a searchable dropdown or a validatable string input.

Setting like this:

[XmlElement]
[SettingProperty("Blabla", "More blabla", typeof(MyOwnStringValidator))]
public string OkayKey { get; set; }

Validator could be like this:

public class MyOwnStringValidator : IStringSettingValidator
{
    public bool IsValid(string input) => Enum.TryParse<InputKey>(input, true, out _);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions