コード例 #1
0
        // Token: 0x060015AF RID: 5551 RVA: 0x0006739C File Offset: 0x0006559C
        private static T GetAttribute <T>(Type type) where T : Attribute
        {
            Type associatedMetadataType = Class_470.GetAssociatedMetadataType(type);
            T    attribute;

            if (associatedMetadataType != null)
            {
                attribute = Class_514.GetAttribute <T>(associatedMetadataType, true);
                if (attribute != null)
                {
                    return(attribute);
                }
            }
            attribute = Class_514.GetAttribute <T>(type, true);
            if (attribute != null)
            {
                return(attribute);
            }
            foreach (Type attributeProvider in type.GetInterfaces())
            {
                attribute = Class_514.GetAttribute <T>(attributeProvider, true);
                if (attribute != null)
                {
                    return(attribute);
                }
            }
            return(default(T));
        }
コード例 #2
0
 // Token: 0x06001404 RID: 5124 RVA: 0x0005E944 File Offset: 0x0005CB44
 internal Class_500 vmethod_3625(object obje_0)
 {
     if (this.field_2 == null)
     {
         this.field_1 = typeof(Class_501 <>).MakeGenericType(new Type[]
         {
             this.prop_0
         });
         Type type;
         if (Class_514.InheritsGenericDefinition(this.field_0, typeof(List <>)) || this.field_0.GetGenericTypeDefinition() == typeof(IEnumerable <>))
         {
             type = typeof(ICollection <>).MakeGenericType(new Type[]
             {
                 this.prop_0
             });
         }
         else
         {
             type = this.field_0;
         }
         ConstructorInfo constructor = this.field_1.GetConstructor(new Type[]
         {
             type
         });
         this.field_2 = Class_470.ReflectionDelegateFactory.pmethod_4009(constructor);
     }
     return((Class_500)this.field_2(new object[]
     {
         obje_0
     }));
 }
コード例 #3
0
        // Token: 0x06000C31 RID: 3121 RVA: 0x00043F1C File Offset: 0x0004211C
        public virtual object lmethod_2198(Class_285 arg_0, Type arg_1, object obje_0, Class_418 arg_2)
        {
            bool flag = Class_514.IsNullableType(arg_1);
            Type type = flag ? Nullable.GetUnderlyingType(arg_1) : arg_1;

            if (arg_0.prop_9 != Class_508.Null)
            {
                try
                {
                    if (arg_0.prop_9 == Class_508.String)
                    {
                        string enumText = arg_0.prop_10.ToString();
                        return(Class_505.ParseEnumName(enumText, flag, type));
                    }
                    if (arg_0.prop_9 == Class_508.Integer)
                    {
                        if (!this.prop_1)
                        {
                            throw Class_417.xmethod_3101(arg_0, "Integer value {0} is not allowed.".FormatWith(CultureInfo.InvariantCulture, arg_0.prop_10));
                        }
                        return(Class_499.ConvertOrCast(arg_0.prop_10, CultureInfo.InvariantCulture, type));
                    }
                }
                catch (Exception arg_3)
                {
                    throw Class_417.tmethod_3102(arg_0, "Error converting value {0} to type '{1}'.".FormatWith(CultureInfo.InvariantCulture, Class_513.FormatValueForPrint(arg_0.prop_10), arg_1), arg_3);
                }
                throw Class_417.xmethod_3101(arg_0, "Unexpected token {0} when parsing enum.".FormatWith(CultureInfo.InvariantCulture, arg_0.prop_9));
            }
            if (!Class_514.IsNullableType(arg_1))
            {
                throw Class_417.xmethod_3101(arg_0, "Cannot convert null value to {0}.".FormatWith(CultureInfo.InvariantCulture, arg_1));
            }
            return(null);
        }
コード例 #4
0
        // Token: 0x060011A5 RID: 4517 RVA: 0x00057214 File Offset: 0x00055414
        internal static U Convert <T, U>(this T token) where T : Class_361
        {
            if (token == null)
            {
                return(default(U));
            }
            if (token is U && typeof(U) != typeof(IComparable) && typeof(U) != typeof(IFormattable))
            {
                return((U)((object)token));
            }
            Class_362 class_ = token as Class_362;

            if (class_ == null)
            {
                throw new InvalidCastException("Cannot cast {0} to {1}.".FormatWith(CultureInfo.InvariantCulture, token.GetType(), typeof(T)));
            }
            if (class_.prop_2 is U)
            {
                return((U)((object)class_.prop_2));
            }
            Type type = typeof(U);

            if (Class_514.IsNullableType(type))
            {
                if (class_.prop_2 == null)
                {
                    return(default(U));
                }
                type = Nullable.GetUnderlyingType(type);
            }
            return((U)((object)System.Convert.ChangeType(class_.prop_2, type, CultureInfo.InvariantCulture)));
        }
