Example #1
0
 // Token: 0x06000C1B RID: 3099 RVA: 0x00043A2E File Offset: 0x00041C2E
 private static void xmethod_2181(Class_285 arg_0)
 {
     if (!arg_0.vmethod_1885())
     {
         throw Class_417.xmethod_3101(arg_0, "Unexpected end when reading KeyValuePair.");
     }
 }
Example #2
0
        // Token: 0x06000C13 RID: 3091 RVA: 0x00043714 File Offset: 0x00041914
        private object cmethod_2174(Class_285 arg_0)
        {
            IDictionary <string, object> dictionary = new ExpandoObject();

            while (arg_0.vmethod_1885())
            {
                Class_508 class_ = arg_0.prop_9;
                switch (class_)
                {
                case Class_508.PropertyName:
                {
                    string key = arg_0.prop_10.ToString();
                    if (!arg_0.vmethod_1885())
                    {
                        throw Class_417.xmethod_3101(arg_0, "Unexpected end when reading ExpandoObject.");
                    }
                    object value = this.tmethod_2172(arg_0);
                    dictionary[key] = value;
                    break;
                }

                case Class_508.Comment:
                    break;

                default:
                    if (class_ == Class_508.EndObject)
                    {
                        return(dictionary);
                    }
                    break;
                }
            }
            throw Class_417.xmethod_3101(arg_0, "Unexpected end when reading ExpandoObject.");
        }
Example #3
0
        // Token: 0x06000C11 RID: 3089 RVA: 0x00043624 File Offset: 0x00041824
        private object tmethod_2172(Class_285 arg_0)
        {
            while (arg_0.prop_9 == Class_508.Comment)
            {
                if (!arg_0.vmethod_1885())
                {
                    throw Class_417.xmethod_3101(arg_0, "Unexpected end when reading ExpandoObject.");
                }
            }
            switch (arg_0.prop_9)
            {
            case Class_508.StartObject:
                return(this.cmethod_2174(arg_0));

            case Class_508.StartArray:
                return(this.gmethod_2173(arg_0));

            default:
                if (Class_486.IsPrimitiveToken(arg_0.prop_9))
                {
                    return(arg_0.prop_10);
                }
                throw Class_417.xmethod_3101(arg_0, "Unexpected token when converting ExpandoObject: {0}".FormatWith(CultureInfo.InvariantCulture, arg_0.prop_9));
            }
        }
Example #4
0
 // Token: 0x06000BF8 RID: 3064 RVA: 0x00042E7F File Offset: 0x0004107F
 private static void tmethod_2152(Class_285 arg_0)
 {
     if (!arg_0.vmethod_1885())
     {
         throw Class_417.xmethod_3101(arg_0, "Unexpected end when reading DataTable.");
     }
 }
Example #5
0
        // Token: 0x06000BEC RID: 3052 RVA: 0x000427C0 File Offset: 0x000409C0
        private byte[] tmethod_2142(Class_285 arg_0)
        {
            List <byte> list = new List <byte>();

            while (arg_0.vmethod_1885())
            {
                Class_508 class_ = arg_0.prop_9;
                switch (class_)
                {
                case Class_508.Comment:
                    continue;

                case Class_508.Raw:
                    break;

                case Class_508.Integer:
                    list.Add(Convert.ToByte(arg_0.prop_10, CultureInfo.InvariantCulture));
                    continue;

                default:
                    if (class_ == Class_508.EndArray)
                    {
                        return(list.ToArray());
                    }
                    break;
                }
                throw Class_417.xmethod_3101(arg_0, "Unexpected token when reading bytes: {0}".FormatWith(CultureInfo.InvariantCulture, arg_0.prop_9));
            }
            throw Class_417.xmethod_3101(arg_0, "Unexpected end when reading bytes.");
        }
Example #6
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);
        }
Example #7
0
        // Token: 0x06000BF7 RID: 3063 RVA: 0x00042DC4 File Offset: 0x00040FC4
        private static Type xmethod_2151(Class_285 arg_0)
        {
            Class_508 class_ = arg_0.prop_9;

            switch (class_)
            {
            case Class_508.StartArray:
            {
                Class_302.tmethod_2152(arg_0);
                if (arg_0.prop_9 == Class_508.StartObject)
                {
                    return(typeof(DataTable));
                }
                Type type = Class_302.xmethod_2151(arg_0);
                return(type.MakeArrayType());
            }

            case Class_508.Integer:
            case Class_508.Float:
            case Class_508.String:
            case Class_508.Boolean:
            case Class_508.Date:
            case Class_508.Bytes:
                return(arg_0.prop_11);

            case Class_508.Null:
            case Class_508.Undefined:
                return(typeof(string));
            }
            throw Class_417.xmethod_3101(arg_0, "Unexpected JSON token when reading DataTable: {0}".FormatWith(CultureInfo.InvariantCulture, class_));
        }
Example #8
0
 // Token: 0x06000BF2 RID: 3058 RVA: 0x00042A10 File Offset: 0x00040C10
 private void kmethod_2147(Class_285 arg_0)
 {
     if (!arg_0.vmethod_1885())
     {
         throw Class_417.xmethod_3101(arg_0, "Unexpected end when reading DataSet.");
     }
 }
