Beispiel #1
0
 public static bool smethod_14(Type type_1, Type type_2, out Type type_3)
 {
     Class203.smethod_2(type_1, "type");
     Class203.smethod_2(type_2, "genericInterfaceDefinition");
     if (!type_2.smethod_3() || !type_2.smethod_5())
     {
         throw new ArgumentNullException("'{0}' is not a generic interface definition.".smethod_0(CultureInfo.InvariantCulture, type_2));
     }
     if (type_1.smethod_3() && type_1.smethod_4())
     {
         Type genericTypeDefinition = type_1.GetGenericTypeDefinition();
         if (type_2 == genericTypeDefinition)
         {
             type_3 = type_1;
             return(true);
         }
     }
     foreach (Type type2 in type_1.GetInterfaces())
     {
         if (type2.smethod_4())
         {
             Type type3 = type2.GetGenericTypeDefinition();
             if (type_2 == type3)
             {
                 type_3 = type2;
                 return(true);
             }
         }
     }
     type_3 = null;
     return(false);
 }
Beispiel #2
0
        public static object smethod_23(MemberInfo memberInfo_0, object object_0)
        {
            object obj2;

            Class203.smethod_2(memberInfo_0, "member");
            Class203.smethod_2(object_0, "target");
            MemberTypes types = memberInfo_0.smethod_1();

            if (types == MemberTypes.Field)
            {
                return(((FieldInfo)memberInfo_0).GetValue(object_0));
            }
            if (types != MemberTypes.Property)
            {
                throw new ArgumentException("MemberInfo '{0}' is not of type FieldInfo or PropertyInfo".smethod_1(CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, memberInfo_0.Name), "member");
            }
            try
            {
                obj2 = ((PropertyInfo)memberInfo_0).GetValue(object_0, null);
            }
            catch (TargetParameterCountException exception)
            {
                throw new ArgumentException("MemberInfo '{0}' has index parameters".smethod_0(CultureInfo.InvariantCulture, memberInfo_0.Name), exception);
            }
            return(obj2);
        }
Beispiel #3
0
        public static T[] smethod_31 <T>(object object_0, bool bool_0) where T : Attribute
        {
            Class203.smethod_2(object_0, "attributeProvider");
            object obj2 = object_0;

            if (obj2 is Type)
            {
                return((T[])((Type)obj2).GetCustomAttributes(typeof(T), bool_0));
            }
            if (obj2 is Assembly)
            {
                return((T[])Attribute.GetCustomAttributes((Assembly)obj2, typeof(T)));
            }
            if (obj2 is MemberInfo)
            {
                return((T[])Attribute.GetCustomAttributes((MemberInfo)obj2, typeof(T), bool_0));
            }
            if (obj2 is Module)
            {
                return((T[])Attribute.GetCustomAttributes((Module)obj2, typeof(T), bool_0));
            }
            if (obj2 is ParameterInfo)
            {
                return((T[])Attribute.GetCustomAttributes((ParameterInfo)obj2, typeof(T), bool_0));
            }
            return((T[])((ICustomAttributeProvider)object_0).GetCustomAttributes(typeof(T), bool_0));
        }
Beispiel #4
0
        public static void smethod_19(Type type_1, out Type type_2, out Type type_3)
        {
            Type type;

            Class203.smethod_2(type_1, "type");
            if (smethod_14(type_1, typeof(IDictionary <,>), out type))
            {
                if (type.smethod_5())
                {
                    throw new Exception("Type {0} is not a dictionary.".smethod_0(CultureInfo.InvariantCulture, type_1));
                }
                Type[] genericArguments = type.GetGenericArguments();
                type_2 = genericArguments[0];
                type_3 = genericArguments[1];
            }
            else
            {
                if (!typeof(IDictionary).IsAssignableFrom(type_1))
                {
                    throw new Exception("Type {0} is not a dictionary.".smethod_0(CultureInfo.InvariantCulture, type_1));
                }
                type_2 = null;
                type_3 = null;
            }
        }
Beispiel #5
0
        public static bool smethod_21(MemberInfo memberInfo_0)
        {
            Class203.smethod_2(memberInfo_0, "member");
            PropertyInfo info = memberInfo_0 as PropertyInfo;

            return((info != null) && smethod_22(info));
        }
