Пример #1
0
    // Token: 0x060005AF RID: 1455 RVA: 0x00027380 File Offset: 0x00025580
    public static Enum3 smethod_1(Type type_0, out bool bool_0)
    {
        Enum3 result;

        if (Class23.dictionary_0.TryGetValue(type_0, out result))
        {
            bool_0 = false;
            return(result);
        }
        if (type_0.smethod_8())
        {
            bool_0 = true;
            return(Class23.smethod_0(Enum.GetUnderlyingType(type_0)));
        }
        if (Class90.smethod_11(type_0))
        {
            Type underlyingType = Nullable.GetUnderlyingType(type_0);
            if (underlyingType.smethod_8())
            {
                Type type_ = typeof(Nullable <>).MakeGenericType(new Type[]
                {
                    Enum.GetUnderlyingType(underlyingType)
                });
                bool_0 = true;
                return(Class23.smethod_0(type_));
            }
        }
        bool_0 = false;
        return((Enum3)1);
    }
Пример #2
0
    // Token: 0x060005B8 RID: 1464 RVA: 0x00027754 File Offset: 0x00025954
    private static Class23.Enum5 smethod_9(object object_0, object object_1, Type type_0, out object object_2)
    {
        if (object_0 == null)
        {
            throw new ArgumentNullException("initialValue");
        }
        if (Class90.smethod_11(type_0))
        {
            type_0 = Nullable.GetUnderlyingType(type_0);
        }
        Type type = object_0.GetType();

        if (type_0 == type)
        {
            object_2 = object_0;
            return((Class23.Enum5) 0);
        }
        if (Class23.smethod_3(object_0.GetType()) && Class23.smethod_3(type_0))
        {
            if (type_0.smethod_8())
            {
                if (object_0 is string)
                {
                    object_2 = Enum.Parse(type_0, object_0.ToString(), true);
                    return((Class23.Enum5) 0);
                }
                if (Class23.smethod_13(object_0))
                {
                    object_2 = Enum.ToObject(type_0, object_0);
                    return((Class23.Enum5) 0);
                }
            }
            object_2 = Convert.ChangeType(object_0, type_0, object_1);
            return((Class23.Enum5) 0);
        }
        if (object_0 is DateTime)
        {
            DateTime dateTime = (DateTime)object_0;
            if (type_0 == typeof(DateTimeOffset))
            {
                object_2 = new DateTimeOffset(dateTime);
                return((Class23.Enum5) 0);
            }
        }
        byte[] b;
        if ((b = (object_0 as byte[])) != null && type_0 == typeof(Guid))
        {
            object_2 = new Guid(b);
            return((Class23.Enum5) 0);
        }
        if (object_0 is Guid)
        {
            Guid guid = (Guid)object_0;
            if (type_0 == typeof(byte[]))
            {
                object_2 = guid.ToByteArray();
                return((Class23.Enum5) 0);
            }
        }
        string text;

        if ((text = (object_0 as string)) != null)
        {
            if (type_0 == typeof(Guid))
            {
                object_2 = new Guid(text);
                return((Class23.Enum5) 0);
            }
            if (type_0 == typeof(Uri))
            {
                object_2 = new Uri(text, UriKind.RelativeOrAbsolute);
                return((Class23.Enum5) 0);
            }
            if (type_0 == typeof(TimeSpan))
            {
                object_2 = Class23.smethod_4(text);
                return((Class23.Enum5) 0);
            }
            if (type_0 == typeof(byte[]))
            {
                object_2 = Convert.FromBase64String(text);
                return((Class23.Enum5) 0);
            }
            if (type_0 == typeof(Version))
            {
                Version version;
                if (Version.TryParse(text, out version))
                {
                    object_2 = version;
                    return((Class23.Enum5) 0);
                }
                object_2 = null;
                return((Class23.Enum5) 3);
            }
            else if (typeof(Type).IsAssignableFrom(type_0))
            {
                object_2 = Type.GetType(text, true);
                return((Class23.Enum5) 0);
            }
        }
        if (type_0 == typeof(BigInteger))
        {
            object_2 = Class23.smethod_6(object_0);
            return((Class23.Enum5) 0);
        }
        if (object_0 is BigInteger)
        {
            BigInteger bigInteger_ = (BigInteger)object_0;
            object_2 = Class23.smethod_7(bigInteger_, type_0);
            return((Class23.Enum5) 0);
        }
        TypeConverter converter = TypeDescriptor.GetConverter(type);

        if (converter != null && converter.CanConvertTo(type_0))
        {
            object_2 = converter.ConvertTo(null, object_1, object_0, type_0);
            return((Class23.Enum5) 0);
        }
        TypeConverter converter2 = TypeDescriptor.GetConverter(type_0);

        if (converter2 != null && converter2.CanConvertFrom(type))
        {
            object_2 = converter2.ConvertFrom(null, object_1, object_0);
            return((Class23.Enum5) 0);
        }
        if (object_0 == DBNull.Value)
        {
            if (Class90.smethod_10(type_0))
            {
                object_2 = Class23.smethod_11(null, type, type_0);
                return((Class23.Enum5) 0);
            }
            object_2 = null;
            return((Class23.Enum5) 1);
        }
        else
        {
            if (!type_0.smethod_3() && !type_0.smethod_5() && !type_0.smethod_11())
            {
                object_2 = null;
                return((Class23.Enum5) 3);
            }
            object_2 = null;
            return((Class23.Enum5) 2);
        }
    }
Пример #3
0
 // Token: 0x060005A7 RID: 1447 RVA: 0x00006974 File Offset: 0x00004B74
 private static bool smethod_1(object object_0)
 {
     return(object_0 is nhRd76JVPX5GP69E2c || (object_0 == null && (!typeof(nhRd76JVPX5GP69E2c).smethod_13() || Class90.smethod_11(typeof(nhRd76JVPX5GP69E2c)))));
 }