Description:
Default int parser.
Added In: v0.45
public class UMFConfigInt : UMFConfigParser<int> { public int DefaultValue; public int MinValue; public int MaxValue; public int VanillaValue; public bool RequiresRestart; public int[] AllowedValues; public UMFConfigInt(int defaultValue = default(int), int minValue = default(int), int maxValue = default(int), int vanillaValue = default(int), bool requiresRestart = false, params int[] allowedValues) { DefaultValue = defaultValue; MinValue = Math.Min(minValue, maxValue); MaxValue = Math.Max(minValue, maxValue); VanillaValue = vanillaValue; RequiresRestart = requiresRestart; AllowedValues = allowedValues; } public override int Parse(string value) { if (!int.TryParse(value, out int result)) result = DefaultValue; return result; } public override string ToString() { return DefaultValue.ToString(); } public override string Default() { return DefaultValue.ToString(); } public override string Range() { return (MaxValue != default(int) ? MinValue.ToString() + "," + MaxValue.ToString() : null); } public override string Vanilla() { return (VanillaValue != default(int) ? VanillaValue.ToString() : null); } public override string Allowed() { return (AllowedValues.Length > 0 ? string.Join(",", AllowedValues.Select(x => x.ToString()).ToArray()) : null); } public override string Restart() { return RequiresRestart.ToString(); } }
//Coming soon
//Coming soon