Fixed wine detection, it wasn't able to handle duplicates
This commit is contained in:
+18
-22
@@ -1940,12 +1940,11 @@ Public Class frmMain
|
||||
|
||||
Private Sub ScanTimerEventProcessor(myObject As Object, ByVal myEventArgs As EventArgs) Handles tmScanTimer.Tick
|
||||
Dim bNeedsPath As Boolean = False
|
||||
Dim bWineProcess As Boolean = False
|
||||
Dim bContinue As Boolean = True
|
||||
Dim iErrorCode As Integer = 0
|
||||
Dim sErrorMessage As String = String.Empty
|
||||
|
||||
If oProcess.SearchRunningProcesses(hshScanList, bNeedsPath, bWineProcess, iErrorCode, bProcessDebugMode) Then
|
||||
If oProcess.SearchRunningProcesses(hshScanList, bNeedsPath, iErrorCode, bProcessDebugMode) Then
|
||||
PauseScan(True)
|
||||
|
||||
If bNeedsPath Then
|
||||
@@ -1975,30 +1974,18 @@ Public Class frmMain
|
||||
End If
|
||||
End If
|
||||
|
||||
If bWineProcess Then
|
||||
'Attempt a path conversion if the game configuration is using an absolute windows path that we can convert
|
||||
If mgrVariables.CheckForReservedVariables(oProcess.GameInfo.TruePath) Then
|
||||
'We need to determine this Wine information and store it before the process ends.
|
||||
If oProcess.WineProcess Then
|
||||
Dim oWineData As New clsWineData
|
||||
oWineData.MonitorID = oProcess.GameInfo.ID
|
||||
oWineData.Prefix = mgrPath.GetWinePrefix(oProcess.FoundProcess)
|
||||
oWineData.BinaryPath = Path.GetDirectoryName(oProcess.FoundProcess.MainModule.FileName)
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_WineBinaryPath, New String() {oProcess.GameInfo.Name, oWineData.BinaryPath}), False)
|
||||
If Not oWineData.Prefix = String.Empty Then
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_WinePrefix, New String() {oProcess.GameInfo.Name, oWineData.Prefix}), False)
|
||||
oWineData.SavePath = mgrPath.GetWineSavePath(oWineData.Prefix, oProcess.GameInfo.TruePath)
|
||||
If Not oWineData.SavePath = oProcess.GameInfo.TruePath Then
|
||||
oProcess.GameInfo.TruePath = oWineData.SavePath
|
||||
oProcess.WineData = oWineData
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_WineSavePath, New String() {oProcess.GameInfo.Name, oWineData.SavePath}), False)
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_WinePrefix, New String() {oProcess.GameInfo.Name, oWineData.Prefix}), False)
|
||||
Else
|
||||
bContinue = False
|
||||
End If
|
||||
Else
|
||||
bContinue = False
|
||||
End If
|
||||
End If
|
||||
'This does required mods to include/exclude data and relative paths (if required)
|
||||
mgrPath.ModWinePathData(oProcess.GameInfo)
|
||||
End If
|
||||
|
||||
If bContinue = True Then
|
||||
@@ -2074,12 +2061,22 @@ Public Class frmMain
|
||||
If bContinue Then
|
||||
If DoMultiGameCheck() Then
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_GameEnded, oProcess.GameInfo.Name), False)
|
||||
If oProcess.WineProcess Then
|
||||
'Attempt a path conversion if the game configuration is using an absolute windows path that we can convert
|
||||
If mgrVariables.CheckForReservedVariables(oProcess.GameInfo.TruePath) Then
|
||||
oProcess.WineData.MonitorID = oProcess.GameInfo.ID
|
||||
oProcess.WineData.SavePath = mgrPath.GetWineSavePath(oProcess.WineData.Prefix, oProcess.GameInfo.TruePath)
|
||||
If Not oProcess.WineData.SavePath = oProcess.GameInfo.TruePath Then
|
||||
oProcess.GameInfo.TruePath = oProcess.WineData.SavePath
|
||||
mgrWineData.DoWineDataAddUpdate(oProcess.WineData)
|
||||
UpdateLog(mgrCommon.FormatString(frmMain_WineSavePath, New String() {oProcess.GameInfo.Name, oProcess.WineData.SavePath}), False)
|
||||
End If
|
||||
End If
|
||||
'This does required mods to include/exclude data and relative paths (if required)
|
||||
mgrPath.ModWinePathData(oProcess.GameInfo)
|
||||
End If
|
||||
If oSettings.TimeTracking Then HandleTimeSpent()
|
||||
If oSettings.SessionTracking Then HandleSession()
|
||||
If Not oProcess.WineData Is Nothing Then
|
||||
oProcess.WineData.MonitorID = oProcess.GameInfo.ID
|
||||
mgrWineData.DoWineDataAddUpdate(oProcess.WineData)
|
||||
End If
|
||||
RunBackup()
|
||||
Else
|
||||
UpdateLog(frmMain_UnknownGameEnded, False)
|
||||
@@ -2094,7 +2091,6 @@ Public Class frmMain
|
||||
bPathDetectionFailure = False
|
||||
sPathDetectionError = String.Empty
|
||||
bCancelledByUser = False
|
||||
oProcess.WineData = Nothing
|
||||
oProcess.StartTime = Now : oProcess.EndTime = Now
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ Public Class mgrProcessDetection
|
||||
Private dStartTime As DateTime = Now, dEndTime As DateTime = Now
|
||||
Private lTimeSpent As Long = 0
|
||||
Private oGame As clsGame
|
||||
Private bWineProcess As Boolean = False
|
||||
Private oWineData As clsWineData
|
||||
Private oDuplicateGames As New ArrayList
|
||||
Private bDuplicates As Boolean
|
||||
@@ -64,6 +65,15 @@ Public Class mgrProcessDetection
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property WineProcess As Boolean
|
||||
Get
|
||||
Return bWineProcess
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
bWineProcess = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property WineData As clsWineData
|
||||
Get
|
||||
Return oWineData
|
||||
@@ -167,7 +177,7 @@ Public Class mgrProcessDetection
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Private Function GetProcessPath(ByVal bWineProcess As Boolean) As String
|
||||
Private Function GetProcessPath() As String
|
||||
Try
|
||||
If Not bWineProcess Then
|
||||
Return Path.GetDirectoryName(FoundProcess.MainModule.FileName)
|
||||
@@ -179,7 +189,7 @@ Public Class mgrProcessDetection
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub FilterDetected(ByVal oDetectedGames As ArrayList, ByVal bWineProcess As Boolean)
|
||||
Private Sub FilterDetected(ByVal oDetectedGames As ArrayList)
|
||||
Dim bMatch As Boolean = False
|
||||
Dim sFullCommand As String
|
||||
Dim oNotDetectedWithParameters As New ArrayList
|
||||
@@ -195,7 +205,7 @@ Public Class mgrProcessDetection
|
||||
End If
|
||||
|
||||
'Get Process Path
|
||||
ProcessPath = GetProcessPath(bWineProcess)
|
||||
ProcessPath = GetProcessPath()
|
||||
|
||||
'Look for any games using parameters and any matches
|
||||
For Each oDetectedGame As clsGame In oDetectedGames
|
||||
@@ -258,7 +268,7 @@ Public Class mgrProcessDetection
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function SearchRunningProcesses(ByVal hshScanList As Hashtable, ByRef bNeedsPath As Boolean, ByRef bWineProcess As Boolean, ByRef iErrorCode As Integer, ByVal bDebugMode As Boolean) As Boolean
|
||||
Public Function SearchRunningProcesses(ByVal hshScanList As Hashtable, ByRef bNeedsPath As Boolean, ByRef iErrorCode As Integer, ByVal bDebugMode As Boolean) As Boolean
|
||||
Dim prsList() As Process = Process.GetProcesses
|
||||
Dim sProcessCheck As String = String.Empty
|
||||
Dim sProcessList As String = String.Empty
|
||||
@@ -302,7 +312,7 @@ Public Class mgrProcessDetection
|
||||
Next
|
||||
|
||||
If oDetectedGames.Count > 0 Then
|
||||
FilterDetected(oDetectedGames, bWineProcess)
|
||||
FilterDetected(oDetectedGames)
|
||||
End If
|
||||
|
||||
If oDetectedGames.Count > 0 Then
|
||||
|
||||
Reference in New Issue
Block a user