Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'AVCS AIDA Diagnostic Report Readout System
- ' by SemlerPDX Mar2022
- ' VETERANS-GAMING.COM
- Imports Microsoft.VisualBasic
- Imports System
- Imports System.Collections
- Imports System.Collections.Generic
- Imports System.Data
- Imports System.Drawing
- Imports System.Diagnostics
- Imports System.Windows.Forms
- Imports System.Linq
- Imports System.Xml.Linq
- Imports System.Threading
- Imports System.Threading.Tasks
- Public Class VAInline
- dim countAtypicalLow as integer = 0
- dim countAtypicalHigh as integer = 0
- dim countTypical as integer = 0
- dim countTotal as integer = 0
- 'dim sensorsArray() as string = {"PercentCPU","PercentRAM","PercentGPU","PercentVRAM","TempMOBO","TempCPU","TempCPUD","TempCPUP","TempPCH","TempVRM","TempGPU","FanCPU","FanCPUO","FanPCH","FanTOP","FanREAR","FanGPU1","FanGPU2"}
- dim sensorsArray() as string = {"CPU_Use","dTa_CPU_temp","dTa_CPU_Diode_temp","dTa_CPU_Package_temp","CPU_fan","CPU_OPT_fan","Memory_Use","GPU_Use","Video_Memory_Use","dTa_GPU_temp","GPU_fan","dTa_Motherboard_temp","dTa_PCH_temp","PCH_fan","dTa_Southbridge_temp","Southbridge_fan","dTa_Northbridge_temp","Northbridge_fan","dTa_VRM_temp","VRM_fan","Intake_fan","Exhaust_fan","Top_fan","Rear_fan","Back_fan","Left_fan","Right_fan","Bottom_fan","Front_fan","Side_fan"}
- 'dim commandsArray() as string = {"CPU Usage","RAM Usage","GPU Usage","V RAM Usage","Motherboard Temp","CPU Temp","CPU Diode Temp","CPU Package Temp","Southbridge Temp","V R M Temp","GPU Temp","CPU Fan","ignore","P C H Fan","Top Case Fan","Rear case fan","GPU Fan","ignore"}
- dim commandsArray() as string = {"CPU Usage","CPU Temp","CPU Diode Temp","CPU Package Temp","CPU Fan","Optional CPU Fan","RAM Usage","GPU Usage","V RAM Usage","GPU Temp","GPU Fan","Motherboard Temp","PCH Temp","PCH Fan","Southbridge Temp","Southbridge Fan","Northbridge Temp","Northbridge Fan","V R M Temp","V R M Fan","Intake case fan","Exhaust case fan","Top case fan","Rear case fan","Back case fan","Left case fan","Right case fan","Bottom case fan","Front case fan","Side case fan"}
- dim sensorsAtypicalHigh as string = ""
- dim sensorsAtypicalLow as string = ""
- dim sensorsTypical as string = ""
- dim diagnosticLevel as integer = 0
- dim diagnoseSystem as string = ""
- dim diagnosticsDebugging as boolean = false
- dim diagnosticsTesting as boolean = false
- Public Sub ExecuteDiagnosticsLevel(ByVal diagnosticCount as integer, ByVal diagnosticSensors as string, ByVal andConjunctions as boolean)
- dim diagnosticSensorsArray() as string
- if ((diagnosticCount > 1) and (diagnosticSensors.Contains(",")))
- diagnosticSensorsArray = diagnosticSensors.Replace("ignore", "").Split(New String() {","}, StringSplitOptions.RemoveEmptyEntries)
- if (diagnoseSystem = "GPU")
- try
- VA.Command.Execute("How is the graphics card clock", true)
- catch
- if (diagnosticsDebugging)
- VA.WriteToLog("AVCS AIDA ERROR: at ExecuteDiagnosticsLevel (GPU) VA Proxy Command Execute...", "red")
- end if
- end try
- end if
- for i as integer = 0 to diagnosticSensorsArray.GetUpperBound(0)
- if (diagnosticsDebugging)
- VA.WriteToLog("sensorsArray(" + i.ToString() + ") = " + diagnosticSensorsArray(i).ToString(), "orange")
- VA.WriteToLog("sensorsArray Length = " + diagnosticSensorsArray.GetUpperBound(0).ToString(), "orange")
- end if
- if ((VA.GetBoolean("AVCS_SENS_Diagnostics_Active") isNot nothing) andAlso (VA.GetBoolean("AVCS_SENS_Diagnostics_Active")))
- try
- if ((i < diagnosticSensorsArray.GetUpperBound(0)) and (i > 0) and (i Mod 2 = 0) and (andConjunctions))
- VA.SetText("AVCS_SENS_TTS_WILDCARD", "[also,;and,;also,;;;;;;;]")
- VA.Command.Execute("F_SAY_TTS", true)
- elseif ((i = diagnosticSensorsArray.GetUpperBound(0)) and ((diagnosticSensorsArray.GetUpperBound(0) = 1) or (diagnosticSensorsArray.GetUpperBound(0) = 2)))
- VA.SetText("AVCS_SENS_TTS_WILDCARD", "and,")
- VA.Command.Execute("F_SAY_TTS", true)
- elseif ((i = diagnosticSensorsArray.GetUpperBound(0)) and (diagnosticSensorsArray.GetUpperBound(0) >= 3))
- VA.SetText("AVCS_SENS_TTS_WILDCARD", "and finally")
- VA.Command.Execute("F_SAY_TTS", true)
- end if
- VA.Command.Execute("How is the " + diagnosticSensorsArray(i), true)
- catch
- if (diagnosticsDebugging)
- VA.WriteToLog("AVCS AIDA ERROR: at VA Proxy Command Execute...", "red")
- end if
- end try
- end if
- next
- elseif (diagnosticCount = 1)
- if (diagnosticSensors <> "ignore")
- try
- diagnosticSensors = diagnosticSensors.Replace("," ,"")
- VA.Command.Execute("How is the " + diagnosticSensors, true)
- catch
- if (diagnosticsDebugging)
- VA.WriteToLog("AVCS AIDA ERROR: at VA Proxy Command Execute...", "red")
- end if
- end try
- end if
- else
- if (diagnosticCount = 0)
- try
- VA.SetText("AVCS_SENS_TTS_WILDCARD", "[we are;all systems are] [functioning within normal parameters;operating within normal parameters;operating at peak efficiency]; [we are;all systems are] [functioning within normal parameters;operating within normal parameters;operating at peak efficiency] [sir;captain;]")
- VA.Command.Execute("F_SAY_TTS", false)
- catch
- if (diagnosticsDebugging)
- VA.WriteToLog("AVCS AIDA ERROR: at VA Proxy Command Execute 'How are we doing'...", "red")
- end if
- end try
- end if
- if (diagnosticsDebugging)
- VA.WriteToLog("AVCS AIDA: No diagnostic data to report", "red")
- end if
- end if
- End Sub
- Public Sub Main()
- VA.SetBoolean("AVCS_SENS_Diagnostics_Active", true)
- if (VA.GetText("AVCS_SENS_DIAGNOSTIC_SENSORS") isNot nothing)
- sensorsArray = VA.GetText("AVCS_SENS_DIAGNOSTIC_SENSORS").Split(New String() {","}, StringSplitOptions.RemoveEmptyEntries)
- end if
- if (VA.GetText("AVCS_SENS_DIAGNOSTIC_COMMANDS") isNot nothing)
- commandsArray = VA.GetText("AVCS_SENS_DIAGNOSTIC_COMMANDS").Split(New String() {","}, StringSplitOptions.RemoveEmptyEntries)
- end if
- if ((VA.GetBoolean("AVCS_SENS_DebugDiagnostics") isNot nothing) andAlso (VA.GetBoolean("AVCS_SENS_DebugDiagnostics")))
- diagnosticsDebugging = true
- end if
- if (VA.GetText("AVCS_SENS_DIAGNOSTIC_SYSTEM") isNot nothing)
- diagnoseSystem = VA.GetText("AVCS_SENS_DIAGNOSTIC_SYSTEM")
- end if
- 'For each sensor noted as 'diagnostic', assemble current typical/atypical diagnostics data (if any)
- for i as integer = 0 to sensorsArray.GetUpperBound(0)
- if ((VA.GetBoolean("AVCS_SENS_ATYPICAL_" + sensorsArray(i)) isNot nothing) andAlso (VA.GetBoolean("AVCS_SENS_ATYPICAL_" + sensorsArray(i))))
- if (diagnoseSystem = "") or ((diagnoseSystem <> "") andAlso (((diagnoseSystem = "GPU") and ((commandsArray(i).StartsWith("GPU")) or (sensorsArray(i).EndsWith("VRAM")))) or ((diagnoseSystem = "CPU") and (commandsArray(i).StartsWith("CPU")))))
- sensorsAtypicalHigh = sensorsAtypicalHigh + commandsArray(i) + ","
- countAtypicalHigh += 1
- end if
- elseif ((VA.GetBoolean("AVCS_SENS_ATYPICAL_" + sensorsArray(i)) isNot nothing) andAlso (VA.GetBoolean("AVCS_SENS_ATYPICAL_" + sensorsArray(i)) = false))
- if (diagnoseSystem = "") or ((diagnoseSystem <> "") andAlso (((diagnoseSystem = "GPU") and ((commandsArray(i).StartsWith("GPU")) or (sensorsArray(i).EndsWith("VRAM")))) or ((diagnoseSystem = "CPU") and (commandsArray(i).StartsWith("CPU")))))
- sensorsAtypicalLow = sensorsAtypicalLow + commandsArray(i) + ","
- countAtypicalLow += 1
- end if
- elseif ((VA.GetBoolean("AVCS_SENS_ATYPICAL_" + commandsArray(i)) is nothing) andAlso (VA.GetDecimal("AVCS_SENS_LastAverage_" + sensorsArray(i)) isNot nothing))
- if (diagnoseSystem = "") or ((diagnoseSystem <> "") andAlso (((diagnoseSystem = "GPU") and ((commandsArray(i).StartsWith("GPU")) or (sensorsArray(i).EndsWith("VRAM")))) or ((diagnoseSystem = "CPU") and (commandsArray(i).StartsWith("CPU")))))
- countTypical += 1
- sensorsTypical = sensorsTypical + commandsArray(i) + ","
- end if
- end if
- next
- countTotal = countAtypicalHigh + countTypical + countAtypicalLow
- 'Testing Debug set (disregards actual atypical/typical status)
- 'diagnosticsTesting = true 'uncomment this line to use the Test Run button in Inline Function editor window
- if (diagnosticsTesting)
- VA.ClearLog()
- VA.WriteToLog("Total Count: " + countTotal.ToString(), "red")
- countAtypicalHigh += 1
- sensorsAtypicalHigh = sensorsAtypicalHigh + "CPU Temp" + ","
- countAtypicalHigh += 1
- sensorsAtypicalHigh = sensorsAtypicalHigh + "GPU Temp" + ","
- 'countAtypicalHigh += 1
- 'sensorsAtypicalHigh = sensorsAtypicalHigh + "Southbridge Temp" + ","
- VA.SetInt("AVCS_SENS_DIAGNOSTIC_LEVEL", 4)
- end if
- 'For use when not split, trim the final comma from the string, else let it be removed when split
- if (sensorsAtypicalHigh <> "")
- sensorsAtypicalHigh = sensorsAtypicalHigh.Substring(0, sensorsAtypicalHigh.Length - 1)
- end if
- if (sensorsAtypicalLow <> "")
- sensorsAtypicalLow = sensorsAtypicalLow.Substring(0, sensorsAtypicalLow.Length - 1)
- end if
- if (sensorsTypical <> "")
- sensorsTypical = sensorsTypical.Substring(0, sensorsTypical.Length - 1)
- end if
- 'Based on requested level, begin automated diagnostic command calls for any/all individual sensors of the requested level type
- if ((VA.GetInt("AVCS_SENS_DIAGNOSTIC_LEVEL") isNot nothing) andAlso (Integer.TryParse(VA.GetInt("AVCS_SENS_DIAGNOSTIC_LEVEL"), diagnosticLevel)))
- if (diagnosticsDebugging)
- VA.WriteToLog("Atypical High Sensors = " + sensorsAtypicalHigh, "green")
- VA.WriteToLog("Atypical High Sensor Count = " + countAtypicalHigh.ToString(), "green")
- VA.WriteToLog("Atypical Low Sensors = " + sensorsAtypicalLow, "green")
- VA.WriteToLog("Atypical Low Sensor Count = " + countAtypicalLow.ToString(), "green")
- VA.WriteToLog("Typical Sensor Count = " + countTypical.ToString(), "blue")
- VA.WriteToLog("diagnosticLevel = " + diagnosticLevel.ToString(), "green")
- end if
- 'Level 5 runs only AtypicalHigh if >=25% are High, 4 is any High, 3 is High+Low, and 2 is High+Typical+Low (all), 1 is Menu for (all)
- 'NEW DIAGNOSTIC LEVELS SYSTEM ===============================
- select case (diagnosticLevel)
- case 4
- ExecuteDiagnosticsLevel(countAtypicalHigh, sensorsAtypicalHigh, true)
- case 3
- sensorsAtypicalHigh = sensorsAtypicalHigh + "," + sensorsAtypicalLow
- countTotal = countAtypicalHigh + countAtypicalLow
- ExecuteDiagnosticsLevel(countTotal, sensorsAtypicalHigh, true)
- case 2
- sensorsTypical = sensorsAtypicalHigh + "," + sensorsTypical + "," + sensorsAtypicalLow
- ExecuteDiagnosticsLevel(countTotal, sensorsTypical, false)
- VA.SetBoolean("ungraceful_Exit", nothing)
- case 1
- VA.Command.Execute("F_AIDA_DIAGNOSE", false)
- if (diagnosticsDebugging)
- VA.WriteToLog("diagnoseSystem = " + diagnoseSystem.ToString(), "green")
- end if
- case else
- if (countAtypicalHigh >= countTotal/4)
- ExecuteDiagnosticsLevel(countAtypicalHigh, sensorsAtypicalHigh, true)
- else
- ExecuteDiagnosticsLevel(0, sensorsTypical, false)
- end if
- end select
- else
- if (diagnosticsDebugging)
- VA.WriteToLog("AVCS AIDA ERROR: Diagnostics Inline - TryParse Int or Variable error...", "red")
- end if
- end if
- VA.SetInt("AVCS_SENS_DIAGNOSTIC_LEVEL", nothing)
- VA.SetBoolean("AVCS_SENS_Diagnostics_Active", nothing)
- VA.SetBoolean("AVCS_SENS_Diagnosing", false)
- End Sub
- End Class
Add Comment
Please, Sign In to add comment