public bool allowMember(MemberWrapper wrapper)
 {
     return(!(wrapper.getCustomAttributes(typeof(DoNotSaveAttribute), true).Any() ||
              wrapper.getWrappedType().GetCustomAttributes(typeof(DoNotSaveAttribute), true).Any() ||
              wrapper.getWrappedType().GetCustomAttributes(typeof(NativeSubsystemTypeAttribute), true).Any() ||
              !wrapper.getWrappedType().IsSubclassOf(typeof(Delegate))));
 }
 /// <summary>
 /// This is the test function. It will return true if the member should
 /// be accepted.
 /// </summary>
 /// <param name="wrapper">The MemberWrapper with info about the field/property being scanned.</param>
 /// <returns>True if the member should be included in the results. False to omit it.</returns>
 public bool allowMember(MemberWrapper wrapper)
 {
     if (wrapper.getCustomAttributes(typeof(EditableAttribute), true).Any())
     {
         Type wrappedType = wrapper.getWrappedType();
         return(ReflectedVariable.canCreateVariable(wrappedType) || wrappedType.GetInterface(BEHAVIOR_OBJECT_INTERFACE) != null);
     }
     return(false);
 }
示例#3
0
        /// <summary>
        /// Filter out all members that are marked with DoNotCopy or that cannot
        /// be read from and written to.
        /// </summary>
        /// <param name="wrapper"></param>
        /// <returns></returns>
        public bool allowMember(MemberWrapper wrapper)
        {
            Type wrappedType = wrapper.getWrappedType();

            bool reject = wrapper.getCustomAttributes(typeof(DoNotCopyAttribute), true).Any() ||
                          wrappedType.GetCustomAttributes(typeof(DoNotCopyAttribute), true).Any() ||
                          wrappedType.GetCustomAttributes(typeof(NativeSubsystemTypeAttribute), true).Any() ||
                          wrappedType.IsSubclassOf(typeof(Delegate));

            return(!reject && wrapper.canWrite() && wrapper.canRead());
        }
示例#4
0
        /// <summary>
        /// Returns the ReflectedVariable for the given type.
        /// </summary>
        /// <param name="memberInfo">The MemberWrapper to use in the ReflectedVariable.</param>
        /// <param name="instance">The instance to use in the ReflectedVariable.</param>
        /// <returns>The matching ReflectedVariable or null if no mapping exists.</returns>
        public static ReflectedVariable createVariable(MemberWrapper memberInfo, Object instance)
        {
            Type inType = memberInfo.getWrappedType();

            if (typeMapping.ContainsKey(inType))
            {
                return(typeMapping[inType](memberInfo, instance));
            }
            else if (inType.IsEnum())
            {
                return(new EnumReflectedVariable(memberInfo, instance));
            }
            else
            {
                return(null);
            }
        }
示例#5
0
 /// <summary>
 /// Determine if the given object is a valid value.
 /// </summary>
 /// <param name="value">The value to test.</param>
 /// <returns>True if value can be set as the value of this variable.</returns>
 public virtual bool canSetValue(Object value)
 {
     return(value.GetType() == propertyInfo.getWrappedType());
 }