コード例 #5
0
        // Token: 0x060014E3 RID: 5347 RVA: 0x0006101C File Offset: 0x0005F21C
        private Class_463 cmethod_3824(Type arg_0, Class_364 arg_1)
        {
            Class_463 class_ = Class_463.None;

            if (arg_1 != Class_364.Always && Class_514.IsNullable(arg_0))
            {
                class_ = Class_463.Null;
                if (Class_514.IsNullableType(arg_0))
                {
                    arg_0 = Nullable.GetUnderlyingType(arg_0);
                }
            }
            Class_496 typeCode = Class_499.GetTypeCode(arg_0);

            switch (typeCode)
            {
            case Class_496.Empty:
            case Class_496.Object:
                return(class_ | Class_463.String);

            case Class_496.Char:
                return(class_ | Class_463.String);

            case Class_496.Boolean:
                return(class_ | Class_463.Boolean);

            case Class_496.SByte:
            case Class_496.Int16:
            case Class_496.UInt16:
            case Class_496.Int32:
            case Class_496.Byte:
            case Class_496.UInt32:
            case Class_496.Int64:
            case Class_496.UInt64:
            case Class_496.BigInteger:
                return(class_ | Class_463.Integer);

            case Class_496.Single:
            case Class_496.Double:
            case Class_496.Decimal:
                return(class_ | Class_463.Float);

            case Class_496.DateTime:
            case Class_496.DateTimeOffset:
                return(class_ | Class_463.String);

            case Class_496.Guid:
            case Class_496.TimeSpan:
            case Class_496.Uri:
            case Class_496.String:
            case Class_496.Bytes:
                return(class_ | Class_463.String);

            case Class_496.DBNull:
                return(class_ | Class_463.Null);
            }
            throw new Class_318("Unexpected type code '{0}' for type '{1}'.".FormatWith(CultureInfo.InvariantCulture, typeCode, arg_0));
        }
コード例 #6
0
        // Token: 0x06001555 RID: 5461 RVA: 0x00065E04 File Offset: 0x00064004
        private void xmethod_3921(Class_296 arg_0, Type arg_1)
        {
            string typeName = Class_514.GetTypeName(arg_1, this.field_3.field_1, this.field_3.field_13);

            if (this.field_4 != null && this.field_4.prop_0 >= TraceLevel.Verbose)
            {
                this.field_4.gmethod_2303(TraceLevel.Verbose, Class_326.FormatMessage(null, arg_0.prop_4, "Writing type name '{0}' for {1}.".FormatWith(CultureInfo.InvariantCulture, typeName, arg_1)), null);
            }
            arg_0.cmethod_2014("$type", false);
            arg_0.kmethod_2037(typeName);
        }
コード例 #7
0
        // Token: 0x06000F7F RID: 3967 RVA: 0x0004FCF4 File Offset: 0x0004DEF4
        public virtual object kmethod_2807(Class_285 arg_0, Type arg_1, object obje_0, Class_418 arg_2)
        {
            bool flag = Class_514.IsNullableType(arg_1);
            Type left = flag ? Nullable.GetUnderlyingType(arg_1) : arg_1;

            if (arg_0.prop_9 == Class_508.Null)
            {
                if (!Class_514.IsNullableType(arg_1))
                {
                    throw Class_417.xmethod_3101(arg_0, "Cannot convert null value to {0}.".FormatWith(CultureInfo.InvariantCulture, arg_1));
                }
                return(null);
            }
            else if (arg_0.prop_9 == Class_508.Date)
            {
                if (!(left == typeof(DateTimeOffset)))
                {
                    return(arg_0.prop_10);
                }
                if (!(arg_0.prop_10 is DateTimeOffset))
                {
                    return(new DateTimeOffset((DateTime)arg_0.prop_10));
                }
                return(arg_0.prop_10);
            }
            else
            {
                if (arg_0.prop_9 != Class_508.String)
                {
                    throw Class_417.xmethod_3101(arg_0, "Unexpected token parsing date. Expected String, got {0}.".FormatWith(CultureInfo.InvariantCulture, arg_0.prop_9));
                }
                string text = arg_0.prop_10.ToString();
                if (string.IsNullOrEmpty(text) && flag)
                {
                    return(null);
                }
                if (left == typeof(DateTimeOffset))
                {
                    if (!string.IsNullOrEmpty(this.field_2))
                    {
                        return(DateTimeOffset.ParseExact(text, this.field_2, this.prop_2, this.field_1));
                    }
                    return(DateTimeOffset.Parse(text, this.prop_2, this.field_1));
                }
                else
                {
                    if (!string.IsNullOrEmpty(this.field_2))
                    {
                        return(DateTime.ParseExact(text, this.field_2, this.prop_2, this.field_1));
                    }
                    return(DateTime.Parse(text, this.prop_2, this.field_1));
                }
            }
        }
コード例 #8
0
 // Token: 0x060015BC RID: 5564 RVA: 0x000677C4 File Offset: 0x000659C4
 public void lmethod_3998(object obje_0, object obje_1)
 {
     try
     {
         Class_514.SetMemberValue(this.field_0, obje_0, obje_1);
     }
     catch (Exception arg_)
     {
         throw new Class_417("Error setting value to '{0}' on '{1}'.".FormatWith(CultureInfo.InvariantCulture, this.field_0.Name, obje_0.GetType()), arg_);
     }
 }
