' Gambas module file

Public i As Integer
Public database As Collection
Public Sub _inits()
  Dim buffer, cpucache As String
  Dim processorscount, za, z As Integer
  buffer = File.Load("Database/db")
  database = JSON.Decode(buffer)
  cpucache = Finfosys.Label14.Text
  cpucache = Replace(Replace(Replace(Replace(Replace(Replace(Replace(cpucache, "Intel", ""), " ", "*"), "R", ""), "CPU", ""), "TM", ""), ")", ""), "(", "")
  cpucache = Replace(Replace(Replace(Replace(Replace(cpucache, "AMD", ""), "Core", ""), "Dual", ""), "Processor", ""), "tm", "")
  
  For z = 0 To database["DATABASE"].Count - 1
    If database["DATABASE"][z]["PROCESSOR_MODEL_NAME"] Like "*" & cpucache & "*" Then 
      Finfosys.Label103.Text = " Integrated GPU: " & database["DATABASE"][z]["PROCESSOR_INTEGRATEDGRAPHIC"]
      Finfosys.Label104.Text = " TDP: " & database["DATABASE"][z]["PROCESSOR_TDP"]
      Finfosys.Label110.Text = " PPS: " & database["DATABASE"][z]["PROCESSOR_PROCESS_SIZE"]
      Finfosys.PictureBox3.Picture = Picture["Database/Logos/" & database["DATABASE"][z]["PROCESSOR_SOCKET_IMAGE"] & ""]
      Finfosys.Label111.Text = " Socket: " & database["DATABASE"][z]["PROCESSOR_SOCKET"]
      Finfosys.Label112.Text = " Transistors: " & database["DATABASE"][z]["PROCESSOR_TRANSISTORS"]
      Finfosys.Label113.Text = " Die size: " & database["DATABASE"][z]["PROCESSOR_DIE_SIZE"]
      Finfosys.Label114.Text = " Package: " & database["DATABASE"][z]["PROCESSOR_PACKAGE"]
      Finfosys.Label115.Text = " Tcasemax: " & database["DATABASE"][z]["PROCESSOR_TCASEMAX"]
      Finfosys.Label116.Text = " Turboclock: " & database["DATABASE"][z]["PROCESSOR_TURBOCLOCK"] 
      Finfosys.Label117.Text = " Multiplier: " & database["DATABASE"][z]["PROCESSOR_MULTIPLIER"]
      Finfosys.Label118.Text = " Voltage: " & database["DATABASE"][z]["PROCESSOR_VOLTAGE"]
      Finfosys.Label119.Text = " Codename: " & database["DATABASE"][z]["PROCESSOR_CODENAME"]
      Finfosys.Label120.Text = " Part: " & database["DATABASE"][z]["PROCESSOR_PART"]
      Finfosys.Label121.Text = " Memory support: " & database["DATABASE"][z]["PROCESSOR_MEMORYSUPPORT"]
      'Finfosys.PictureBox3.Picture = Picture["Database/Logos/81.gif"]
      i = z
      Break
    Endif
  Next
  Debug "Current position of processor = " & cpucache & " is = " & z & ""
End
