Beispiel #1
0
        private Soul _NewSoul(object soul, Type soul_type)
        {
            MemberMap map         = _Protocol.GetMemberMap();
            int       interfaceId = map.GetInterface(soul_type);
            Soul      newSoul     = new Soul(_IdLandlord.Rent(), interfaceId, soul_type, soul);



            // property
            PropertyInfo[] propertys = soul_type.GetProperties(BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public);

            for (int i = 0; i < propertys.Length; ++i)
            {
                PropertyInfo property = propertys[i];
                int          id       = map.GetProperty(property);

                if (property.PropertyType.GetInterfaces().Any(t => t == typeof(IDirtyable)))
                {
                    object     propertyValue = property.GetValue(soul);
                    IDirtyable dirtyable     = propertyValue as IDirtyable;

                    PropertyUpdater pu = new PropertyUpdater(dirtyable, id);
                    newSoul.AddPropertyUpdater(pu);
                }
            }

            _Souls.Add(newSoul);

            return(newSoul);
        }
Beispiel #2
0
            internal void PropertyUpdateReset(int property)
            {
                PropertyUpdater propertyUpdater = _PropertyUpdaters.FirstOrDefault(pu => pu.PropertyId == property);

                if (propertyUpdater != null)
                {
                    propertyUpdater.Reset();
                }
            }
Beispiel #3
0
 internal void AddPropertyUpdater(PropertyUpdater pu)
 {
     _PropertyUpdaters.Add(pu);
 }
Beispiel #4
0
 private Action <object> _UpdatePropertyChange(PropertyUpdater updater)
 {
     return((o) => _PropertyChangeds.Enqueue(updater));
 }