api:umfconfig:parser_umfconfigdirectory
Description:
Default Directory parser.
Added In: v0.45
Function
public class UMFConfigDirectory : UMFConfigParser<string> { public string DefaultValue; public bool RequiresRestart; public string[] AllowedValues; public UMFConfigDirectory(string defaultValue = "", bool requiresRestart = false, params string[] allowedValues) { DefaultValue = defaultValue; RequiresRestart = requiresRestart; AllowedValues = allowedValues; } public override string Parse(string value) { if (!Directory.Exists(value)) { try { Directory.CreateDirectory(value); } catch { } } if (Directory.Exists(value)) return value; else return DefaultValue; } public override string ToString() { return DefaultValue.ToString(); } public override string Default() { return DefaultValue.ToString(); } 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
//Coming soon
Examples
//Coming soon
api/umfconfig/parser_umfconfigdirectory.txt · Last modified: 2019/06/29 22:35 by umfdev