コード例 #9
0
 // Token: 0x06001443 RID: 5187 RVA: 0x0005EF38 File Offset: 0x0005D138
 internal object xmethod_3671()
 {
     if (this.field_6 == null)
     {
         return(null);
     }
     if (!this.field_1 && !this.field_3)
     {
         this.field_2 = Class_514.GetDefaultValue(this.prop_7);
         this.field_3 = true;
     }
     return(this.field_2);
 }
コード例 #10
0
        // Token: 0x060015BD RID: 5565 RVA: 0x0006781C File Offset: 0x00065A1C
        public object pmethod_3999(object obje_0)
        {
            object memberValue;

            try
            {
                memberValue = Class_514.GetMemberValue(this.field_0, obje_0);
            }
            catch (Exception arg_)
            {
                throw new Class_417("Error getting value from '{0}' on '{1}'.".FormatWith(CultureInfo.InvariantCulture, this.field_0.Name, obje_0.GetType()), arg_);
            }
            return(memberValue);
        }
コード例 #11
0
        // Token: 0x060014DB RID: 5339 RVA: 0x00060810 File Offset: 0x0005EA10
        private string dmethod_3816(Type arg_0)
        {
            Class_316 cachedAttribute = Class_470.GetCachedAttribute <Class_316>(arg_0);

            if (cachedAttribute != null && !string.IsNullOrEmpty(cachedAttribute.prop_2))
            {
                return(cachedAttribute.prop_2);
            }
            DescriptionAttribute attribute = Class_514.GetAttribute <DescriptionAttribute>(arg_0);

            if (attribute != null)
            {
                return(attribute.Description);
            }
            return(null);
        }
コード例 #12
0
        // Token: 0x060015B1 RID: 5553 RVA: 0x00067510 File Offset: 0x00065710
        public static T GetAttribute <T>(object provider) where T : Attribute
        {
            Type type = provider as Type;

            if (type != null)
            {
                return(Class_470.GetAttribute <T>(type));
            }
            MemberInfo memberInfo = provider as MemberInfo;

            if (memberInfo != null)
            {
                return(Class_470.GetAttribute <T>(memberInfo));
            }
            return(Class_514.GetAttribute <T>(provider, true));
        }
コード例 #13
0
            // Token: 0x06000E99 RID: 3737 RVA: 0x0004D1D8 File Offset: 0x0004B3D8
            public virtual bool nmethod_0(Class_362 arg_0, ConvertBinder arg_1, out object arg_2)
            {
                if (arg_1.Type == typeof(Class_362))
                {
                    arg_2 = arg_0;
                    return(true);
                }
                object obj = arg_0.prop_2;

                if (obj == null)
                {
                    arg_2 = null;
                    return(Class_514.IsNullable(arg_1.Type));
                }
                arg_2 = Class_499.Convert(obj, CultureInfo.InvariantCulture, arg_1.Type);
                return(true);
            }
コード例 #14
0
        // Token: 0x06001422 RID: 5154 RVA: 0x0005EB54 File Offset: 0x0005CD54
        public Class_453(Type arg_0) : base(arg_0)
        {
            this.field_5 = Class_448.Dictionary;
            Type type;
            Type type2;

            if (Class_514.ImplementsGenericDefinition(arg_0, typeof(IDictionary <, >), out this.field_0))
            {
                type  = this.field_0.GetGenericArguments()[0];
                type2 = this.field_0.GetGenericArguments()[1];
                if (Class_514.IsGenericDefinition(base.prop_0, typeof(IDictionary <, >)))
                {
                    base.prop_1 = typeof(Dictionary <, >).MakeGenericType(new Type[]
                    {
                        type,
                        type2
                    });
                }
            }
            else
            {
                Class_514.GetDictionaryKeyValueTypes(base.prop_0, out type, out type2);
                if (base.prop_0 == typeof(IDictionary))
                {
                    base.prop_1 = typeof(Dictionary <object, object>);
                }
            }
            if (type != null && type2 != null)
            {
                this.field_4 = Class_510.ResolveEnumerableCollectionConstructor(base.prop_1, typeof(KeyValuePair <, >).MakeGenericType(new Type[]
                {
                    type,
                    type2
                }));
                if (!this.prop_6 && arg_0.Name == "FSharpMap`2")
                {
                    Class_484.EnsureInitialized(arg_0.Assembly);
                    this.field_5 = Class_484.CreateMap(type, type2);
                }
            }
            this.prop_4 = !typeof(IDictionary).IsAssignableFrom(base.prop_1);
            this.prop_1 = type;
            this.prop_2 = type2;
        }
