Fix for issue #90

This commit is contained in:
MikeMaximus
2017-06-25 11:38:25 -06:00
parent 4b0d4a62c8
commit 2548d0dceb
3 changed files with 26 additions and 23 deletions
+2 -4
View File
@@ -30,10 +30,8 @@ Public Class frmChooseGame
lstGameBox.DisplayMember = "Value" lstGameBox.DisplayMember = "Value"
For Each o As clsGame In Process.DuplicateList 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))
lstGameBox.Items.Add(New KeyValuePair(Of String, String)(o.ID, o.Name)) oGamesHash.Add(o.ID, o)
oGamesHash.Add(o.ID, o)
End If
Next Next
lstGameBox.SelectedIndex = 0 lstGameBox.SelectedIndex = 0
+1 -12
View File
@@ -1452,17 +1452,6 @@ Public Class frmMain
End Function 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() Private Sub CheckForSavedDuplicate()
For Each o As clsGame In oProcess.DuplicateList For Each o As clsGame In oProcess.DuplicateList
If o.ProcessPath.ToLower = oProcess.GameInfo.ProcessPath.ToLower And o.Parameter = String.Empty Then If o.ProcessPath.ToLower = oProcess.GameInfo.ProcessPath.ToLower And o.Parameter = String.Empty Then
@@ -1715,7 +1704,7 @@ Public Class frmMain
End If End If
If bContinue = True Then If bContinue = True Then
If Not CheckForParametersDuplicate() Then CheckForSavedDuplicate() CheckForSavedDuplicate()
If oProcess.Duplicate Then If oProcess.Duplicate Then
UpdateLog(frmMain_MultipleGamesDetected, oSettings.ShowDetectionToolTips) UpdateLog(frmMain_MultipleGamesDetected, oSettings.ShowDetectionToolTips)
UpdateStatus(frmMain_MultipleGamesDetected) UpdateStatus(frmMain_MultipleGamesDetected)
+23 -7
View File
@@ -81,18 +81,31 @@ Public Class mgrProcesses
End Set End Set
End Property End Property
Private Sub VerifyDuplicate(oGame As clsGame, hshScanList As Hashtable) Private Function HandleDuplicates(hshScanList As Hashtable) As Boolean
Dim sProcess As String Dim sProcess As String
bDuplicates = True bDuplicates = True
oDuplicateGames.Clear() oDuplicateGames.Clear()
For Each o As clsGame In hshScanList.Values For Each o As clsGame In hshScanList.Values
sProcess = o.ProcessName.Split(":")(0) sProcess = o.ProcessName.Split(":")(0)
If o.Duplicate = True And sProcess = oGame.TrueProcess Then 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 End If
Next 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 'This function will only work correctly on Windows
Private Sub GetWindowsCommand(ByVal prs As Process) Private Sub GetWindowsCommand(ByVal prs As Process)
@@ -193,15 +206,18 @@ Public Class mgrProcesses
End If End If
If oGame.Duplicate = True Then If oGame.Duplicate = True Then
VerifyDuplicate(oGame, hshScanList) If HandleDuplicates(hshScanList) Then
bDuplicates = False
oDuplicateGames.Clear()
End If
Else Else
bDuplicates = False bDuplicates = False
oDuplicateGames.Clear() oDuplicateGames.Clear()
End If End If
If oGame.Parameter <> String.Empty And Not oGame.Duplicate And Not FullCommand.Contains(oGame.Parameter) Then If Duplicate And DuplicateList.Count = 0 Then Return False
Return False
End If 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 If Not oGame.AbsolutePath Or oGame.Duplicate Then
Try Try