Example #9
0
 // Token: 0x06000C06 RID: 3078 RVA: 0x00043377 File Offset: 0x00041577
 private static void gmethod_2163(Class_285 arg_0)
 {
     if (!arg_0.vmethod_1885())
     {
         throw Class_417.xmethod_3101(arg_0, "Unexpected end when reading union.");
     }
 }
Example #10
0
        // Token: 0x06000BF5 RID: 3061 RVA: 0x00042B70 File Offset: 0x00040D70
        public virtual object pmethod_2149(Class_285 arg_0, Type arg_1, object obje_0, Class_418 arg_2)
        {
            DataTable dataTable = obje_0 as DataTable;

            if (dataTable == null)
            {
                dataTable = ((arg_1 == typeof(DataTable)) ? new DataTable() : ((DataTable)Activator.CreateInstance(arg_1)));
            }
            if (arg_0.prop_9 == Class_508.PropertyName)
            {
                dataTable.TableName = (string)arg_0.prop_10;
                Class_302.tmethod_2152(arg_0);
            }
            if (arg_0.prop_9 != Class_508.StartArray)
            {
                throw Class_417.xmethod_3101(arg_0, "Unexpected JSON token when reading DataTable. Expected StartArray, got {0}.".FormatWith(CultureInfo.InvariantCulture, arg_0.prop_9));
            }
            Class_302.tmethod_2152(arg_0);
            while (arg_0.prop_9 != Class_508.EndArray)
            {
                Class_302.smethod_2150(arg_0, dataTable);
                Class_302.tmethod_2152(arg_0);
            }
            return(dataTable);
        }
Example #11
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));
                }
            }
        }
Example #12
0
 // Token: 0x06000C26 RID: 3110 RVA: 0x00043C61 File Offset: 0x00041E61
 public virtual object pmethod_2189(Class_285 arg_0, Type arg_1, object obje_0, Class_418 arg_2)
 {
     if (arg_0.prop_9 == Class_508.StartObject)
     {
         return(this.xmethod_2191(arg_0, arg_2));
     }
     if (arg_0.prop_9 == Class_508.String)
     {
         return(this.smethod_2190(arg_0));
     }
     throw Class_417.xmethod_3101(arg_0, "Unexpected token when reading Regex.");
 }
Example #13
0
        // Token: 0x06000C28 RID: 3112 RVA: 0x00043D68 File Offset: 0x00041F68
        private Regex xmethod_2191(Class_285 arg_0, Class_418 arg_1)
        {
            string       text         = null;
            RegexOptions?regexOptions = null;

            while (arg_0.vmethod_1885())
            {
                Class_508 class_ = arg_0.prop_9;
                switch (class_)
                {
                case Class_508.PropertyName:
                {
                    string a = arg_0.prop_10.ToString();
                    if (!arg_0.vmethod_1885())
                    {
                        throw Class_417.xmethod_3101(arg_0, "Unexpected end when reading Regex.");
                    }
                    if (string.Equals(a, "Pattern", StringComparison.OrdinalIgnoreCase))
                    {
                        text = (string)arg_0.prop_10;
                    }
                    else if (string.Equals(a, "Options", StringComparison.OrdinalIgnoreCase))
                    {
                        regexOptions = new RegexOptions?(arg_1.pmethod_3169 <RegexOptions>(arg_0));
                    }
                    else
                    {
                        arg_0.smethod_1900();
                    }
                    break;
                }

                case Class_508.Comment:
                    break;

                default:
                    if (class_ == Class_508.EndObject)
                    {
                        if (text == null)
                        {
                            throw Class_417.xmethod_3101(arg_0, "Error deserializing Regex. No pattern found.");
                        }
                        return(new Regex(text, regexOptions ?? RegexOptions.None));
                    }
                    break;
                }
            }
            throw Class_417.xmethod_3101(arg_0, "Unexpected end when reading Regex.");
        }
Example #14
0
 // Token: 0x06001034 RID: 4148 RVA: 0x000518E8 File Offset: 0x0004FAE8
 private string xmethod_2971(Class_285 arg_0)
 {
     if (arg_0.prop_9 == Class_508.String)
     {
         return(arg_0.prop_10.ToString());
     }
     if (arg_0.prop_9 == Class_508.Integer)
     {
         return(XmlConvert.ToString(Convert.ToInt64(arg_0.prop_10, CultureInfo.InvariantCulture)));
     }
     if (arg_0.prop_9 == Class_508.Float)
     {
         if (arg_0.prop_10 is decimal)
         {
             return(XmlConvert.ToString((decimal)arg_0.prop_10));
         }
         if (arg_0.prop_10 is float)
         {
             return(XmlConvert.ToString((float)arg_0.prop_10));
         }
         return(XmlConvert.ToString(Convert.ToDouble(arg_0.prop_10, CultureInfo.InvariantCulture)));
     }
     else
     {
         if (arg_0.prop_9 == Class_508.Boolean)
         {
             return(XmlConvert.ToString(Convert.ToBoolean(arg_0.prop_10, CultureInfo.InvariantCulture)));
         }
         if (arg_0.prop_9 == Class_508.Date)
         {
             if (arg_0.prop_10 is DateTimeOffset)
             {
                 return(XmlConvert.ToString((DateTimeOffset)arg_0.prop_10));
             }
             DateTime value = Convert.ToDateTime(arg_0.prop_10, CultureInfo.InvariantCulture);
             return(XmlConvert.ToString(value, Class_502.ToSerializationMode(value.Kind)));
         }
         else
         {
             if (arg_0.prop_9 == Class_508.Null)
             {
                 return(null);
             }
             throw Class_417.xmethod_3101(arg_0, "Cannot get an XML string value from token type '{0}'.".FormatWith(CultureInfo.InvariantCulture, arg_0.prop_9));
         }
     }
 }
