diff --git a/GBM/Forms/frmGameManager.Designer.vb b/GBM/Forms/frmGameManager.Designer.vb index 7fc5ea4..6626e59 100644 --- a/GBM/Forms/frmGameManager.Designer.vb +++ b/GBM/Forms/frmGameManager.Designer.vb @@ -245,7 +245,7 @@ Partial Class frmGameManager 'lblLimit ' Me.lblLimit.AutoSize = True - Me.lblLimit.Location = New System.Drawing.Point(376, 160) + Me.lblLimit.Location = New System.Drawing.Point(376, 157) Me.lblLimit.Name = "lblLimit" Me.lblLimit.Size = New System.Drawing.Size(68, 13) Me.lblLimit.TabIndex = 17 diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 1396440..7b4cc83 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -1311,6 +1311,15 @@ Public Class frmGameManager End If End If + If oApp.IsRegEx Then + If Not mgrCommon.IsRegExValid(oApp.ProcessName) Then + If mgrCommon.ShowMessage(frmGameManager_ErrorRegExFailure, MsgBoxStyle.Exclamation, MsgBoxStyle.YesNoCancel) = MsgBoxResult.Yes Then + Process.Start(mgrCommon.FormatString(AppURL_RegExr, oApp.ProcessName)) + End If + Return False + End If + End If + Return True End Function diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index fa59326..d642bdc 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -274,6 +274,16 @@ Public Class mgrCommon Return False End Function + Public Shared Function IsRegExValid(ByVal sPattern As String) As Boolean + Dim oRegEx As Regex + Try + oRegEx = New Regex(sPattern) + Return True + Catch ex As Exception + Return False + End Try + End Function + 'Calculate the current size of a folder Public Shared Function GetFolderSize(ByVal sPath As String, ByVal sInclude As String(), ByVal sExclude As String()) As Long Dim oFolder As DirectoryInfo diff --git a/GBM/Managers/mgrProcesses.vb b/GBM/Managers/mgrProcesses.vb index 1e5a70f..4aa0046 100644 --- a/GBM/Managers/mgrProcesses.vb +++ b/GBM/Managers/mgrProcesses.vb @@ -164,16 +164,13 @@ Public Class mgrProcesses End Function Private Function IsMatch(ByRef oGame As clsGame, ByRef sProcessCheck As String) As Boolean - Dim oProcessRegEx As Regex - If oGame.IsRegEx Then Try - oProcessRegEx = New Regex(oGame.ProcessName) - If oProcessRegEx.IsMatch(sProcessCheck) Then + If Regex.IsMatch(sProcessCheck, oGame.ProcessName) Then Return True End If Catch - 'Ignore malformed regular expressions + 'Ignore malformed regular expressions that may have passed validation End Try Else If oGame.ProcessName = sProcessCheck Then diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 3b20572..891c4dc 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -177,6 +177,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to http://regexr.com/?expression=[PARAM]&text=test. + ''' + Friend ReadOnly Property AppURL_RegExr() As String + Get + Return ResourceManager.GetString("AppURL_RegExr", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to &Back. ''' @@ -1968,6 +1977,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to The process is not a a valid regular expression.[BR][BR]Would you like help validating and testing your regular expression? [BR][BR]This will open your web browser and requires the internet.. + ''' + Friend ReadOnly Property frmGameManager_ErrorRegExFailure() As String + Get + Return ResourceManager.GetString("frmGameManager_ErrorRegExFailure", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to You must enter a valid game name.. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index c29613e..4bddb10 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2017,4 +2017,10 @@ Comments: + + http://regexr.com/?expression=[PARAM]&text=test + + + The process is not a a valid regular expression.[BR][BR]Would you like help validating and testing your regular expression? [BR][BR]This will open your web browser and requires the internet. + \ No newline at end of file