' Gambas module file

' 
Public Sub _generate(cpu As Boolean, mobo As Boolean, graphic As Boolean, sound As Boolean, save_dir As String)
 Dim i As Float
 Dim isnd As Float
  If cpu = True Then
   TextInfo("Generate information about Processor")
   PBV(0.3)
   Wait 0.1
   TextInfo("Generate information about Processor")
   PBV(0.5)
   Shell "cat /proc/cpuinfo >>" & save_dir & ""
   TextInfo("Generate information about Processor")
   PBV(0.7)
   Wait 0.1
   TextInfo("Generate information about Processor")
   PBV(0.9)
  Endif
 If mobo = True Then
  Shell "echo '======================Motherboard / Bios=====================' >>" & save_dir & "" 
  Wait 0.1
  TextInfo("Generate Motherboard / Bios information")
  PBV(0.1)
  Shell "echo '___ Motherboard ___' >>" & save_dir & "" 
  Wait 0.1
  TextInfo("Generate Motherboard / Bios information...")
  PBV(0.2)
  Shell "echo 'Manufacturer: " & Finfosys.TextBox23.Text & "' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Motherboard / Bios information... ...")
  PBV(0.3)
  Shell "echo 'Model:        " & Finfosys.TextBox24.Text & "' >>" & save_dir & "" 
  Wait 0.1
  TextInfo("Generate Motherboard / Bios information... ... ...")
  PBV(0.4)
  Shell "echo '______ Bios ______' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Motherboard / Bios information... ... ... ...")
  PBV(0.5)
  Shell "echo 'Manufacturer: " & Finfosys.TextBox25.Text & "' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Motherboard / Bios information... ... ... ...")
  PBV(0.6)
  Shell "echo 'Date:         " & Finfosys.TextBox27.Text & "' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Motherboard / Bios information... ... ... ... ...")
  PBV(0.7)
  Shell "echo 'Version:      " & Finfosys.TextBox26.Text & "' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Motherboard / Bios information... ... ... ... ...")
  PBV(0.8)
  Shell "echo '====================Motherboard / Bios End===================' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Motherboard / Bios information... ... ... ... ... ...")
  PBV(0.9)
  Shell "echo '' >>" & save_dir & "" 
  Wait 0.1
  TextInfo("Generate Motherboard / Bios information... ... ... ... ... ... Done")
  PBV(1)
 Endif
 If graphic = True Then
  Shell "echo '=========================Graphic Tab=========================' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Graphic Tab information")
  PBV(0.2)
  Shell "echo 'Graphics card:      " & Finfosys.TextBox1.Text & "' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Graphic Tab information...")
  PBV(0.5)
  Shell "echo '" & Finfosys.Label64.Text & "' >>" & save_dir & ""
  Wait 0.1
  Shell "echo '" & Finfosys.Label146.Text & "' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Graphic Tab information...")
  PBV(0.3)
  Shell "echo '" & Finfosys.Label105.Text & "' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Graphic Tab information... ...")
  PBV(0.5)
  Shell "echo '" & Finfosys.Label106.Text & "' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Graphic Tab information... ... ...")
  PBV(0.6)
  Shell "echo '" & Finfosys.Label107.Text & "' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Graphic Tab information... ... ... ...")
  PBV(0.7)
  Shell "echo '" & Finfosys.Label108.Text & "' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Graphic Tab information... ... ... ...")
  PBV(0.7)
  Shell "echo 'Min / Max resolutions: " & Finfosys.Label109.Text & "' >>" & save_dir & ""
  TextInfo("Generate Graphic Tab information... ... ... ... ...")
  PBV(0.8)
  Shell "echo '======================Graphic Tab End========================' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Graphic Tab information... ... ... ... ... ...")
  PBV(0.9)
  Shell "echo '' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate Graphic Tab information... ... ... ... ... ... Done")
  PBV(1)
 Endif
 If sound = True Then
  For isnd = 0 To Finfosys.ComboBox6.Count - 1
  Wait 0.1
  TextInfo("Generate information about Sound card" & isnd)
  PBV(0.5)
  Shell "echo '===================== Sound Tab " & Finfosys.ComboBox6.Text & " =======================' >>" & save_dir & ""
  Wait 0.1
  PBV(0.1)
  Shell "echo 'Version: " & Asound_Drives.Version & "' >>" & save_dir & ""
  Wait 0.1
  PBV(0.2)
  Shell "echo 'Id:      " & Asound_Drives.Id & "' >>" & save_dir & ""
  Wait 0.1
  TextInfo("Generate information about Sound card" & isnd & "...")
  PBV(0.3)
  Shell "echo 'Codec:   " & Asound_Drives.Codec & "' >>" & save_dir & ""
  Wait 0.1
  PBV(0.4)
  Shell "echo 'Modules: " & Asound_Drives.Modules & "' >>" & save_dir & ""
  Wait 0.1
  PBV(0.5)
  TextInfo("Generate information about Sound card" & isnd & "... ...")
  Shell "echo 'HWdep:   " & Asound_Drives.hwdep & "' >>" & save_dir & ""
  Wait 0.1
  PBV(0.6)
  Shell "echo 'PCM:     " & Asound_Drives.pcm & "' >>" & save_dir & ""
  Wait 0.1
  PBV(0.7)
  Shell "echo 'Cards:   " & Asound_Drives.sound_cards & "' >>" & save_dir & ""
  Wait 0.1
  PBV(0.8)
  TextInfo("Generate information about Sound card" & isnd & "... ... ...")
  Shell "echo 'Devices: " & Asound_Drives.Devices & "' >>" & save_dir & ""
  Wait 0.1
  PBV(0.9)
  Shell "echo '===================== Sound Tab " & Finfosys.ComboBox6.Text & " End ===================' >>" & save_dir & ""
  Wait 0.1
  PBV(0.95)
  Shell "echo '' >>" & save_dir & ""
  Wait 0.1
  PBV(1)
  TextInfo("Generate information about Sound card" & isnd & "... ... ... Done")
  Finfosys.ComboBox6.Text = "card" & (Finfosys.ComboBox6.Count - 1)
  Wait 0.1
  Next
 Endif
 'Motherboard