Example #15
0
        // Token: 0x06000C12 RID: 3090 RVA: 0x000436BC File Offset: 0x000418BC
        private object gmethod_2173(Class_285 arg_0)
        {
            IList <object> list = new List <object>();

            while (arg_0.vmethod_1885())
            {
                Class_508 class_ = arg_0.prop_9;
                if (class_ != Class_508.Comment)
                {
                    if (class_ == Class_508.EndArray)
                    {
                        return(list);
                    }
                    object item = this.tmethod_2172(arg_0);
                    list.Add(item);
                }
            }
            throw Class_417.xmethod_3101(arg_0, "Unexpected end when reading ExpandoObject.");
        }
Example #16
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));
 }
Example #17
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));
            }
        }
Example #18
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);
        }
Example #19
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);
            }
        }
Example #20
0
        // Token: 0x06000C04 RID: 3076 RVA: 0x00043064 File Offset: 0x00041264
        public virtual object xmethod_2161(Class_285 arg_0, Type arg_1, object obje_0, Class_418 arg_2)
        {
            if (arg_0.prop_9 == Class_508.Null)
            {
                return(null);
            }
            object    obj    = null;
            string    text   = null;
            Class_424 class_ = null;

            Class_305.gmethod_2163(arg_0);
            while (arg_0.prop_9 == Class_508.PropertyName)
            {
                string text2 = arg_0.prop_10.ToString();
                if (string.Equals(text2, "Case", StringComparison.OrdinalIgnoreCase))
                {
                    Class_305.gmethod_2163(arg_0);
                    Class_489 <object, object> getUnionCases = Class_484.GetUnionCases;
                    object   target = null;
                    object[] array  = new object[2];
                    array[0] = arg_1;
                    IEnumerable enumerable = (IEnumerable)getUnionCases(target, array);
                    text = arg_0.prop_10.ToString();
                    foreach (object obj2 in enumerable)
                    {
                        if ((string)Class_484.GetUnionCaseInfoName(obj2) == text)
                        {
                            obj = obj2;
                            break;
                        }
                    }
                    if (obj == null)
                    {
                        throw Class_417.xmethod_3101(arg_0, "No union type found with the name '{0}'.".FormatWith(CultureInfo.InvariantCulture, text));
                    }
                }
                else
                {
                    if (!string.Equals(text2, "Fields", StringComparison.OrdinalIgnoreCase))
                    {
                        throw Class_417.xmethod_3101(arg_0, "Unexpected property '{0}' found when reading union.".FormatWith(CultureInfo.InvariantCulture, text2));
                    }
                    Class_305.gmethod_2163(arg_0);
                    if (arg_0.prop_9 != Class_508.StartArray)
                    {
                        throw Class_417.xmethod_3101(arg_0, "Union fields must been an array.");
                    }
                    class_ = (Class_424)Class_361.dmethod_2566(arg_0);
                }
                Class_305.gmethod_2163(arg_0);
            }
            if (obj == null)
            {
                throw Class_417.xmethod_3101(arg_0, "No '{0}' property with union name found.".FormatWith(CultureInfo.InvariantCulture, "Case"));
            }
            PropertyInfo[] array2 = (PropertyInfo[])Class_484.GetUnionCaseInfoFields(obj, new object[0]);
            object[]       array3 = new object[array2.Length];
            if (array2.Length > 0 && class_ == null)
            {
                throw Class_417.xmethod_3101(arg_0, "No '{0}' property with union fields found.".FormatWith(CultureInfo.InvariantCulture, "Fields"));
            }
            if (class_ != null)
            {
                if (array2.Length != class_.prop_9)
                {
                    throw Class_417.xmethod_3101(arg_0, "The number of field values does not match the number of properties definied by union '{0}'.".FormatWith(CultureInfo.InvariantCulture, text));
                }
                for (int i = 0; i < class_.prop_9; i++)
                {
                    Class_361    class_2      = class_.lmethod_3358(i);
                    PropertyInfo propertyInfo = array2[i];
                    array3[i] = class_2.vmethod_2565(propertyInfo.PropertyType, arg_2);
                }
            }
            Class_489 <object, object> makeUnion = Class_484.MakeUnion;
            object target2 = null;

            object[] array4 = new object[3];
            array4[0] = obj;
            array4[1] = array3;
            return(makeUnion(target2, array4));
        }