Ejemplo n.º 1
0
        public override void SetValue(object value)
        {
            var structValue = _structValueAccessor.GetValue();

            _fieldInfo.SetValue(structValue, value);
            _structValueAccessor.SetValue(structValue);
        }
Ejemplo n.º 2
0
        public override void SetValue(object value)
        {
            var dict = (IDictionary)_dictValueAccessor.GetValue();

            if (dict == null || !dict.Contains(key))
            {
                return;
            }
            dict[key] = value;
        }
Ejemplo n.º 3
0
        public override void SetValue(object value)
        {
            var array = (Array)_arrayValueAccessor.GetValue();

            if (array == null || array.GetLength(0) <= _elementIndex)
            {
                return;
            }
            array.SetValue(value, _elementIndex);
        }
Ejemplo n.º 4
0
        public override void SetValue(object value)
        {
            if (!_propertyInfo.CanWrite)
            {
                return;
            }
            var structValue = _structValueAccessor.GetValue();

            _propertyInfo.SetValue(structValue, value, DEFAULT_INDEX_ARRAY);
            _structValueAccessor.SetValue(structValue);
        }
Ejemplo n.º 5
0
        public override void SetValue(object value)
        {
            var list        = (IList)_listValueAccessor.GetValue();
            var listCounter = (ICollection)list;

            if (list == null || listCounter.Count <= _elementIndex)
            {
                return;
            }
            list[_elementIndex] = value;
        }
Ejemplo n.º 6
0
 public override bool CheckValue()
 {
     if (Members.Count == 0)
     {
         var obj   = _accessor.GetValue();
         var type  = obj.GetType();
         var flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
         foreach (var field in type.GetFields(flags))
         {
             if (field.Name.EndsWith("k__BackingField"))
             {
                 continue;
             }
             var m = Helper.CreateMember(field.Name, field.FieldType, new StructFieldValueAccessor(_accessor, field));
             Members.Add(m);
         }
         foreach (var property in type.GetProperties(flags))
         {
             if (!property.CanRead)
             {
                 continue;
             }
             if (property.GetIndexParameters().Length > 0)
             {
                 continue;
             }
             var m = Helper.CreateMember(Helper.GetPropertyName(property), property.PropertyType, new StructPropertyValueAccessor(_accessor, property));
             Members.Add(m);
         }
     }
     return(true);
 }
Ejemplo n.º 7
0
        public override bool CheckValue()
        {
            var newTarget = _accessor.GetValue();

            if (_target == null)
            {
                _target = newTarget;
                ScanMembers(_target, _target.GetType(), Members);
                return(true);
            }
            else
            {
                return(newTarget == _target);
            }
        }
Ejemplo n.º 8
0
        public override bool CheckValue()
        {
            if (_accessor != null)
            {
                var newTarget = _accessor.GetValue() as GameObject;
                if (gameObject == null)
                {
                    gameObject = newTarget;

                    ScanMembers();
                    return(true);
                }
                else
                {
                    return(newTarget == gameObject);
                }
            }
            return(true);
        }
Ejemplo n.º 9
0
        public object GetValue()
        {
            GetValueError = null;
            if (Accessor == null)
            {
                GetValueError = "Accessor is null.";
                return(null);
            }
            else
            {
                try
                {
                    return(Accessor.GetValue());
                }
                catch (System.Exception e)
                {
                    GetValueError = "Exception: " + e.Message;
                }

                return(null);
            }
        }