User Tools

Site Tools


api:umfconfig:parser_umfconfigbool

Description:
Default bool 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
39
public class UMFConfigBool : UMFConfigParser<bool>
{
    public bool? DefaultValue;
    public bool? VanillaValue;
    public bool RequiresRestart;
 
    public UMFConfigBool(bool? defaultValue = null, bool? vanillaValue = null, bool requiresRestart = false)
    {
        DefaultValue = defaultValue;
        VanillaValue = vanillaValue;
        RequiresRestart = requiresRestart;
    }
 
    public override bool Parse(string value)
    {
        if (!bool.TryParse(value, out bool result)) result = DefaultValue ?? false;
        return result;
    }
 
    public override string ToString()
    {
        return DefaultValue.ToString() ?? null;
    }
 
    public override string Default()
    {
        return DefaultValue.ToString() ?? null;
    }
 
    public override string Vanilla()
    {
        return VanillaValue.ToString() ?? null;
    }
 
    public override string Restart()
    {
        return RequiresRestart.ToString();
    }
}



Usage

1
//Coming soon



Examples

1
//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_umfconfigbool.txt · Last modified: 2019/06/29 23:34 by umfdev