ModLib icon indicating copy to clipboard operation
ModLib copied to clipboard

Enums or string validator

Open Pegoth opened this issue 4 years ago • 2 comments

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 _);
}

Pegoth avatar Apr 16 '20 21:04 Pegoth

Meanwhile: I just realized even strings are not supported yet, my bad

Pegoth avatar Apr 16 '20 21:04 Pegoth

This is defnitely on the list of features to add!

mipen avatar Apr 18 '20 06:04 mipen