Create a arguments system
This commit is contained in:
parent
ad7b619706
commit
b217d463eb
5 changed files with 477 additions and 0 deletions
112
Arguments/Types.cs
Normal file
112
Arguments/Types.cs
Normal file
|
@ -0,0 +1,112 @@
|
|||
namespace LibAC.Arguments
|
||||
{
|
||||
/// <summary>
|
||||
/// Argument class for String values.
|
||||
/// </summary>
|
||||
public class StringArgument : IArgument
|
||||
{
|
||||
public string Key { get; set; }
|
||||
private string? value;
|
||||
|
||||
public StringArgument(string key, string? value = null)
|
||||
{
|
||||
Key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public object? GetValue() => value;
|
||||
|
||||
public ArgumentType GetValueType() => ArgumentType.String;
|
||||
|
||||
public bool HasValue() => value != null;
|
||||
public bool required { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Argument class for Integer values.
|
||||
/// </summary>
|
||||
public class IntegerArgument : IArgument
|
||||
{
|
||||
public string Key { get; set; }
|
||||
private int? value;
|
||||
|
||||
public IntegerArgument(string key, int? value = null)
|
||||
{
|
||||
Key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public object? GetValue() => value;
|
||||
|
||||
public ArgumentType GetValueType() => ArgumentType.Integer;
|
||||
|
||||
public bool HasValue() => value.HasValue;
|
||||
public bool required { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Argument class for Boolean values.
|
||||
/// </summary>
|
||||
public class BooleanArgument : IArgument
|
||||
{
|
||||
public string Key { get; set; }
|
||||
private bool? value;
|
||||
|
||||
public BooleanArgument(string key, bool? value = null)
|
||||
{
|
||||
Key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public object? GetValue() => value;
|
||||
|
||||
public ArgumentType GetValueType() => ArgumentType.Boolean;
|
||||
|
||||
public bool HasValue() => value.HasValue;
|
||||
public bool required { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Argument class for Float values.
|
||||
/// </summary>
|
||||
public class FloatArgument : IArgument
|
||||
{
|
||||
public string Key { get; set; }
|
||||
private float? value;
|
||||
|
||||
public FloatArgument(string key, float? value = null)
|
||||
{
|
||||
Key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public object? GetValue() => value;
|
||||
|
||||
public ArgumentType GetValueType() => ArgumentType.Float;
|
||||
|
||||
public bool HasValue() => value.HasValue;
|
||||
public bool required { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Argument class for Double values.
|
||||
/// </summary>
|
||||
public class DoubleArgument : IArgument
|
||||
{
|
||||
public string Key { get; set; }
|
||||
private double? value;
|
||||
|
||||
public DoubleArgument(string key, double? value = null)
|
||||
{
|
||||
Key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public object? GetValue() => value;
|
||||
|
||||
public ArgumentType GetValueType() => ArgumentType.Double;
|
||||
|
||||
public bool HasValue() => value.HasValue;
|
||||
public bool required { get; set; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue