示例#1
0
        public bool AddValue(object objectValue, bool add, List<uint> addresses = null)
        {
            double? changeValueNullable = ParsingUtilities.ParseDoubleNullable(objectValue);
            if (!changeValueNullable.HasValue) return false;
            double changeValue = changeValueNullable.Value;

            List<object> currentValues = _watchVar.GetValues(addresses);
            List<double?> currentValuesDoubleNullable =
                currentValues.ConvertAll(
                    currentValue => ParsingUtilities.ParseDoubleNullable(currentValue));
            List<object> newValues = currentValuesDoubleNullable.ConvertAll(currentValueDoubleNullable =>
            {
                if (!currentValueDoubleNullable.HasValue) return null;
                double currentValueDouble = currentValueDoubleNullable.Value;
                object convertedValue = ConvertValue(currentValueDouble, false, false);
                // TODO tyler fix this for float logic
                double convertedValueDouble = ParsingUtilities.ParseDouble(convertedValue);
                double modifiedValue = convertedValueDouble + changeValue * (add ? +1 : -1);
                object unconvertedValue = UnconvertValue(modifiedValue);
                return unconvertedValue;
            });

            bool success = _watchVar.SetValues(newValues, addresses);
            if (success && GetLockedBool(addresses))
                WatchVariableLockManager.UpdateLockValues(_watchVar, newValues, addresses);
            return success;
        }
示例#2
0
 public bool SetValue(object value, List<uint> addresses = null)
 {
     value = UnconvertValue(value);
     bool success = _watchVar.SetValue(value, addresses);
     if (success && GetLockedBool(addresses))
         WatchVariableLockManager.UpdateLockValues(_watchVar, value, addresses);
     return success;
 }
示例#3
0
 public bool SetCheckStateValue(CheckState checkState, List<uint> addresses = null)
 {
     object value = ConvertCheckStateToValue(checkState);
     bool success = _watchVar.SetValue(value, addresses);
     if (success && GetLockedBool(addresses))
         WatchVariableLockManager.UpdateLockValues(_watchVar, value, addresses);
     return success;
 }
示例#4
0
        public bool SetStringValue(string value, List <uint> addresses = null)
        {
            value = HandleObjectUndisplaying(value);
            value = HandleHexUndisplaying(value);
            value = HandleUnnegating(value);
            value = HandleAngleUnconverting(value);

            bool success = _watchVar.SetValue(value, addresses);

            if (success && GetLockedBool(addresses))
            {
                WatchVariableLockManager.UpdateLockValues(_watchVar, value, addresses);
            }
            return(success);
        }