mirror of
https://github.com/codex-storage/cs-codex-dist-tests.git
synced 2025-02-03 07:43:52 +00:00
support for bool in argsuniform
This commit is contained in:
parent
0d4960f3ff
commit
0caa53bf8c
@ -203,6 +203,7 @@ namespace ArgsUniform
|
||||
{
|
||||
if (uniformProperty.PropertyType == typeof(int?)) return AssignOptionalInt(result, uniformProperty, value);
|
||||
if (uniformProperty.PropertyType.IsEnum) return AssignEnum(result, uniformProperty, value);
|
||||
if (uniformProperty.PropertyType == typeof(bool)) return AssignBool(result, uniformProperty, value);
|
||||
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
@ -230,6 +231,15 @@ namespace ArgsUniform
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool AssignBool(T result, PropertyInfo uniformProperty, object value)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
uniformProperty.SetValue(result, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private string? GetFromArgs(string key)
|
||||
{
|
||||
var argKey = $"--{key}=";
|
||||
|
Loading…
x
Reference in New Issue
Block a user