diff --git a/GBM/Forms/frmChooseGame.vb b/GBM/Forms/frmChooseGame.vb index a0690dc..f79125e 100644 --- a/GBM/Forms/frmChooseGame.vb +++ b/GBM/Forms/frmChooseGame.vb @@ -30,10 +30,8 @@ Public Class frmChooseGame lstGameBox.DisplayMember = "Value" For Each o As clsGame In Process.DuplicateList - If o.Parameter = String.Empty Then - lstGameBox.Items.Add(New KeyValuePair(Of String, String)(o.ID, o.Name)) - oGamesHash.Add(o.ID, o) - End If + lstGameBox.Items.Add(New KeyValuePair(Of String, String)(o.ID, o.Name)) + oGamesHash.Add(o.ID, o) Next lstGameBox.SelectedIndex = 0 diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 58baad7..bdbfd2a 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -1452,17 +1452,6 @@ Public Class frmMain End Function - Private Function CheckForParametersDuplicate() As Boolean - For Each o As clsGame In oProcess.DuplicateList - If o.Parameter <> String.Empty And oProcess.FullCommand.Contains(o.Parameter) Then - oProcess.GameInfo = o - oProcess.Duplicate = False - Return True - End If - Next - Return False - End Function - Private Sub CheckForSavedDuplicate() For Each o As clsGame In oProcess.DuplicateList If o.ProcessPath.ToLower = oProcess.GameInfo.ProcessPath.ToLower And o.Parameter = String.Empty Then @@ -1715,7 +1704,7 @@ Public Class frmMain End If If bContinue = True Then - If Not CheckForParametersDuplicate() Then CheckForSavedDuplicate() + CheckForSavedDuplicate() If oProcess.Duplicate Then UpdateLog(frmMain_MultipleGamesDetected, oSettings.ShowDetectionToolTips) UpdateStatus(frmMain_MultipleGamesDetected) diff --git a/GBM/Managers/mgrProcesses.vb b/GBM/Managers/mgrProcesses.vb index dc4e119..04efb92 100644 --- a/GBM/Managers/mgrProcesses.vb +++ b/GBM/Managers/mgrProcesses.vb @@ -81,18 +81,31 @@ Public Class mgrProcesses End Set End Property - Private Sub VerifyDuplicate(oGame As clsGame, hshScanList As Hashtable) + Private Function HandleDuplicates(hshScanList As Hashtable) As Boolean Dim sProcess As String bDuplicates = True oDuplicateGames.Clear() + For Each o As clsGame In hshScanList.Values sProcess = o.ProcessName.Split(":")(0) If o.Duplicate = True And sProcess = oGame.TrueProcess Then - oDuplicateGames.Add(o.ShallowCopy) + If o.Parameter <> String.Empty And FullCommand.Contains(o.Parameter) Then + oGame = o.ShallowCopy + Return True + ElseIf o.Parameter = String.Empty Then + oDuplicateGames.Add(o.ShallowCopy) + End If End If Next - End Sub + + If oDuplicateGames.Count = 1 Then + oGame = DirectCast(oDuplicateGames(0), clsGame).ShallowCopy + Return True + End If + + Return False + End Function 'This function will only work correctly on Windows Private Sub GetWindowsCommand(ByVal prs As Process) @@ -193,15 +206,18 @@ Public Class mgrProcesses End If If oGame.Duplicate = True Then - VerifyDuplicate(oGame, hshScanList) + If HandleDuplicates(hshScanList) Then + bDuplicates = False + oDuplicateGames.Clear() + End If Else bDuplicates = False oDuplicateGames.Clear() End If - If oGame.Parameter <> String.Empty And Not oGame.Duplicate And Not FullCommand.Contains(oGame.Parameter) Then - Return False - End If + If Duplicate And DuplicateList.Count = 0 Then Return False + + If oGame.Parameter <> String.Empty And Not Duplicate And Not FullCommand.Contains(oGame.Parameter) Then Return False If Not oGame.AbsolutePath Or oGame.Duplicate Then Try