Exemplo n.º 1
0
        public virtual void adopt(ISettingsInstance source)
        {
            if (this == source)
            {
                return;
            }
            id            = source.getId();
            baseObjectKey = source.getKey();
            label         = source.getLabel();
            fields.Clear();
            SettingsProperties settings        = SettingsStorage.getSettingsProperties(getId());
            MethodInfo         miGetNonGeneric = this.GetType().GetMethod("get", BindingFlags.Instance | BindingFlags.Public);
            MethodInfo         miSetNonGeneric = this.GetType().GetMethod("set", BindingFlags.Instance | BindingFlags.Public);

            foreach (SettingsFieldProperties props in settings.fields)
            {
                miSetNonGeneric.MakeGenericMethod(props.type).Invoke(this, new Object[] { props.id, miGetNonGeneric.MakeGenericMethod(props.type).Invoke(source, new Object[] { props.id }) });
            }
            active = source.getActive();
            dirty  = source.getDirty();
        }