I-Nex/I-Nex/i-nex/.src/FReport_Gen.class

192 lines
4.7 KiB
Plaintext

' Gambas class file
' Copyright(C) 2011-2014, Michał Głowienka aka eloaders <eloaders@linux.pl>
'
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
Public Sub Form_Open()
Dim PASTEBIN_SITES As String[] = Dir("/usr/share/pastebin.d/")
Dim Conf As Integer
If Exist("~/.i-nex/lastsave") Then
ButtonBox1.Text = File.Load("" & User.Home & "/.i-nex/lastsave")
Else
ButtonBox1.Text = Desktop.Path & "/report.txt"
Endif
For Conf = 0 To PASTEBIN_SITES.Count - 1
PASTEBIN_SITES[Conf] = Replace(PASTEBIN_SITES[Conf], ".conf", "")
Next
ComboBox1.List = PASTEBIN_SITES
ComboBox1.Index = 0
If Settings["Window/X"] = Null Then
Me.Center
Else
Try Me.X = Settings["Window/X", Me.X]
Try Me.Y = Settings["Window/Y", Me.Y]
Endif
End
Public Sub Button1_Click()
'Before generate report. Old report must be removed
Try Kill ButtonBox1.Text
'Check Value, select report to be generated.
If CheckBox1.Value = True Then
Object.Call(MCPU_REPORT, "_inits")
Endif
If CheckBox22.Value = True Then
Object.Call(FCPUID_REPORT, "_inits")
Endif
If CheckBox3.Value = True Then
Object.Call(MGPU_REPORT, "_inits")
Endif
If CheckBox2.Value = True Then
Object.Call(MMOBO_REPORT, "_inits")
Endif
If CheckBox4.Value = True Then
Object.Call(MSOUND_REPORT, "_inits")
Endif
If CheckBox5.Value = True Then
Object.Call(MSYSTEM_REPORT, "_inits")
Endif
If CheckBox12.Value = True Then
Object.Call(MKERNEL_REPORT, "_inits")
Endif
If CheckBox14.value = True Then
Object.Call(MDRIVES_REPORT, "_inits")
Endif
If CheckBox6.Value = True Then
Object.Call(MInclude, "_lspci")
Endif
If CheckBox7.Value = True Then
Object.Call(MInclude, "_lsusb")
Endif
If CheckBox8.Value = True Then
Object.Call(MInclude, "_scsi")
Endif
If CheckBox15.Value = True Then
Object.Call(MInclude, "_mtrr")
Endif
If CheckBox16.Value = True Then
Object.Call(MInclude, "_devices")
Endif
If CheckBox17.Value = True Then
Object.Call(MInclude, "_diskstats")
Endif
If CheckBox18.Value = True Then
Object.Call(MInclude, "_dma")
Endif
If CheckBox10.Value = True Then
Object.Call(MInclude, "_partitions")
Endif
If CheckBox19.Value = True Then
Object.Call(MInclude, "_modules")
Endif
If CheckBox20.Value = True Then
Object.Call(MInclude, "_cmdline")
Endif
If CheckBox21.Value = True Then
Object.Call(MInclude, "_grub")
Endif
If CheckBox9.Value = True Then
Object.Call(MInclude, "_dmesg")
Endif
If CheckBox23.Value = True Then
Object.Call(MInclude, "_cpuinfo")
Endif
If CheckBox11.Value = True Then
TextBox1.Text = MPastebinit.pastebin(True, ButtonBox1.Text, ComboBox1.Text)
Endif
If CheckBox13.value = True And CheckBox11.Value = False Then
Form_Close()
Endif
End
Public Sub ButtonBox1_Click()
Dim savefile As String
If ChkPrm.ChkExec("kdialog") = True Then
Exec ["kdialog", "--getsaveurl", "~/", ".txt"] Wait To savefile
Else If ChkPrm.ChkExec("yad") = True Then
Exec ["yad", "--width=600", "--height=500", "--align=center", "--file-selection", "--filename=report.txt", "--file-filter=*.txt"] Wait To savefile
Else If ChkPrm.ChkExec("zenity") = True Then
Exec ["zenity", "--file-selection", "--confirm-overwrite", "--filename=report.txt", "--file-filter=*.txt"] Wait To savefile
Else
Dialog.Title = "Choose a file"
Dialog.Filter = ["*.txt", "Text files"]
Dialog.SaveFile
ButtonBox1.Text = Dialog.Path
Endif
If savefile Begins "file:" Then
ButtonBox1.Text = Replace(savefile, "file://", "")
Endif
If Exist(ButtonBox1.Text, True) Then
Try Kill ButtonBox1.Text
Endif
End
Public Sub Button2_Click()
Form_Close()
End
Public Sub Button3_Click()
If TextBox1.Text Like "*http*" Then
Desktop.Open(TextBox1.Text)
Else
Debug "Pastebin link not detect"
Message.Warning("Please select the Send to pastebin and then click on the generate button.\nThis will take you to pastebin site. ")
Endif
End
Public Sub Button4_Click()
If TextBox1.Text = Null Then
Message.Error("Nothing to copy, \nplease first generate report and select: \nSend to nopaste service", "OK")
Else
Clipboard.Copy(TextBox1.Text)
Endif
End
Public Sub Form_Close()
File.Save("" & User.Home & "/.i-nex/lastsave", ButtonBox1.Text)
Me.Close
End