diff --git a/CHANGELIST.md b/CHANGELIST.md index 457bedf7..bae68c61 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -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) diff --git a/MPF.ExecutionContexts/Data/Input.cs b/MPF.ExecutionContexts/Data/Input.cs index 7b6c3af9..b7ea9972 100644 --- a/MPF.ExecutionContexts/Data/Input.cs +++ b/MPF.ExecutionContexts/Data/Input.cs @@ -14,6 +14,11 @@ namespace MPF.ExecutionContexts.Data /// public readonly string Name; + /// + /// Indicates if a value has been set + /// + public abstract bool ValueSet { get; } + /// /// Verbose name for the input /// @@ -66,6 +71,18 @@ namespace MPF.ExecutionContexts.Data #endregion + #region Processors + + /// + /// Process the current index, if possible + /// + /// Parts array to be referenced + /// Reference to the position in the parts + /// True if a value could be determined, false otherwise + public abstract bool Process(string[] parts, ref int index); + + #endregion + #region Helpers /// @@ -171,6 +188,9 @@ namespace MPF.ExecutionContexts.Data /// public T? Value { get; protected set; } + /// + public override bool ValueSet => Value != null; + #endregion #region Constructors @@ -192,17 +212,5 @@ namespace MPF.ExecutionContexts.Data : base(shortName, longName, required) { } #endregion - - #region Processors - - /// - /// Process the current index, if possible - /// - /// Parts array to be referenced - /// Reference to the position in the parts - /// True if a value could be determined, false otherwise - public abstract bool Process(string[] parts, ref int index); - - #endregion } } \ No newline at end of file diff --git a/MPF.ExecutionContexts/Data/UInt64Input.cs b/MPF.ExecutionContexts/Data/UInt64Input.cs index 7cfb8801..9d416aea 100644 --- a/MPF.ExecutionContexts/Data/UInt64Input.cs +++ b/MPF.ExecutionContexts/Data/UInt64Input.cs @@ -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; }