mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Add flag for value being set
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
- Add BaseExecutionContext tests
|
||||
- Add currently unused Input type
|
||||
- Split Input type into typed classes
|
||||
- Add flag for value being set
|
||||
|
||||
### 3.2.4 (2024-11-24)
|
||||
|
||||
|
||||
@@ -14,6 +14,11 @@ namespace MPF.ExecutionContexts.Data
|
||||
/// </summary>
|
||||
public readonly string Name;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if a value has been set
|
||||
/// </summary>
|
||||
public abstract bool ValueSet { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Verbose name for the input
|
||||
/// </summary>
|
||||
@@ -66,6 +71,18 @@ namespace MPF.ExecutionContexts.Data
|
||||
|
||||
#endregion
|
||||
|
||||
#region Processors
|
||||
|
||||
/// <summary>
|
||||
/// Process the current index, if possible
|
||||
/// </summary>
|
||||
/// <param name="parts">Parts array to be referenced</param>
|
||||
/// <param name="index">Reference to the position in the parts</param>
|
||||
/// <returns>True if a value could be determined, false otherwise</returns>
|
||||
public abstract bool Process(string[] parts, ref int index);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helpers
|
||||
|
||||
/// <summary>
|
||||
@@ -171,6 +188,9 @@ namespace MPF.ExecutionContexts.Data
|
||||
/// </summary>
|
||||
public T? Value { get; protected set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool ValueSet => Value != null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@@ -192,17 +212,5 @@ namespace MPF.ExecutionContexts.Data
|
||||
: base(shortName, longName, required) { }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Processors
|
||||
|
||||
/// <summary>
|
||||
/// Process the current index, if possible
|
||||
/// </summary>
|
||||
/// <param name="parts">Parts array to be referenced</param>
|
||||
/// <param name="index">Reference to the position in the parts</param>
|
||||
/// <returns>True if a value could be determined, false otherwise</returns>
|
||||
public abstract bool Process(string[] parts, ref int index);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (ulong.TryParse(baseVal, out value))
|
||||
{
|
||||
index++;
|
||||
Value = (ulong)(value * factor);
|
||||
Value = (ulong)(value * (ulong)factor);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (ulong.TryParse(hexValue, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out value))
|
||||
{
|
||||
index++;
|
||||
Value = (ulong)(value * factor);
|
||||
Value = (ulong)(value * (ulong)factor);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user