Virtual-Mac/SysInfo.vb
Edson Armando 8b3286fe05
Little updates
New Mac Wizard working, and revamped, so now you choose emulator and OS. Thank to adespoton for the Mac compatibility matrix. (https://docs.google.com/spreadsheets/d/1us6SCBgVs8NqbxofJXTmHDeK3nKQJpcgya2nWC9_t2w/edit#gid=0)
Now PearPC files can be loaded and saved (I've taken code from PearPC Config File Generator and adapted it to Virtual Mac)
Still getting the challenge of dealing with BII and SheepShaver config files. Will upload new versions of files when they work.
Updated to 0.6.1 in file version, but technically it's 0.6.1 Beta (Or 0.6.1 RC, 0.6.0, not the final 0.6.1)
Now with some investigation, the app is "translated" to Spanish and German (Please forgive the bad German translation, I used GTranslate and Virtual PC as reference points for this). To change the language, go to File > Options > Language and select the new language. Note that German(de-DE) or Spanish(es-MX) might be loaded by default if you are using these languages in you Windows installation. Note that the translation is crap, and is not complete, so many parts are still in English. Will try to fix this in 0.7.1
Still need to fix Saving BII and SS files, so this is not final 0.6.1, will release a "revision" later.
2019-02-08 11:19:10 -06:00

86 lines
3.3 KiB
VB.net

Imports System.Management
Module SysInfo
Public OSName As String
Public OSBuild As String
Public CPUClass As String
Public CPUCores As String
Public InstalledRAM As String
Public UserName As String
Public ComputerName As String
Public Function GetSysInfo() As String
Dim VersionArray() As String = Split(My.Computer.Info.OSVersion, ".")
'Setting the labels with the versions
Dim BuildOS As String = VersionArray(0) + "." + VersionArray(1) + "." + VersionArray(2)
Dim NameOS As String = ""
Dim CPUInfo As String = GetProcessorInfo()
Dim NameCPU As String = CPUInfo.ToString.Substring(0, InStr(CPUInfo, ";") - 1)
Dim CoresCPU As String = CPUInfo.ToString.Substring(InStr(CPUInfo, ";"), InStr(CPUInfo, "_") - InStr(CPUInfo, ";") - 1)
Dim TotalRAM As Long = (My.Computer.Info.TotalPhysicalMemory / 1024) / 1024
Dim UsrName As String = Replace(Replace(My.User.Name, My.Computer.Name, ""), "\", "")
Dim PCName As String = My.Computer.Name
'Naming the Windows OS by its version
frmAbout.OSName.Text = "Unknown"
Select Case BuildOS
Case "6.0.6000"
NameOS = "Windows Vista RTM"
Case "6.0.6001"
NameOS = "Windows Vista SP1"
Case "6.0.6002"
NameOS = "Windows Vista SP2"
Case "6.1.7600"
NameOS = "Windows 7 RTM"
Case "6.1.7601"
NameOS = "Windows 7 SP1"
Case "6.2.9200"
NameOS = "Windows 8"
Case "6.2.9600"
NameOS = "Windows 8.1"
End Select
Select Case My.Computer.Info.OSVersion
Case "5.1.2600.0"
NameOS = "Windows XP RTM"
Case "5.1.2600.1106"
NameOS = "Windows XP SP1"
Case "5.1.2600.2180"
NameOS = "Windows XP SP2"
Case "5.1.2600.5512"
NameOS = "Windows XP SP3"
End Select
OSName = NameOS
OSBuild = BuildOS
CPUClass = NameCPU
CPUCores = CoresCPU
InstalledRAM = TotalRAM
UserName = UsrName
ComputerName = PCName
Return (NameOS + vbCrLf + BuildOS + vbCrLf + NameCPU + vbCrLf + CoresCPU + vbCrLf & TotalRAM & " MB" & vbCrLf + UsrName + vbCrLf + PCName)
End Function
Public Function GetProcessorInfo() As String
Dim Info As String = ""
Try
Dim searcher As New ManagementObjectSearcher( _
"root\CIMV2", _
"SELECT * FROM Win32_Processor")
For Each queryObj As ManagementObject In searcher.Get()
Info = queryObj("Name")
Info = Info & " (" & Replace(Replace(Replace(queryObj("Caption"), "Family ", "F"), "Model ", "M"), "Stepping ", "S") & ")"
Info = Info & ";" & queryObj("NumberOfCores")
Info = Info & "_" & queryObj("MaxClockSpeed")
Next
Catch err As ManagementException
MessageBox.Show("An error occurred while getting the processor info: " & err.Message & " . The system information may be incomplete", "Virtual Mac", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Return Info
End Function
End Module