using System; namespace Aitex.Core.RT.IOCore; public class InterlockLimitRangeInt: IAnalogInterlockLimitRange { #region Constructors public InterlockLimitRangeInt(string value) { var strValues = value.Split(':'); if (strValues.Length == 2 && int.TryParse(strValues[0], out var min) && int.TryParse(strValues[1], out var max)) { Min = min; Max = max; } else throw new InvalidCastException($"unable to convert {value} to double range."); } public InterlockLimitRangeInt(short min, short max) { Min = min; Max = max; } #endregion #region Properties public int Min { get; } public int Max { get; } #endregion public virtual bool CheckIsInRange(int currentValue) { return currentValue >= Min && currentValue <= Max; } }