Beispiel #6
0
        public static IEnumerable <FieldInfo> smethod_35(Type type_1, BindingFlags bindingFlags_0)
        {
            Class203.smethod_2(type_1, "targetType");
            List <MemberInfo> list = new List <MemberInfo>(type_1.GetFields(bindingFlags_0));

            smethod_36(list, type_1, bindingFlags_0);
            return(list.Cast <FieldInfo>());
        }
Beispiel #7
0
 public static bool smethod_9(Type type_1)
 {
     Class203.smethod_2(type_1, "t");
     if (type_1.smethod_12())
     {
         return(smethod_10(type_1));
     }
     return(true);
 }
Beispiel #8
0
 public static bool smethod_16(Type type_1, Type type_2, out Type type_3)
 {
     Class203.smethod_2(type_1, "type");
     Class203.smethod_2(type_2, "genericClassDefinition");
     if (!type_2.smethod_8() || !type_2.smethod_5())
     {
         throw new ArgumentNullException("'{0}' is not a generic class definition.".smethod_0(CultureInfo.InvariantCulture, type_2));
     }
     return(smethod_17(type_1, type_2, out type_3));
 }
Beispiel #9
0
 public Class183(IList list)
 {
     Class203.smethod_2(list, "list");
     if (list is ICollection <T> )
     {
         this.icollection_0 = (ICollection <T>)list;
     }
     else
     {
         this.ilist_0 = list;
     }
 }
Beispiel #10
0
        public static bool smethod_0(this PropertyInfo propertyInfo_0)
        {
            Class203.smethod_2(propertyInfo_0, "propertyInfo");
            MethodInfo getMethod = propertyInfo_0.GetGetMethod();

            if ((getMethod != null) && getMethod.IsVirtual)
            {
                return(true);
            }
            getMethod = propertyInfo_0.GetSetMethod();
            return((getMethod != null) && getMethod.IsVirtual);
        }
Beispiel #11
0
        public static MethodInfo smethod_1(this PropertyInfo propertyInfo_0)
        {
            Class203.smethod_2(propertyInfo_0, "propertyInfo");
            MethodInfo getMethod = propertyInfo_0.GetGetMethod();

            if (getMethod != null)
            {
                return(getMethod.GetBaseDefinition());
            }
            getMethod = propertyInfo_0.GetSetMethod();
            if (getMethod != null)
            {
                return(getMethod.GetBaseDefinition());
            }
            return(null);
        }
Beispiel #12
0
        public static Type smethod_20(MemberInfo memberInfo_0)
        {
            Class203.smethod_2(memberInfo_0, "member");
            switch (memberInfo_0.smethod_1())
            {
            case MemberTypes.Event:
                return(((EventInfo)memberInfo_0).EventHandlerType);

            case MemberTypes.Field:
                return(((FieldInfo)memberInfo_0).FieldType);

            case MemberTypes.Property:
                return(((PropertyInfo)memberInfo_0).PropertyType);
            }
            throw new ArgumentException("MemberInfo must be of type FieldInfo, PropertyInfo or EventInfo", "member");
        }
Beispiel #13
0
        public static IEnumerable <PropertyInfo> smethod_37(Type type_1, BindingFlags bindingFlags_0)
        {
            Class203.smethod_2(type_1, "targetType");
            List <PropertyInfo> list = new List <PropertyInfo>(type_1.GetProperties(bindingFlags_0));

            smethod_39(list, type_1, bindingFlags_0);
            for (int i = 0; i < list.Count; i++)
            {
                PropertyInfo info = list[i];
                if (info.DeclaringType != type_1)
                {
                    PropertyInfo info2 = (PropertyInfo)smethod_34(info.DeclaringType, info);
                    list[i] = info2;
                }
            }
            return(list);
        }
