Esempio n. 1
0
        private static bool ShouldDisplayMember(MemberInfo member, bool hasDataContractAttribute)
        {
            JsonIgnoreAttribute          jsonIgnore         = member.GetCustomAttribute <JsonIgnoreAttribute>();
            XmlIgnoreAttribute           xmlIgnore          = member.GetCustomAttribute <XmlIgnoreAttribute>();
            IgnoreDataMemberAttribute    ignoreDataMember   = member.GetCustomAttribute <IgnoreDataMemberAttribute>();
            NonSerializedAttribute       nonSerialized      = member.GetCustomAttribute <NonSerializedAttribute>();
            ApiExplorerSettingsAttribute apiExplorerSetting = member.GetCustomAttribute <ApiExplorerSettingsAttribute>();

            bool hasMemberAttribute = member.DeclaringType.IsEnum ?
                                      member.GetCustomAttribute <EnumMemberAttribute>() != null :
                                      member.GetCustomAttribute <DataMemberAttribute>() != null;

            // Display member only if all the followings are true:
            // no JsonIgnoreAttribute
            // no XmlIgnoreAttribute
            // no IgnoreDataMemberAttribute
            // no NonSerializedAttribute
            // no ApiExplorerSettingsAttribute with IgnoreApi set to true
            // no DataContractAttribute without DataMemberAttribute or EnumMemberAttribute
            return(jsonIgnore == null &&
                   xmlIgnore == null &&
                   ignoreDataMember == null &&
                   nonSerialized == null &&
                   (apiExplorerSetting == null || !apiExplorerSetting.IgnoreApi) &&
                   (!hasDataContractAttribute || hasMemberAttribute));
        }
Esempio n. 2
0
        internal object[] GetPseudoCustomAttributes()
        {
            int count = 0;

            if (IsNotSerialized)
            {
                count++;
            }

            if (DeclaringType.IsExplicitLayout)
            {
                count++;
            }

            MarshalAsAttribute marshalAs = get_marshal_info();

            if (marshalAs != null)
            {
                count++;
            }

            if (count == 0)
            {
                return(null);
            }
            object[] attrs = new object [count];
            count = 0;

            if (IsNotSerialized)
            {
                attrs [count++] = new NonSerializedAttribute();
            }
            if (DeclaringType.IsExplicitLayout)
            {
                attrs [count++] = new FieldOffsetAttribute(GetFieldOffset());
            }
            if (marshalAs != null)
            {
                attrs [count++] = marshalAs;
            }

            return(attrs);
        }
        private static bool ShouldDisplayMember(MemberInfo member, bool hasDataContractAttribute)
        {
            JsonIgnoreAttribute          jsonIgnore         = member.GetCustomAttribute <JsonIgnoreAttribute>();
            XmlIgnoreAttribute           xmlIgnore          = member.GetCustomAttribute <XmlIgnoreAttribute>();
            IgnoreDataMemberAttribute    ignoreDataMember   = member.GetCustomAttribute <IgnoreDataMemberAttribute>();
            NonSerializedAttribute       nonSerialized      = member.GetCustomAttribute <NonSerializedAttribute>();
            ApiExplorerSettingsAttribute apiExplorerSetting = member.GetCustomAttribute <ApiExplorerSettingsAttribute>();

            bool hasMemberAttribute = member.DeclaringType.IsEnum ?
                                      member.GetCustomAttribute <EnumMemberAttribute>() != null :
                                      member.GetCustomAttribute <DataMemberAttribute>() != null;

            return(jsonIgnore == null &&
                   xmlIgnore == null &&
                   ignoreDataMember == null &&
                   nonSerialized == null &&
                   (apiExplorerSetting == null || !apiExplorerSetting.IgnoreApi) &&
                   (!hasDataContractAttribute || hasMemberAttribute));
        }
		internal object[] GetPseudoCustomAttributes ()
		{
			int count = 0;

			if (IsNotSerialized)
				count ++;

			if (DeclaringType.IsExplicitLayout)
				count ++;

			UnmanagedMarshal marshalAs = UMarshal;
			if (marshalAs != null)
				count ++;

			if (count == 0)
				return null;
			object[] attrs = new object [count];
			count = 0;

			if (IsNotSerialized)
				attrs [count ++] = new NonSerializedAttribute ();
			if (DeclaringType.IsExplicitLayout)
				attrs [count ++] = new FieldOffsetAttribute (GetFieldOffset ());
			if (marshalAs != null)
				attrs [count ++] = marshalAs.ToMarshalAsAttribute ();

			return attrs;
		}
Esempio n. 5
0
 public AreenaImage(string newId, bool availability)
 {
     id = newId; availability = true; img = new NonSerializedAttribute();
 }