Skip to content

Commit 4807258

Browse files
committed
Add CheckMinimalRequirements()
1 parent a8906d8 commit 4807258

1 file changed

Lines changed: 62 additions & 1 deletion

File tree

PSMSVirtualDeviceManager/StartPage/TroubleshootIssueTracker/ClassLogDxdiag.vb

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Imports PSMSVirtualDeviceManager.ClassLogDiagnostics
1+
Imports System.Text.RegularExpressions
2+
Imports PSMSVirtualDeviceManager.ClassLogDiagnostics
23

34
Public Class ClassLogDxdiag
45
Implements ILogAction
@@ -9,6 +10,7 @@ Public Class ClassLogDxdiag
910
Public Shared ReadOnly LOG_ISSUE_BLUETOOTH_BANDWIDTH_DEVICES As String = "Possible Bluetooth bandwidth issues"
1011
Public Shared ReadOnly LOG_ISSUE_NOT_ENOUGH_USB_HOST_CONTROLLERS As String = "Not enough USB 3.0 Host Controllers"
1112
Public Shared ReadOnly LOG_ISSUE_USB_HOST_CONTROLLER As String = "USB 3.0 Host Controller"
13+
Public Shared ReadOnly LOG_ISSUE_MIN_SYSTEM_REQUIREMENT As String = "Minimum system requirements not met"
1214

1315
Private g_mFormMain As FormMain
1416
Private g_ClassLogContent As ClassLogContent
@@ -69,6 +71,7 @@ Public Class ClassLogDxdiag
6971
mIssues.AddRange(CheckEmpty())
7072
mIssues.AddRange(CheckMultipleBluetoothDevices())
7173
mIssues.AddRange(CheckMultipleUsbControllers())
74+
mIssues.AddRange(CheckMinimalRequirements())
7275
Return mIssues.ToArray
7376
End Function
7477

@@ -212,6 +215,64 @@ Public Class ClassLogDxdiag
212215
Return mIssues.ToArray
213216
End Function
214217

218+
Private Function CheckMinimalRequirements() As STRUC_LOG_ISSUE()
219+
Dim mIssues As New List(Of STRUC_LOG_ISSUE)
220+
221+
Dim sContent As String = GetSectionContent()
222+
If (sContent Is Nothing) Then
223+
Return mIssues.ToArray
224+
End If
225+
226+
Dim mTemplate As New STRUC_LOG_ISSUE(
227+
LOG_ISSUE_MIN_SYSTEM_REQUIREMENT,
228+
"This computer does not meet the recommended system requirements to run PSMoveServiceEx smoothly.",
229+
"It is time to upgrade.",
230+
ENUM_LOG_ISSUE_TYPE.ERROR
231+
)
232+
233+
Dim sLine As String = ""
234+
Dim iFoundCpuCore As Integer = -1
235+
Dim iFoundMemorySize As Integer = -1
236+
237+
Dim mHostControllers As New List(Of String)
238+
239+
Dim sLines As String() = FindSection("System Information", sContent)
240+
If (sLines Is Nothing OrElse sLines.Length < 1) Then
241+
Return mIssues.ToArray
242+
End If
243+
244+
For i = sLines.Length - 1 To 0 Step -1
245+
If (sLines(i).TrimStart.StartsWith("Processor:")) Then
246+
sLine = sLines(i).Trim
247+
248+
Dim mCpuMatch As Match = Regex.Match(sLine, "Processor\: (.*?) \((?<Cores>[0-9]+) CPUs\)\,", RegexOptions.IgnoreCase)
249+
If (mCpuMatch.Success) Then
250+
iFoundCpuCore = CInt(mCpuMatch.Groups("Cores").Value)
251+
End If
252+
253+
sLine = ""
254+
End If
255+
256+
If (sLines(i).TrimStart.StartsWith("Available OS Memory:")) Then
257+
sLine = sLines(i).Trim
258+
259+
Dim mMemoryMatch As Match = Regex.Match(sLine, "Available OS Memory\: (?<Memory>([0-9]+))MB RAM", RegexOptions.IgnoreCase)
260+
If (mMemoryMatch.Success) Then
261+
iFoundMemorySize = CInt(mMemoryMatch.Groups("Memory").Value)
262+
End If
263+
264+
sLine = ""
265+
End If
266+
Next
267+
268+
If ((iFoundCpuCore > -1 AndAlso iFoundCpuCore < 4) OrElse
269+
(iFoundMemorySize > -1 AndAlso iFoundMemorySize < (4 * 1024))) Then
270+
mIssues.Add(New STRUC_LOG_ISSUE(mTemplate))
271+
End If
272+
273+
Return mIssues.ToArray
274+
End Function
275+
215276
Public Function FindSection(sSection As String, ByRef sContent As String) As String()
216277
If (sContent Is Nothing) Then
217278
Return Nothing

0 commit comments

Comments
 (0)