Beispiel #14
0
        public static void smethod_24(MemberInfo memberInfo_0, object object_0, object object_1)
        {
            Class203.smethod_2(memberInfo_0, "member");
            Class203.smethod_2(object_0, "target");
            MemberTypes types = memberInfo_0.smethod_1();

            if (types != MemberTypes.Field)
            {
                if (types != MemberTypes.Property)
                {
                    throw new ArgumentException("MemberInfo '{0}' must be of type FieldInfo or PropertyInfo".smethod_0(CultureInfo.InvariantCulture, memberInfo_0.Name), "member");
                }
                ((PropertyInfo)memberInfo_0).SetValue(object_0, object_1, null);
            }
            else
            {
                ((FieldInfo)memberInfo_0).SetValue(object_0, object_1);
            }
        }
Beispiel #15
0
        public static Type smethod_18(Type type_1)
        {
            Type type;

            Class203.smethod_2(type_1, "type");
            if (type_1.IsArray)
            {
                return(type_1.GetElementType());
            }
            if (smethod_14(type_1, typeof(IEnumerable <>), out type))
            {
                if (type.smethod_5())
                {
                    throw new Exception("Type {0} is not a collection.".smethod_0(CultureInfo.InvariantCulture, type_1));
                }
                return(type.GetGenericArguments()[0]);
            }
            if (!typeof(IEnumerable).IsAssignableFrom(type_1))
            {
                throw new Exception("Type {0} is not a collection.".smethod_0(CultureInfo.InvariantCulture, type_1));
            }
            return(null);
        }
Beispiel #16
0
        public static Class188 <T> smethod_2 <T>(Type type_0) where T : struct
        {
            if (type_0 == null)
            {
                throw new ArgumentNullException("enumType");
            }
            Class203.smethod_1(type_0, "enumType");
            IList <object> list   = smethod_3(type_0);
            IList <string> list2  = smethod_4(type_0);
            Class188 <T>   class2 = new Class188 <T>();

            for (int i = 0; i < list.Count; i++)
            {
                try
                {
                    class2.Add(new Class187 <T>(list2[i], (T)Convert.ChangeType(list[i], typeof(T), CultureInfo.CurrentCulture)));
                }
                catch (OverflowException exception)
                {
                    throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Value from enum with the underlying type of {0} cannot be added to dictionary with a value type of {1}. Value was too large: {2}", new object[] { Enum.GetUnderlyingType(type_0), typeof(T), Convert.ToUInt64(list[i], CultureInfo.InvariantCulture) }), exception);
                }
            }
            return(class2);
        }
Beispiel #17
0
 public static bool smethod_22(PropertyInfo propertyInfo_0)
 {
     Class203.smethod_2(propertyInfo_0, "property");
     return(propertyInfo_0.GetIndexParameters().Length > 0);
 }
Beispiel #18
0
 public static bool smethod_6(Type type_1, bool bool_0)
 {
     Class203.smethod_2(type_1, "t");
     return(type_1.smethod_12() || (smethod_8(type_1, bool_0) != null));
 }
Beispiel #19
0
 public static bool smethod_10(Type type_1)
 {
     Class203.smethod_2(type_1, "t");
     return(type_1.smethod_4() && (type_1.GetGenericTypeDefinition() == typeof(Nullable <>)));
 }
Beispiel #20
0
 public Class183(ICollection <T> list)
 {
     Class203.smethod_2(list, "list");
     this.icollection_0 = list;
 }
Beispiel #21
0
 public Class142(TextWriter writer)
 {
     Class203.smethod_2(writer, "writer");
     this.textWriter_0 = writer;
 }
Beispiel #22
0
 public Struct31(IEnumerator <KeyValuePair <V, W> > e)
 {
     Class203.smethod_2(e, "e");
     this.ienumerator_0 = e;
 }
Beispiel #23
0
 public static bool smethod_2(Type type_0)
 {
     Class203.smethod_2(type_0, "type");
     return(typeof(IDictionary).IsAssignableFrom(type_0) || Class194.smethod_13(type_0, typeof(IDictionary <,>)));
 }
Beispiel #24
0
 public static string smethod_3(this string string_2, IFormatProvider iformatProvider_0, params object[] object_0)
 {
     Class203.smethod_2(string_2, "format");
     return(string.Format(iformatProvider_0, string_2, object_0));
 }
Beispiel #25
0
 public Class185(IDictionary dictionary)
 {
     Class203.smethod_2(dictionary, "dictionary");
     this.idictionary_0 = dictionary;
 }