Added regex validation and help for issue #98
This commit is contained in:
Generated
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Generated
+18
@@ -177,6 +177,15 @@ Namespace My.Resources
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to http://regexr.com/?expression=[PARAM]&text=test.
|
||||
'''</summary>
|
||||
Friend ReadOnly Property AppURL_RegExr() As String
|
||||
Get
|
||||
Return ResourceManager.GetString("AppURL_RegExr", resourceCulture)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to &Back.
|
||||
'''</summary>
|
||||
@@ -1968,6 +1977,15 @@ Namespace My.Resources
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' 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..
|
||||
'''</summary>
|
||||
Friend ReadOnly Property frmGameManager_ErrorRegExFailure() As String
|
||||
Get
|
||||
Return ResourceManager.GetString("frmGameManager_ErrorRegExFailure", resourceCulture)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Looks up a localized string similar to You must enter a valid game name..
|
||||
'''</summary>
|
||||
|
||||
@@ -2017,4 +2017,10 @@
|
||||
<data name="frmGameManager_lblComments" xml:space="preserve">
|
||||
<value>Comments:</value>
|
||||
</data>
|
||||
<data name="AppURL_RegExr" xml:space="preserve">
|
||||
<value>http://regexr.com/?expression=[PARAM]&text=test</value>
|
||||
</data>
|
||||
<data name="frmGameManager_ErrorRegExFailure" xml:space="preserve">
|
||||
<value>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.</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user