End

Public Sub include(lspci As Boolean, lsusb As Boolean, scsi As Boolean, dmesg As Boolean, save_dir As String)
 If lspci = True Then
  TextInfo("Include lspci information")
  Wait 0.1
  PBV(0.1)
  TextInfo("Include lspci information ...")
  Shell "echo '' >>" & save_dir & ""
  Wait 0.1
  PBV(0.2)
  TextInfo("Include lspci information ... ...")
  Shell "echo '============================ LSPCI ==========================' >>" & save_dir & ""
  Wait 0.1
  PBV(0.4)
  TextInfo("Include lspci information ... ...")
  Shell "" & ChkPrm.ChkExecDir("lspci") & " >>" & save_dir & "" Wait
  Wait 0.1
  PBV(0.5)
  TextInfo("Include lspci information ... ...")
  Shell "echo '========================== LSPCI END =========================' >>" & save_dir & ""
  Wait 0.1
  PBV(0.7)
  TextInfo("Include lspci information ... ... ...")
  Shell "echo '' >>" & save_dir & ""
  Wait 0.1
  PBV(0.8)
  TextInfo("Include lspci information ... ... ... Done")
  PBV(1)
 Endif
 If lsusb = True Then
  TextInfo("Include lsusb information")
  Wait 0.1
  PBV(0.2)
  TextInfo("Include lsusb information ...")
  Shell "echo '' >>" & save_dir & ""
  Wait 0.1
  PBV(0.5)
  TextInfo("Include lsusb information ... ...")
  Shell "echo '============================ LSUSB ==========================' >>" & save_dir & ""
  Wait 0.1
  Shell "lsusb >>" & save_dir & "" Wait
  Wait 0.1
  PBV(0.7)
  TextInfo("Include lsusb information ... ... ...")
  Shell "echo '========================== LSUSB END =========================' >>" & save_dir & ""
  Wait 0.1
  Shell "echo '' >>" & save_dir & ""
  Wait 0.1
  PBV(0.8)
  TextInfo("Include lsusb information ... ... ... Done")
  PBV(1)
 Endif
 If scsi = True Then
  Shell "echo '' >>" & save_dir & ""
  Wait 0.1
  PBV(0.2)
  TextInfo("Include SCSI information")
  Shell "echo '========================== SCSI ==============================' >>" & save_dir & ""
  Wait 0.1
  PBV(0.4)
  TextInfo("Include SCSI information...")
  Shell "cat /proc/scsi/scsi >>" & save_dir & "" Wait
  Wait 0.1
  PBV(0.6)
  TextInfo("Include SCSI information... ...")
  Shell "echo '======================== SCSI END ============================' >>" & save_dir & ""
  Wait 0.1
  PBV(0.8)
  TextInfo("Include SCSI information... ... ...")
  Shell "echo '' >>" & save_dir & ""
  Wait 0.1
  PBV(1)
  TextInfo("Include SCSI information... ... ... Done")
 Endif
 If dmesg = True Then
  TextInfo("Include dmesg information")
  Shell "echo '' >>" & save_dir & ""
  Wait 0.1
  PBV(0.2)
  TextInfo("Include dmesg information...")
  Shell "echo '======================== DMESG ===============================' >>" & save_dir & ""
  Wait 0.1
  PBV(0.4)
  TextInfo("Include dmesg information... ...")
  Shell "dmesg >>" & save_dir & "" Wait
  Wait 0.1
  PBV(0.6)
  TextInfo("Include dmesg information... ... ...")
  Shell "echo '======================== DMESG END ===========================' >>" & save_dir & ""
  Wait 0.1
  PBV(0.8)
  TextInfo("Include dmesg information... ... ... ...")
  Shell "echo '' >>" & save_dir & ""
  Wait 0.1
  PBV(1)
  TextInfo("Include dmesg information... ... ... ... Done")
  Wait 0.1
 Endif
