Beispiel #1
0
        public ITweakable RegisterTweakable <T>(TweakableInfo <T> info, FieldInfo fieldInfo, object instance = null)
        {
            ITweakable tweakable = TweakableFactory.MakeTweakableFromInfo(info, fieldInfo, instance);

            RegisterTweakable(tweakable);
            return(tweakable);
        }
        public static ITweakable MakeTweakableFromInfo <T>(TweakableInfo <T> info, out object virtualFieldRef)
        {
            VirtualField <T> virtualField = new VirtualField <T>();
            ITweakable       result       = new BaseTweakable <T>(info, virtualField);

            virtualFieldRef = virtualField;
            return(result);
        }
 private BaseTweakable(TweakableInfo <T> info, MethodInfo setter, MethodInfo getter, Assembly assembly, WeakReference instance, bool isPublic)
     : this(info, assembly, instance, isPublic)
 {
     Setter = setter;
     Getter = getter;
     ValidateTweakableType();
     CreateComponents();
 }
 public BaseTweakable(TweakableInfo <T> info, VirtualField <T> field)
     : this(info, Assembly.GetCallingAssembly(), new WeakReference(field), isPublic : false)
 {
     Setter = field.Setter.Method;
     Getter = field.Getter.Method;
     ValidateTweakableType();
     CreateComponents();
 }
 private BaseTweakable(TweakableInfo <T> info, VirtualProperty <T> property, Assembly assembly, bool isPublic)
     : this(info, assembly, new WeakReference(property), isPublic)
 {
     virtualProperty = property;
     Setter          = property.Setter.Method;
     Getter          = property.Getter.Method;
     ValidateTweakableType();
     CreateComponents();
 }
        public static ITweakable MakeTweakableFromInfo <T>(TweakableInfo <T> info, FieldInfo fieldInfo, object instance)
        {
            if (typeof(T) != fieldInfo.FieldType)
            {
                return(null);
            }
            WeakReference instance2 = ((instance != null) ? new WeakReference(instance) : null);

            return(new BaseTweakable <T>(info, fieldInfo, instance2));
        }
        public static ITweakable MakeTweakableFromInfo <T>(TweakableInfo <T> info, PropertyInfo propertyInfo, object instance)
        {
            if (typeof(T) != propertyInfo.PropertyType)
            {
                return(null);
            }
            WeakReference instance2 = ((instance != null) ? new WeakReference(instance) : null);

            return(new BaseTweakable <T>(info, propertyInfo, instance2));
        }
 public ToggleTweakable(BaseTweakable <T> baseTweakable)
 {
     this.baseTweakable = baseTweakable;
     tweakableInfo      = baseTweakable.TweakableInfo;
     currentIndex       = GetIndexOfValue(baseTweakable.GetValue());
 }
 public BaseTweakable(TweakableInfo <T> info, FieldInfo field, WeakReference instance)
     : this(info, new VirtualProperty <T>(field, instance), field.ReflectedType.Assembly, field.IsPublic)
 {
 }
 public BaseTweakable(TweakableInfo <T> info, MethodInfo setter, MethodInfo getter, WeakReference instance)
     : this(info, setter, getter, setter.ReflectedType.Assembly, instance, setter.IsPublic || getter.IsPublic)
 {
 }
 public BaseTweakable(TweakableInfo <T> info, PropertyInfo property, WeakReference instance)
     : this(info, property.GetSetMethod(nonPublic : true), property.GetGetMethod(nonPublic : true), property.ReflectedType.Assembly, instance, property.GetAccessors().Length > 0)
 {
 }
 private BaseTweakable(TweakableInfo <T> info, Assembly assembly, WeakReference instance, bool isPublic)
     : base(info, assembly, instance, isPublic)
 {
     TweakableInfo = info;
     TweakableType = typeof(T);
 }