コード例 #15
0
        // Token: 0x06000BEB RID: 3051 RVA: 0x000426A0 File Offset: 0x000408A0
        public virtual object xmethod_2141(Class_285 arg_0, Type arg_1, object obje_0, Class_418 arg_2)
        {
            Type type = Class_514.IsNullableType(arg_1) ? Nullable.GetUnderlyingType(arg_1) : arg_1;

            if (arg_0.prop_9 == Class_508.Null)
            {
                if (!Class_514.IsNullable(arg_1))
                {
                    throw Class_417.xmethod_3101(arg_0, "Cannot convert null value to {0}.".FormatWith(CultureInfo.InvariantCulture, arg_1));
                }
                return(null);
            }
            else
            {
                byte[] array;
                if (arg_0.prop_9 == Class_508.StartArray)
                {
                    array = this.tmethod_2142(arg_0);
                }
                else
                {
                    if (arg_0.prop_9 != Class_508.String)
                    {
                        throw Class_417.xmethod_3101(arg_0, "Unexpected token parsing binary. Expected String or StartArray, got {0}.".FormatWith(CultureInfo.InvariantCulture, arg_0.prop_9));
                    }
                    string s = arg_0.prop_10.ToString();
                    array = Convert.FromBase64String(s);
                }
                if (type.AssignableToTypeName("System.Data.Linq.Binary"))
                {
                    this.smethod_2140(type);
                    return(this.field_2.prop_0(new object[]
                    {
                        array
                    }));
                }
                if (type == typeof(SqlBinary))
                {
                    return(new SqlBinary(array));
                }
                throw Class_417.xmethod_3101(arg_0, "Unexpected object type when writing binary: {0}".FormatWith(CultureInfo.InvariantCulture, arg_1));
            }
        }
コード例 #16
0
        // Token: 0x06000C19 RID: 3097 RVA: 0x000438D0 File Offset: 0x00041AD0
        public virtual object pmethod_2179(Class_285 arg_0, Type arg_1, object obje_0, Class_418 arg_2)
        {
            bool      flag   = Class_514.IsNullableType(arg_1);
            Type      type   = flag ? Nullable.GetUnderlyingType(arg_1) : arg_1;
            Class_491 class_ = Class_308.field_2.Get(type);

            if (arg_0.prop_9 != Class_508.Null)
            {
                object obj  = null;
                object obj2 = null;
                Class_308.xmethod_2181(arg_0);
                while (arg_0.prop_9 == Class_508.PropertyName)
                {
                    string a = arg_0.prop_10.ToString();
                    if (string.Equals(a, "Key", StringComparison.OrdinalIgnoreCase))
                    {
                        Class_308.xmethod_2181(arg_0);
                        obj = arg_2.smethod_3170(arg_0, class_.cmethod_4064("Key"));
                    }
                    else if (string.Equals(a, "Value", StringComparison.OrdinalIgnoreCase))
                    {
                        Class_308.xmethod_2181(arg_0);
                        obj2 = arg_2.smethod_3170(arg_0, class_.cmethod_4064("Value"));
                    }
                    else
                    {
                        arg_0.smethod_1900();
                    }
                    Class_308.xmethod_2181(arg_0);
                }
                return(class_.prop_0(new object[]
                {
                    obj,
                    obj2
                }));
            }
            if (!flag)
            {
                throw Class_417.xmethod_3101(arg_0, "Cannot convert null value to KeyValuePair.");
            }
            return(null);
        }
コード例 #17
0
 // Token: 0x060015AE RID: 5550 RVA: 0x000672FC File Offset: 0x000654FC
 private static Type GetAssociateMetadataTypeFromAttribute(Type type)
 {
     Attribute[] attributes = Class_514.GetAttributes(type, null, true);
     foreach (Attribute attribute in attributes)
     {
         Type type2 = attribute.GetType();
         if (string.Equals(type2.FullName, "System.ComponentModel.DataAnnotations.MetadataTypeAttribute", StringComparison.Ordinal))
         {
             if (Class_470._metadataTypeAttributeReflectionObject == null)
             {
                 Class_470._metadataTypeAttributeReflectionObject = Class_491.vmethod_4065(type2, new string[]
                 {
                     "MetadataClassType"
                 });
             }
             return((Type)Class_470._metadataTypeAttributeReflectionObject.tmethod_4062(attribute, "MetadataClassType"));
         }
     }
     return(null);
 }
コード例 #18
0
 // Token: 0x06000D28 RID: 3368 RVA: 0x00047C64 File Offset: 0x00045E64
 internal Class_349(Type arg_0)
 {
     Class_517.ArgumentNotNull(arg_0, "underlyingType");
     this.prop_0  = arg_0;
     this.field_0 = Class_514.IsNullable(arg_0);
     this.field_3 = ((this.field_0 && Class_514.IsNullableType(arg_0)) ? Nullable.GetUnderlyingType(arg_0) : arg_0);
     this.prop_1  = this.field_3;
     this.field_1 = Class_499.IsConvertible(this.field_3);
     this.field_2 = this.field_3.IsEnum;
     if (this.field_3 == typeof(byte[]))
     {
         this.field_4 = Class_408.ReadAsBytes;
         return;
     }
     if (this.field_3 == typeof(int))
     {
         this.field_4 = Class_408.ReadAsInt32;
         return;
     }
     if (this.field_3 == typeof(decimal))
     {
         this.field_4 = Class_408.ReadAsDecimal;
         return;
     }
     if (this.field_3 == typeof(string))
     {
         this.field_4 = Class_408.ReadAsString;
         return;
     }
     if (this.field_3 == typeof(DateTime))
     {
         this.field_4 = Class_408.ReadAsDateTime;
         return;
     }
     if (this.field_3 == typeof(DateTimeOffset))
     {
         this.field_4 = Class_408.ReadAsDateTimeOffset;
         return;
     }
     this.field_4 = Class_408.Read;
 }
