Fixed more problems with issue #98
This commit is contained in:
@@ -258,24 +258,6 @@ Public Class mgrCommon
|
||||
Return dFileSize
|
||||
End Function
|
||||
|
||||
Public Shared Function IsMatch(ByRef oGame As clsGame, ByRef sProcessCheck As String) As Boolean
|
||||
If oGame.IsRegEx Then
|
||||
Try
|
||||
If Regex.IsMatch(sProcessCheck, oGame.ProcessName) Then
|
||||
Return True
|
||||
End If
|
||||
Catch
|
||||
'Ignore malformed regular expressions that may have passed validation
|
||||
End Try
|
||||
Else
|
||||
If oGame.ProcessName = sProcessCheck Then
|
||||
Return True
|
||||
End If
|
||||
End If
|
||||
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Public Shared Function WildcardToRegex(ByVal sPattern As String) As String
|
||||
Dim sRegEx As String
|
||||
sRegEx = sPattern.Replace("*", ".*")
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports GBM.My.Resources
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Collections.Specialized
|
||||
Imports System.IO
|
||||
|
||||
@@ -88,7 +89,7 @@ Public Class mgrMonitorList
|
||||
Case eListTypes.ScanList
|
||||
For Each de As DictionaryEntry In hshList
|
||||
oCompareGame = DirectCast(de.Value, clsGame)
|
||||
If mgrCommon.IsMatch(oCompareGame, oGame.ProcessName) Then
|
||||
If Regex.IsMatch(oGame.ProcessName, oCompareGame.ProcessName) Or (oGame.ProcessName = oCompareGame.ProcessName) Then
|
||||
DirectCast(hshList.Item(oCompareGame.ProcessName), clsGame).Duplicate = True
|
||||
oGame.ProcessName = oGame.ProcessName & ":" & oGame.Name
|
||||
oGame.Duplicate = True
|
||||
|
||||
@@ -91,10 +91,7 @@ Public Class mgrProcesses
|
||||
sProcess = o.ProcessName.Split(":")(0)
|
||||
|
||||
If o.Duplicate = True And (sProcess = oGame.TrueProcess Or Regex.IsMatch(sProcess, oGame.TrueProcess)) Then
|
||||
If o.Parameter <> String.Empty And FullCommand.Contains(o.Parameter) Then
|
||||
oGame = o.ShallowCopy
|
||||
Return True
|
||||
ElseIf o.Parameter = String.Empty Then
|
||||
If (o.Parameter <> String.Empty And FullCommand.Contains(o.Parameter)) Or (o.Parameter = String.Empty And FullCommand = String.Empty) Then
|
||||
oDuplicateGames.Add(o.ShallowCopy)
|
||||
End If
|
||||
End If
|
||||
@@ -163,6 +160,24 @@ Public Class mgrProcesses
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function IsMatch(ByRef oGame As clsGame, ByRef sProcessCheck As String) As Boolean
|
||||
If oGame.IsRegEx Then
|
||||
Try
|
||||
If Regex.IsMatch(sProcessCheck, oGame.ProcessName) Then
|
||||
Return True
|
||||
End If
|
||||
Catch
|
||||
'Ignore malformed regular expressions that may have passed validation
|
||||
End Try
|
||||
Else
|
||||
If oGame.ProcessName = sProcessCheck Then
|
||||
Return True
|
||||
End If
|
||||
End If
|
||||
|
||||
Return False
|
||||
End Function
|
||||
|
||||
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
|
||||
@@ -200,7 +215,7 @@ Public Class mgrProcesses
|
||||
|
||||
'Detection Pass 1
|
||||
For Each oCurrentGame As clsGame In hshScanList.Values
|
||||
If mgrCommon.IsMatch(oCurrentGame, sProcessCheck) Then
|
||||
If IsMatch(oCurrentGame, sProcessCheck) Then
|
||||
prsFoundProcess = prsCurrent
|
||||
oGame = oCurrentGame.ShallowCopy
|
||||
bPass = True
|
||||
|
||||
Reference in New Issue
Block a user