示例#1
0
        // Token: 0x060002B6 RID: 694 RVA: 0x00026C9C File Offset: 0x00024E9C
        private bool ReadTableFromOffset(ulong ulong_0)
        {
            bool result;

            try
            {
                if (this._fileBytes[(int)(checked ((IntPtr)ulong_0))] == 13)
                {
                    uint num  = (uint)(this.ConvertToULong((int)ulong_0 + 3, 2) - 1UL);
                    int  num2 = 0;
                    if (this._tableEntries != null)
                    {
                        num2 = this._tableEntries.Length;
                        Array.Resize <SqlHandler.TableEntry>(ref this._tableEntries, this._tableEntries.Length + (int)num + 1);
                    }
                    else
                    {
                        this._tableEntries = new SqlHandler.TableEntry[num + 1U];
                    }
                    for (uint num3 = 0U; num3 <= num; num3 += 1U)
                    {
                        ulong num4 = this.ConvertToULong((int)ulong_0 + 8 + (int)(num3 * 2U), 2);
                        if (ulong_0 != 100UL)
                        {
                            num4 += ulong_0;
                        }
                        int num5 = this.Gvl((int)num4);
                        this.Cvl((int)num4, num5);
                        int num6 = this.Gvl((int)(num4 + (ulong)((long)num5 - (long)num4) + 1UL));
                        this.Cvl((int)(num4 + (ulong)((long)num5 - (long)num4) + 1UL), num6);
                        ulong num7  = num4 + (ulong)((long)num6 - (long)num4 + 1L);
                        int   num8  = this.Gvl((int)num7);
                        int   num9  = num8;
                        long  num10 = this.Cvl((int)num7, num8);
                        SqlHandler.RecordHeaderField[] array = null;
                        long num11 = (long)(num7 - (ulong)((long)num8) + 1UL);
                        int  num12 = 0;
                        while (num11 < num10)
                        {
                            Array.Resize <SqlHandler.RecordHeaderField>(ref array, num12 + 1);
                            int num13 = num9 + 1;
                            num9 = this.Gvl(num13);
                            array[num12].Type = this.Cvl(num13, num9);
                            array[num12].Size = (long)((array[num12].Type <= 9L) ? ((ulong)this._sqlDataTypeSize[(int)(checked ((IntPtr)array[num12].Type))]) : ((ulong)((!SqlHandler.IsOdd(array[num12].Type)) ? ((array[num12].Type - 12L) / 2L) : ((array[num12].Type - 13L) / 2L))));
                            num11             = num11 + (long)(num9 - num13) + 1L;
                            num12++;
                        }
                        if (array != null)
                        {
                            this._tableEntries[num2 + (int)num3].Content = new string[array.Length];
                            int num14 = 0;
                            for (int i = 0; i <= array.Length - 1; i++)
                            {
                                if (array[i].Type > 9L)
                                {
                                    if (!SqlHandler.IsOdd(array[i].Type))
                                    {
                                        if (this._dbEncoding == 1UL)
                                        {
                                            this._tableEntries[num2 + (int)num3].Content[i] = Encoding.Default.GetString(this._fileBytes, (int)(num7 + (ulong)num10 + (ulong)((long)num14)), (int)array[i].Size);
                                        }
                                        else if (this._dbEncoding == 2UL)
                                        {
                                            this._tableEntries[num2 + (int)num3].Content[i] = Encoding.Unicode.GetString(this._fileBytes, (int)(num7 + (ulong)num10 + (ulong)((long)num14)), (int)array[i].Size);
                                        }
                                        else if (this._dbEncoding == 3UL)
                                        {
                                            this._tableEntries[num2 + (int)num3].Content[i] = Encoding.BigEndianUnicode.GetString(this._fileBytes, (int)(num7 + (ulong)num10 + (ulong)((long)num14)), (int)array[i].Size);
                                        }
                                    }
                                    else
                                    {
                                        this._tableEntries[num2 + (int)num3].Content[i] = Encoding.Default.GetString(this._fileBytes, (int)(num7 + (ulong)num10 + (ulong)((long)num14)), (int)array[i].Size);
                                    }
                                }
                                else
                                {
                                    this._tableEntries[num2 + (int)num3].Content[i] = Convert.ToString(this.ConvertToULong((int)(num7 + (ulong)num10 + (ulong)((long)num14)), (int)array[i].Size));
                                }
                                num14 += (int)array[i].Size;
                            }
                        }
                    }
                }
                else if (this._fileBytes[(int)(checked ((IntPtr)ulong_0))] == 5)
                {
                    uint num15 = (uint)(this.ConvertToULong((int)(ulong_0 + 3UL), 2) - 1UL);
                    for (uint num16 = 0U; num16 <= num15; num16 += 1U)
                    {
                        uint num17 = (uint)this.ConvertToULong((int)ulong_0 + 12 + (int)(num16 * 2U), 2);
                        this.ReadTableFromOffset((this.ConvertToULong((int)(ulong_0 + (ulong)num17), 4) - 1UL) * this._pageSize);
                    }
                    this.ReadTableFromOffset((this.ConvertToULong((int)(ulong_0 + 8UL), 4) - 1UL) * this._pageSize);
                }
                result = true;
            }
            catch
            {
                result = false;
            }
            return(result);
        }