コード例 #19
0
        // Token: 0x060015B0 RID: 5552 RVA: 0x00067430 File Offset: 0x00065630
        private static T GetAttribute <T>(MemberInfo memberInfo) where T : Attribute
        {
            Type associatedMetadataType = Class_470.GetAssociatedMetadataType(memberInfo.DeclaringType);
            T    attribute;

            if (associatedMetadataType != null)
            {
                MemberInfo memberInfoFromType = Class_514.GetMemberInfoFromType(associatedMetadataType, memberInfo);
                if (memberInfoFromType != null)
                {
                    attribute = Class_514.GetAttribute <T>(memberInfoFromType, true);
                    if (attribute != null)
                    {
                        return(attribute);
                    }
                }
            }
            attribute = Class_514.GetAttribute <T>(memberInfo, true);
            if (attribute != null)
            {
                return(attribute);
            }
            if (memberInfo.DeclaringType != null)
            {
                foreach (Type targetType in memberInfo.DeclaringType.GetInterfaces())
                {
                    MemberInfo memberInfoFromType2 = Class_514.GetMemberInfoFromType(targetType, memberInfo);
                    if (memberInfoFromType2 != null)
                    {
                        attribute = Class_514.GetAttribute <T>(memberInfoFromType2, true);
                        if (attribute != null)
                        {
                            return(attribute);
                        }
                    }
                }
            }
            return(default(T));
        }
コード例 #20
0
        // Token: 0x06000F82 RID: 3970 RVA: 0x0004FF28 File Offset: 0x0004E128
        public virtual object pmethod_2809(Class_285 arg_0, Type arg_1, object obje_0, Class_418 arg_2)
        {
            Type left = Class_514.IsNullableType(arg_1) ? Nullable.GetUnderlyingType(arg_1) : arg_1;

            if (arg_0.prop_9 == Class_508.Null)
            {
                if (!Class_514.IsNullable(arg_1))
                {
                    throw Class_417.xmethod_3101(arg_0, "Cannot convert null value to {0}.".FormatWith(CultureInfo.InvariantCulture, arg_1));
                }
                return(null);
            }
            else
            {
                if (arg_0.prop_9 != Class_508.StartConstructor || !string.Equals(arg_0.prop_10.ToString(), "Date", StringComparison.Ordinal))
                {
                    throw Class_417.xmethod_3101(arg_0, "Unexpected token or value when parsing date. Token: {0}, Value: {1}".FormatWith(CultureInfo.InvariantCulture, arg_0.prop_9, arg_0.prop_10));
                }
                arg_0.vmethod_1885();
                if (arg_0.prop_9 != Class_508.Integer)
                {
                    throw Class_417.xmethod_3101(arg_0, "Unexpected token parsing date. Expected Integer, got {0}.".FormatWith(CultureInfo.InvariantCulture, arg_0.prop_9));
                }
                long     javaScriptTicks = (long)arg_0.prop_10;
                DateTime dateTime        = Class_502.ConvertJavaScriptTicksToDateTime(javaScriptTicks);
                arg_0.vmethod_1885();
                if (arg_0.prop_9 != Class_508.EndConstructor)
                {
                    throw Class_417.xmethod_3101(arg_0, "Unexpected token parsing date. Expected EndConstructor, got {0}.".FormatWith(CultureInfo.InvariantCulture, arg_0.prop_9));
                }
                if (left == typeof(DateTimeOffset))
                {
                    return(new DateTimeOffset(dateTime));
                }
                return(dateTime);
            }
        }
コード例 #21
0
        // Token: 0x060015AB RID: 5547 RVA: 0x00067294 File Offset: 0x00065494
        private static Func <object[], Class_299> GetJsonConverterCreator(Type converterType)
        {
            Func <object> defaultConstructor = Class_514.HasDefaultConstructor(converterType, false) ? Class_470.ReflectionDelegateFactory.smethod_4010 <object>(converterType) : null;

            return(delegate(object[] parameters)
            {
                Class_299 result;
                try
                {
                    if (parameters != null)
                    {
                        Type[] types = (from param in parameters
                                        select param.GetType()).ToArray <Type>();
                        ConstructorInfo constructor = converterType.GetConstructor(types);
                        if (!(null != constructor))
                        {
                            throw new Class_318("No matching parameterized constructor found for '{0}'.".FormatWith(CultureInfo.InvariantCulture, converterType));
                        }
                        Class_482 <object> class_ = Class_470.ReflectionDelegateFactory.pmethod_4009(constructor);
                        result = (Class_299)class_(parameters);
                    }
                    else
                    {
                        if (defaultConstructor == null)
                        {
                            throw new Class_318("No parameterless constructor defined for '{0}'.".FormatWith(CultureInfo.InvariantCulture, converterType));
                        }
                        result = (Class_299)defaultConstructor();
                    }
                }
                catch (Exception arg_)
                {
                    throw new Class_318("Error creating '{0}'.".FormatWith(CultureInfo.InvariantCulture, converterType), arg_);
                }
                return result;
            });
        }
