@@ -21,6 +21,7 @@ Public Class ClassLogService
2121 Public Shared ReadOnly LOG_ISSUE_DEVICE_TIMEOUT As String = "Device timed out"
2222 Public Shared ReadOnly LOG_ISSUE_SERVICE_LOG_INCOMPLETE As String = "PSMoveServiceEx log incomplete"
2323 Public Shared ReadOnly LOG_ISSUE_DEVICE_BAD_TRACKING As String = "Bad device tracking deviations"
24+ Public Shared ReadOnly LOG_ISSUE_CONFIG_CORRUPTION As String = "PSMoveServiceEx configuration corrupted"
2425
2526 Private g_mFormMain As FormMain
2627 Private g_ClassLogContent As ClassLogContent
@@ -127,6 +128,7 @@ Public Class ClassLogService
127128 mIssues.AddRange(CheckDeviceTimeout())
128129 mIssues.AddRange(CheckIncomplete())
129130 mIssues.AddRange(CheckBadDeviations())
131+ mIssues.AddRange(CheckServiceConfigCorruption())
130132 Return mIssues.ToArray
131133 End Function
132134
@@ -960,6 +962,44 @@ Public Class ClassLogService
960962 Return mIssues.ToArray
961963 End Function
962964
965+ Public Function CheckServiceConfigCorruption() As STRUC_LOG_ISSUE()
966+ Dim mIssues As New List( Of STRUC_LOG_ISSUE)
967+
968+ Dim sContent As String = GetSectionContent()
969+ If (sContent Is Nothing ) Then
970+ Return mIssues.ToArray
971+ End If
972+
973+ Dim mTemplate As New STRUC_LOG_ISSUE(
974+ LOG_ISSUE_CONFIG_CORRUPTION,
975+ "A service configuration file ({0}) got corrupted and is unable to get parsed by PSMoveServiceEx." ,
976+ "Factory Reset PSMoveServiceEx or delete the shown configuration file to fix the configuration. Do not shut down your computer while PSMoveServiceEx is running to avoid configuration corruption." ,
977+ ENUM_LOG_ISSUE_TYPE.ERROR
978+ )
979+
980+ Dim sLines As String () = sContent.Split( New String () {vbNewLine, vbLf}, 0 )
981+ For i = 0 To sLines.Length - 1
982+ Dim sLine As String = sLines(i)
983+
984+ If ( Not sLine.StartsWith( "[" )) Then
985+ Continue For
986+ End If
987+
988+ If (sLine.Contains( "EXCEPTION - PSMoveServiceEx" )) Then
989+ Dim mMatch As Match = Regex.Match(sLine, "EXCEPTION \- PSMoveServiceEx \- (?<File>(.*?)\.json)\([0-9]+\)\: expected value" , RegexOptions.IgnoreCase)
990+ If (mMatch.Success) Then
991+ Dim sConfigFile As String = mMatch.Groups( "File" ).Value
992+
993+ Dim mNewIssue As New STRUC_LOG_ISSUE(mTemplate)
994+ mNewIssue.sDescription = String .Format(mTemplate.sDescription, sConfigFile)
995+ mIssues.Add(mNewIssue)
996+ End If
997+ End If
998+ Next
999+
1000+ Return mIssues.ToArray
1001+ End Function
1002+
9631003 Public Function FindConfigFromSerial(sSerial As String ) As ClassServiceConfig
9641004 Dim mConfigs = GetConfigs()
9651005
0 commit comments