api:umfconfig:parser_umfconfigkeycodearray
Description:
Default KeyCode[] parser.
Added In: v0.45
Function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
public class UMFConfigKeyCodeArray : UMFConfigParser<KeyCode[]> { public KeyCode[] DefaultValues; public bool RequiresRestart; public KeyCode[] AllowedValues; public UMFConfigKeyCodeArray(KeyCode[] defaultValues = default (KeyCode[]), bool requiresRestart = false , params KeyCode[] allowedValues) { DefaultValues = defaultValues; RequiresRestart = requiresRestart; AllowedValues = allowedValues; } public override KeyCode[] Parse( string value) { return value.Trim().Split( new string [] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(x => (KeyCode)Enum.Parse( typeof (KeyCode), x, true )).ToArray(); } public override string ToString() { return string .Join( "," , DefaultValues.Select(x => x.ToString()).ToArray()); } public override string Default() { return string .Join( ", " , DefaultValues.Select(x => x.ToString()).ToArray(), 0, 2); } public override string Allowed() { return (AllowedValues.Length > 0 ? string .Join( "," , AllowedValues.Select(x => x.ToString()).ToArray()) : null ); } public override string Restart() { return RequiresRestart.ToString(); } } |
Usage
1 |
//Coming soon |
Examples
1 |
//Coming soon |
api/umfconfig/parser_umfconfigkeycodearray.txt · Last modified: 2019/06/29 23:39 by umfdev