示例#2
0
 // Token: 0x060002B7 RID: 695 RVA: 0x000271B0 File Offset: 0x000253B0
 private void ReadMasterTable(long long_0)
 {
     try
     {
         byte b = this._fileBytes[(int)(checked ((IntPtr)long_0))];
         if (b != 5)
         {
             if (b == 13)
             {
                 ulong num  = this.ConvertToULong((int)long_0 + 3, 2) - 1UL;
                 int   num2 = 0;
                 if (this._masterTableEntries != null)
                 {
                     num2 = this._masterTableEntries.Length;
                     Array.Resize <SqlHandler.SqliteMasterEntry>(ref this._masterTableEntries, this._masterTableEntries.Length + (int)num + 1);
                 }
                 else
                 {
                     this._masterTableEntries = new SqlHandler.SqliteMasterEntry[num + 1UL];
                 }
                 for (ulong num3 = 0UL; num3 <= num; num3 += 1UL)
                 {
                     ulong num4 = this.ConvertToULong((int)long_0 + 8 + (int)num3 * 2, 2);
                     if (long_0 != 100L)
                     {
                         num4 += (ulong)long_0;
                     }
                     int num5 = this.Gvl((int)num4);
                     this.Cvl((int)num4, num5);
                     int num6 = this.Gvl((int)(num4 + (ulong)((long)num5 - (long)num4) + 1UL));
                     this.Cvl((int)(num4 + (ulong)((long)num5 - (long)num4) + 1UL), num6);
                     ulong  num7  = num4 + (ulong)((long)num6 - (long)num4 + 1L);
                     int    num8  = this.Gvl((int)num7);
                     int    num9  = num8;
                     long   num10 = this.Cvl((int)num7, num8);
                     long[] array = new long[5];
                     for (int i = 0; i <= 4; i++)
                     {
                         int int_ = num9 + 1;
                         num9     = this.Gvl(int_);
                         array[i] = this.Cvl(int_, num9);
                         array[i] = (long)((array[i] <= 9L) ? ((ulong)this._sqlDataTypeSize[(int)(checked ((IntPtr)array[i]))]) : ((ulong)((!SqlHandler.IsOdd(array[i])) ? ((array[i] - 12L) / 2L) : ((array[i] - 13L) / 2L))));
                     }
                     if (this._dbEncoding == 1UL || this._dbEncoding == 2UL)
                     {
                         if (this._dbEncoding == 1UL)
                         {
                             this._masterTableEntries[num2 + (int)num3].ItemName = Encoding.Default.GetString(this._fileBytes, (int)(num7 + (ulong)num10 + (ulong)array[0]), (int)array[1]);
                         }
                         else if (this._dbEncoding == 2UL)
                         {
                             this._masterTableEntries[num2 + (int)num3].ItemName = Encoding.Unicode.GetString(this._fileBytes, (int)(num7 + (ulong)num10 + (ulong)array[0]), (int)array[1]);
                         }
                         else if (this._dbEncoding == 3UL)
                         {
                             this._masterTableEntries[num2 + (int)num3].ItemName = Encoding.BigEndianUnicode.GetString(this._fileBytes, (int)(num7 + (ulong)num10 + (ulong)array[0]), (int)array[1]);
                         }
                     }
                     this._masterTableEntries[num2 + (int)num3].RootNum = (long)this.ConvertToULong((int)(num7 + (ulong)num10 + (ulong)array[0] + (ulong)array[1] + (ulong)array[2]), (int)array[3]);
                     if (this._dbEncoding == 1UL)
                     {
                         this._masterTableEntries[num2 + (int)num3].SqlStatement = Encoding.Default.GetString(this._fileBytes, (int)(num7 + (ulong)num10 + (ulong)array[0] + (ulong)array[1] + (ulong)array[2] + (ulong)array[3]), (int)array[4]);
                     }
                     else if (this._dbEncoding == 2UL)
                     {
                         this._masterTableEntries[num2 + (int)num3].SqlStatement = Encoding.Unicode.GetString(this._fileBytes, (int)(num7 + (ulong)num10 + (ulong)array[0] + (ulong)array[1] + (ulong)array[2] + (ulong)array[3]), (int)array[4]);
                     }
                     else if (this._dbEncoding == 3UL)
                     {
                         this._masterTableEntries[num2 + (int)num3].SqlStatement = Encoding.BigEndianUnicode.GetString(this._fileBytes, (int)(num7 + (ulong)num10 + (ulong)array[0] + (ulong)array[1] + (ulong)array[2] + (ulong)array[3]), (int)array[4]);
                     }
                 }
             }
         }
         else
         {
             uint num11 = (uint)(this.ConvertToULong((int)long_0 + 3, 2) - 1UL);
             for (int j = 0; j <= (int)num11; j++)
             {
                 uint num12 = (uint)this.ConvertToULong((int)long_0 + 12 + j * 2, 2);
                 if (long_0 == 100L)
                 {
                     this.ReadMasterTable((long)((this.ConvertToULong((int)num12, 4) - 1UL) * this._pageSize));
                 }
                 else
                 {
                     this.ReadMasterTable((long)((this.ConvertToULong((int)(long_0 + (long)((ulong)num12)), 4) - 1UL) * this._pageSize));
                 }
             }
             this.ReadMasterTable((long)((this.ConvertToULong((int)long_0 + 8, 4) - 1UL) * this._pageSize));
         }
     }
     catch
     {
     }
 }