End

Public Sub desktop_support(unity As Boolean, save_dir As String)
  If unity = True Then
  TextInfo("Include Unity Support Test")
  Shell "echo '' >>" & save_dir & ""
  Wait 0.1
  PBV(0.2)
  TextInfo("Include Unity Support Test...")
  Shell "echo '==================== Unity Support Test ======================' >>" & save_dir & ""
  Wait 0.1
  PBV(0.4)
  TextInfo("Include Unity Support Test... ...")
  Shell "/usr/lib/nux/unity_support_test -p >>" & save_dir & "" Wait
  Wait 0.1
  PBV(0.6)
  TextInfo("Include Unity Support Test... ... ...")
  Shell "echo '================== Unity Support Test End=====================' >>" & save_dir & ""
  Wait 0.1
  PBV(0.8)
  TextInfo("Include Unity Support Test... ... ... ...")
  Shell "echo '' >>" & save_dir & ""
  Wait 0.1
  PBV(1)
  TextInfo("Include Unity Support Test... ... ... ... Done")
  Endif
End

Public Function pastebin(Send As Boolean, Directory As String, Service As String) As String
  Dim links As String
  If Send = True Then
  PBV(0.3)
  Wait 0.1
  TextInfo("Send report to " & FReport_Gen.ComboBox1.Text & "")
  PBV(0.5)
  Wait 0.1
  Shell "cat " & Directory & " | /usr/share/i-nex/pastebinit/pastebinit -b http://" & Service & "" Wait To links
  PBV(0.7)
  links = Replace(links, "\n", "")
  PBV(0.8)
  TextInfo("Send report to " & FReport_Gen.ComboBox1.Text & " Done")
  PBV(1)
  Return links
  Else
  Debug "Report not be send to nopaste service"
  Endif
End

Public Sub TextInfo(Text As String)
 
 FReport_Gen.TextLabel1.Text = Text
 
End

Public Sub PBV(ProgressBar_Value As Float)
 
 FReport_Gen.ProgressBar1.Value = ProgressBar_Value
 
End
