Esempio n. 1
0
        protected override void ValueToOSCValues(List <OSCValue> values, object value)
        {
            var members = GetMembers(value.GetType());

            foreach (var memberInfo in members)
            {
                var property = OSCReflectionProperty.Create(value, memberInfo);
                if (property != null)
                {
                    var propertyValue = property.GetValue();
                    if (propertyValue == null)
                    {
                        values.Add(OSCValue.Null());

                        continue;
                    }

                    OSCSerializer.Pack(values, propertyValue);
                }
                else
                {
                    throw new NullReferenceException("Property not found!");
                }
            }
        }
 private void UpdateCachedReferences()
 {
     if (reflectionMember != null && reflectionMember.IsValid())
     {
         _cachedProperty = reflectionMember.GetProperty();
     }
     else
     {
         _cachedProperty = null;
     }
 }
Esempio n. 3
0
        protected override object OSCValuesToValue(List <OSCValue> values, ref int start, Type type)
        {
            var members = GetMembers(type);
            var value   = Activator.CreateInstance(type);

            foreach (var memberInfo in members)
            {
                var oscValue = values[start];

                var property = OSCReflectionProperty.Create(value, memberInfo);
                if (property != null && !oscValue.IsNull)
                {
                    property.SetValue(OSCSerializer.Unpack(values, ref start, property.PropertyType));
                }
                else
                {
                    start++;
                }
            }

            return(value);
        }