コード例 #22
0
        // Token: 0x060015A7 RID: 5543 RVA: 0x0006715C File Offset: 0x0006535C
        public static DataMemberAttribute GetDataMemberAttribute(MemberInfo memberInfo)
        {
            if (memberInfo.MemberType == MemberTypes.Field)
            {
                return(Class_471 <DataMemberAttribute> .GetAttribute(memberInfo));
            }
            PropertyInfo        propertyInfo = (PropertyInfo)memberInfo;
            DataMemberAttribute attribute    = Class_471 <DataMemberAttribute> .GetAttribute(propertyInfo);

            if (attribute == null && propertyInfo.IsVirtual())
            {
                Type type = propertyInfo.DeclaringType;
                while (attribute == null && type != null)
                {
                    PropertyInfo propertyInfo2 = (PropertyInfo)Class_514.GetMemberInfoFromType(type, propertyInfo);
                    if (propertyInfo2 != null && propertyInfo2.IsVirtual())
                    {
                        attribute = Class_471 <DataMemberAttribute> .GetAttribute(propertyInfo2);
                    }
                    type = type.BaseType;
                }
            }
            return(attribute);
        }
コード例 #23
0
        // Token: 0x06000C32 RID: 3122 RVA: 0x00044044 File Offset: 0x00042244
        public virtual bool pmethod_2199(Type arg_0)
        {
            Type type = Class_514.IsNullableType(arg_0) ? Nullable.GetUnderlyingType(arg_0) : arg_0;

            return(type.IsEnum);
        }
コード例 #24
0
        // Token: 0x06001403 RID: 5123 RVA: 0x0005E5A4 File Offset: 0x0005C7A4
        public Class_447(Type arg_0) : base(arg_0)
        {
            this.field_5 = Class_448.Array;
            this.prop_2  = base.prop_1.IsArray;
            bool bool_;
            Type type;

            if (this.prop_2)
            {
                this.prop_0  = Class_514.GetCollectionItemType(base.prop_0);
                this.field_6 = true;
                this.field_0 = typeof(List <>).MakeGenericType(new Type[]
                {
                    this.prop_0
                });
                bool_       = true;
                this.prop_1 = (this.prop_2 && base.prop_0.GetArrayRank() > 1);
            }
            else if (typeof(IList).IsAssignableFrom(arg_0))
            {
                if (Class_514.ImplementsGenericDefinition(arg_0, typeof(ICollection <>), out this.field_0))
                {
                    this.prop_0 = this.field_0.GetGenericArguments()[0];
                }
                else
                {
                    this.prop_0 = Class_514.GetCollectionItemType(arg_0);
                }
                if (arg_0 == typeof(IList))
                {
                    base.prop_1 = typeof(List <object>);
                }
                if (this.prop_0 != null)
                {
                    this.field_4 = Class_510.ResolveEnumerableCollectionConstructor(arg_0, this.prop_0);
                }
                this.field_6 = Class_514.InheritsGenericDefinition(arg_0, typeof(ReadOnlyCollection <>));
                bool_        = true;
            }
            else if (Class_514.ImplementsGenericDefinition(arg_0, typeof(ICollection <>), out this.field_0))
            {
                this.prop_0 = this.field_0.GetGenericArguments()[0];
                if (Class_514.IsGenericDefinition(arg_0, typeof(ICollection <>)) || Class_514.IsGenericDefinition(arg_0, typeof(IList <>)))
                {
                    base.prop_1 = typeof(List <>).MakeGenericType(new Type[]
                    {
                        this.prop_0
                    });
                }
                if (Class_514.IsGenericDefinition(arg_0, typeof(ISet <>)))
                {
                    base.prop_1 = typeof(HashSet <>).MakeGenericType(new Type[]
                    {
                        this.prop_0
                    });
                }
                this.field_4 = Class_510.ResolveEnumerableCollectionConstructor(arg_0, this.prop_0);
                bool_        = true;
                this.prop_3  = true;
            }
            else if (Class_514.ImplementsGenericDefinition(arg_0, typeof(IEnumerable <>), out type))
            {
                this.prop_0 = type.GetGenericArguments()[0];
                if (Class_514.IsGenericDefinition(base.prop_0, typeof(IEnumerable <>)))
                {
                    base.prop_1 = typeof(List <>).MakeGenericType(new Type[]
                    {
                        this.prop_0
                    });
                }
                this.field_4 = Class_510.ResolveEnumerableCollectionConstructor(arg_0, this.prop_0);
                if (!this.prop_6 && arg_0.Name == "FSharpList`1")
                {
                    Class_484.EnsureInitialized(arg_0.Assembly);
                    this.field_5 = Class_484.CreateSeq(this.prop_0);
                }
                if (arg_0.IsGenericType && arg_0.GetGenericTypeDefinition() == typeof(IEnumerable <>))
                {
                    this.field_0 = type;
                    this.field_6 = false;
                    this.prop_3  = false;
                    bool_        = true;
                }
                else
                {
                    this.field_0 = typeof(List <>).MakeGenericType(new Type[]
                    {
                        this.prop_0
                    });
                    this.field_6 = true;
                    this.prop_3  = true;
                    bool_        = this.prop_6;
                }
            }
            else
            {
                bool_       = false;
                this.prop_3 = true;
            }
            this.prop_4 = bool_;
        }
