コード例 #1
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);
        }
コード例 #2
0
 // Token: 0x06000C34 RID: 3124 RVA: 0x000440A0 File Offset: 0x000422A0
 public virtual object xmethod_2201(Class_285 arg_0, Type arg_1, object obje_0, Class_418 arg_2)
 {
     if (arg_0.prop_9 == Class_508.Null)
     {
         return(null);
     }
     if (arg_0.prop_9 == Class_508.String)
     {
         try
         {
             return(new Version((string)arg_0.prop_10));
         }
         catch (Exception arg_3)
         {
             throw Class_417.tmethod_3102(arg_0, "Error parsing version string: {0}".FormatWith(CultureInfo.InvariantCulture, arg_0.prop_10), arg_3);
         }
     }
     throw Class_417.xmethod_3101(arg_0, "Unexpected token or value when parsing version. Token: {0}, Value: {1}".FormatWith(CultureInfo.InvariantCulture, arg_0.prop_9, arg_0.prop_10));
 }