Esempio n. 1
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);
        }
Esempio n. 2
0
        // Token: 0x06000BF6 RID: 3062 RVA: 0x00042C28 File Offset: 0x00040E28
        private static void smethod_2150(Class_285 arg_0, DataTable arg_1)
        {
            DataRow dataRow = arg_1.NewRow();

            Class_302.tmethod_2152(arg_0);
            while (arg_0.prop_9 == Class_508.PropertyName)
            {
                string text = (string)arg_0.prop_10;
                Class_302.tmethod_2152(arg_0);
                DataColumn dataColumn = arg_1.Columns[text];
                if (dataColumn == null)
                {
                    Type dataType = Class_302.xmethod_2151(arg_0);
                    dataColumn = new DataColumn(text, dataType);
                    arg_1.Columns.Add(dataColumn);
                }
                if (dataColumn.DataType == typeof(DataTable))
                {
                    if (arg_0.prop_9 == Class_508.StartArray)
                    {
                        Class_302.tmethod_2152(arg_0);
                    }
                    DataTable dataTable = new DataTable();
                    while (arg_0.prop_9 != Class_508.EndArray)
                    {
                        Class_302.smethod_2150(arg_0, dataTable);
                        Class_302.tmethod_2152(arg_0);
                    }
                    dataRow[text] = dataTable;
                }
                else if (dataColumn.DataType.IsArray && dataColumn.DataType != typeof(byte[]))
                {
                    if (arg_0.prop_9 == Class_508.StartArray)
                    {
                        Class_302.tmethod_2152(arg_0);
                    }
                    List <object> list = new List <object>();
                    while (arg_0.prop_9 != Class_508.EndArray)
                    {
                        list.Add(arg_0.prop_10);
                        Class_302.tmethod_2152(arg_0);
                    }
                    Array array = Array.CreateInstance(dataColumn.DataType.GetElementType(), list.Count);
                    Array.Copy(list.ToArray(), array, list.Count);
                    dataRow[text] = array;
                }
                else
                {
                    dataRow[text] = (arg_0.prop_10 ?? DBNull.Value);
                }
                Class_302.tmethod_2152(arg_0);
            }
            dataRow.EndEdit();
            arg_1.Rows.Add(dataRow);
        }