コード例 #25
0
        // Token: 0x060014DD RID: 5341 RVA: 0x000608BC File Offset: 0x0005EABC
        private Class_459 lmethod_3818(Type arg_0, Class_364 arg_1, bool bool_0)
        {
            Class_462.NClass_1 nclass_ = new Class_462.NClass_1();
            nclass_.field_7 = arg_0;
            Class_517.ArgumentNotNull(nclass_.field_7, "type");
            string text  = this.kmethod_3817(nclass_.field_7, false);
            string text2 = this.kmethod_3817(nclass_.field_7, true);

            if (!string.IsNullOrEmpty(text))
            {
                Class_459 class_ = this.field_1.xmethod_3531(text);
                if (class_ != null)
                {
                    if (arg_1 != Class_364.Always && !Class_462.gmethod_3823(class_.prop_7, Class_463.Null))
                    {
                        class_.prop_7 |= Class_463.Null;
                    }
                    if (bool_0 && class_.prop_2 != true)
                    {
                        class_.prop_2 = new bool?(true);
                    }
                    return(class_);
                }
            }
            if (this.field_2.Any(new Func <Class_462.NClass_0, bool>(nclass_.nmethod_6)))
            {
                throw new Class_318("Unresolved circular reference for type '{0}'. Explicitly define an Id for the type using a JsonObject/JsonArray attribute or automatically generate a type Id using the UndefinedSchemaIdHandling property.".FormatWith(CultureInfo.InvariantCulture, nclass_.field_7));
            }
            Class_349 class_2 = this.prop_1.tmethod_3542(nclass_.field_7);
            Class_299 class_3;

            if ((class_3 = class_2.prop_3) != null || (class_3 = class_2.prop_4) != null)
            {
                Class_459 class_4 = class_3.vmethod_2135();
                if (class_4 != null)
                {
                    return(class_4);
                }
            }
            this.pmethod_3809(new Class_462.NClass_0(nclass_.field_7, new Class_459()));
            if (text2 != null)
            {
                this.prop_2.prop_0 = text2;
            }
            if (bool_0)
            {
                this.prop_2.prop_2 = new bool?(true);
            }
            this.prop_2.prop_1 = this.vmethod_3815(nclass_.field_7);
            this.prop_2.prop_6 = this.dmethod_3816(nclass_.field_7);
            if (class_3 != null)
            {
                this.prop_2.prop_7 = new Class_463?(Class_463.Any);
            }
            else
            {
                switch (class_2.field_5)
                {
                case Class_448.Object:
                    this.prop_2.prop_7 = new Class_463?(this.pmethod_3819(Class_463.Object, arg_1));
                    this.prop_2.prop_0 = this.kmethod_3817(nclass_.field_7, false);
                    this.xmethod_3821(nclass_.field_7, (Class_464)class_2);
                    goto IL_519;

                case Class_448.Array:
                    {
                        this.prop_2.prop_7 = new Class_463?(this.pmethod_3819(Class_463.Array, arg_1));
                        this.prop_2.prop_0 = this.kmethod_3817(nclass_.field_7, false);
                        Class_376 cachedAttribute    = Class_470.GetCachedAttribute <Class_376>(nclass_.field_7);
                        bool      flag               = cachedAttribute == null || cachedAttribute.AllowNullItems;
                        Type      collectionItemType = Class_514.GetCollectionItemType(nclass_.field_7);
                        if (collectionItemType != null)
                        {
                            this.prop_2.prop_18 = new List <Class_459>();
                            this.prop_2.prop_18.Add(this.lmethod_3818(collectionItemType, (!flag) ? Class_364.Always : Class_364.Default, false));
                            goto IL_519;
                        }
                        goto IL_519;
                    }

                case Class_448.Primitive:
                {
                    this.prop_2.prop_7 = new Class_463?(this.cmethod_3824(nclass_.field_7, arg_1));
                    if (!(this.prop_2.prop_7 == Class_463.Integer) || !nclass_.field_7.IsEnum || nclass_.field_7.IsDefined(typeof(FlagsAttribute), true))
                    {
                        goto IL_519;
                    }
                    this.prop_2.prop_28 = new List <Class_361>();
                    IList <Class_506 <long> > namesAndValues = Class_505.GetNamesAndValues <long>(nclass_.field_7);
                    using (IEnumerator <Class_506 <long> > enumerator = namesAndValues.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            Class_506 <long> class_5 = enumerator.Current;
                            Class_361        item    = Class_361.smethod_2560(class_5.Value);
                            this.prop_2.prop_28.Add(item);
                        }
                        goto IL_519;
                    }
                    break;
                }

                case Class_448.String:
                    break;

                case Class_448.Dictionary:
                {
                    this.prop_2.prop_7 = new Class_463?(this.pmethod_3819(Class_463.Object, arg_1));
                    Type type;
                    Type arg_2;
                    Class_514.GetDictionaryKeyValueTypes(nclass_.field_7, out type, out arg_2);
                    if (!(type != null))
                    {
                        goto IL_519;
                    }
                    Class_349 class_6 = this.prop_1.tmethod_3542(type);
                    if (class_6.field_5 == Class_448.Primitive)
                    {
                        this.prop_2.prop_24 = this.lmethod_3818(arg_2, Class_364.Default, false);
                        goto IL_519;
                    }
                    goto IL_519;
                }

                case Class_448.Dynamic:
                case Class_448.Linq:
                    this.prop_2.prop_7 = new Class_463?(Class_463.Any);
                    goto IL_519;

                case Class_448.Serializable:
                    this.prop_2.prop_7 = new Class_463?(this.pmethod_3819(Class_463.Object, arg_1));
                    this.prop_2.prop_0 = this.kmethod_3817(nclass_.field_7, false);
                    this.tmethod_3822(nclass_.field_7, (Class_367)class_2);
                    goto IL_519;

                default:
                    throw new Class_318("Unexpected contract type: {0}".FormatWith(CultureInfo.InvariantCulture, class_2));
                }
                Class_463 value = (!Class_514.IsNullable(class_2.prop_0)) ? Class_463.String : this.pmethod_3819(Class_463.String, arg_1);
                this.prop_2.prop_7 = new Class_463?(value);
            }
            IL_519:
            return(this.smethod_3810().nprop_1);
        }
