User Tools

Site Tools


api:umfconfig:parser_umfconfigstring

Description:
Default string parser.

Added In: v0.45

Function

    public class UMFConfigString : UMFConfigParser<string>
    {
        public string DefaultValue;
        public string VanillaValue;
        public bool KeyBind;
        public bool RequiresRestart;
        public string[] AllowedValues;

        public UMFConfigString(string defaultValue = "", string vanillaValue = "", bool isKeyBind = false, bool requiresRestart = false, params string[] allowedValues)
        {
            DefaultValue = defaultValue.Trim();
            VanillaValue = vanillaValue.Trim();
            KeyBind = isKeyBind;
            RequiresRestart = requiresRestart;
            AllowedValues = allowedValues;
        }

        public override string Parse(string value)
        {
            return value.Trim();
        }

        public override string ToString()
        {
            return DefaultValue;
        }

        public override string Default()
        {
            return DefaultValue;
        }

        public override string Vanilla()
        {
            return VanillaValue.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();
        }

        public override string IsKeyBind()
        {
            return KeyBind.ToString();
        }
    }



Usage

//Coming soon



Examples

//Coming soon


This topic does not exist yet

You've followed a link to a topic that doesn't exist yet. If permissions allow, you may create it by clicking on Create this page.

api/umfconfig/parser_umfconfigstring.txt · Last modified: 2019/06/29 23:40 by umfdev