Exemplo n.º 1
0
        /// <inheritdoc />
        public override void Set(object instance, IMoValue value)
        {
            var propType = _propertyInfo.PropertyType;

            if (propType == typeof(double))
            {
                _propertyInfo.SetValue(instance, value.AsDouble());
                return;
            }
            else if (propType == typeof(float))
            {
                _propertyInfo.SetValue(instance, value.AsFloat());
                return;
            }
            else if (propType == typeof(bool))
            {
                _propertyInfo.SetValue(instance, value.AsBool());
                return;
            }
            else if (propType == typeof(string))
            {
                _propertyInfo.SetValue(instance, value.AsString());
                return;
            }

            _propertyInfo.SetValue(instance, value);
            InvokeChanged();
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public override IMoValue Evaluate(MoScope scope, MoLangEnvironment environment)
        {
            IMoValue evalLeft = Left.Evaluate(scope, environment);

            //IMoValue value = environment.GetValue(new MoPath(evalLeft.AsString()));

            if (evalLeft == null || !evalLeft.AsBool())
            {
                return(Right.Evaluate(scope, environment));
            }
            else
            {
                return(evalLeft);
            }
        }