コード例 #26
0
        // Token: 0x06000F7E RID: 3966 RVA: 0x0004FC04 File Offset: 0x0004DE04
        public virtual void dmethod_2806(Class_296 arg_0, object obje_0, Class_418 arg_1)
        {
            string str_;

            if (obje_0 is DateTime)
            {
                DateTime dateTime = (DateTime)obje_0;
                if ((this.field_1 & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal || (this.field_1 & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal)
                {
                    dateTime = dateTime.ToUniversalTime();
                }
                str_ = dateTime.ToString(this.field_2 ?? "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK", this.prop_2);
            }
            else
            {
                if (!(obje_0 is DateTimeOffset))
                {
                    throw new Class_417("Unexpected value when converting date. Expected DateTime or DateTimeOffset, got {0}.".FormatWith(CultureInfo.InvariantCulture, Class_514.GetObjectType(obje_0)));
                }
                DateTimeOffset dateTimeOffset = (DateTimeOffset)obje_0;
                if ((this.field_1 & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal || (this.field_1 & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal)
                {
                    dateTimeOffset = dateTimeOffset.ToUniversalTime();
                }
                str_ = dateTimeOffset.ToString(this.field_2 ?? "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK", this.prop_2);
            }
            arg_0.kmethod_2037(str_);
        }
コード例 #27
0
 // Token: 0x06001560 RID: 5472 RVA: 0x00066718 File Offset: 0x00064918
 private bool tmethod_3932(object obje_0)
 {
     return((this.field_3.field_6 != Class_457.Ignore || obje_0 != null) && (!this.tmethod_3922(this.field_3.field_7, Class_377.Ignore) || (obje_0 != null && !Class_513.ValueEquals(obje_0, Class_514.GetDefaultValue(obje_0.GetType())))));
 }
コード例 #28
0
        // Token: 0x06000C1A RID: 3098 RVA: 0x000439DC File Offset: 0x00041BDC
        public virtual bool smethod_2180(Type arg_0)
        {
            Type type = Class_514.IsNullableType(arg_0) ? Nullable.GetUnderlyingType(arg_0) : arg_0;

            return(type.IsValueType && type.IsGenericType && type.GetGenericTypeDefinition() == typeof(KeyValuePair <, >));
        }
コード例 #29
0
 // Token: 0x06000D48 RID: 3400 RVA: 0x000482E9 File Offset: 0x000464E9
 public IList <Attribute> kmethod_2367(Type arg_0, bool bool_0)
 {
     return(Class_514.GetAttributes(this.field_0, arg_0, bool_0));
 }
コード例 #30
0
 // Token: 0x06000D47 RID: 3399 RVA: 0x000482DA File Offset: 0x000464DA
 public IList <Attribute> dmethod_2366(bool bool_0)
 {
     return(Class_514.GetAttributes(this.field_0, null, bool_0));
 }