Added regex validation and help for issue #98
This commit is contained in:
Generated
+1
-1
@@ -245,7 +245,7 @@ Partial Class frmGameManager
|
|||||||
'lblLimit
|
'lblLimit
|
||||||
'
|
'
|
||||||
Me.lblLimit.AutoSize = True
|
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.Name = "lblLimit"
|
||||||
Me.lblLimit.Size = New System.Drawing.Size(68, 13)
|
Me.lblLimit.Size = New System.Drawing.Size(68, 13)
|
||||||
Me.lblLimit.TabIndex = 17
|
Me.lblLimit.TabIndex = 17
|
||||||
|
|||||||
@@ -1311,6 +1311,15 @@ Public Class frmGameManager
|
|||||||
End If
|
End If
|
||||||
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
|
Return True
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|||||||
@@ -274,6 +274,16 @@ Public Class mgrCommon
|
|||||||
Return False
|
Return False
|
||||||
End Function
|
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
|
'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
|
Public Shared Function GetFolderSize(ByVal sPath As String, ByVal sInclude As String(), ByVal sExclude As String()) As Long
|
||||||
Dim oFolder As DirectoryInfo
|
Dim oFolder As DirectoryInfo
|
||||||
|
|||||||
@@ -164,16 +164,13 @@ Public Class mgrProcesses
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function IsMatch(ByRef oGame As clsGame, ByRef sProcessCheck As String) As Boolean
|
Private Function IsMatch(ByRef oGame As clsGame, ByRef sProcessCheck As String) As Boolean
|
||||||
Dim oProcessRegEx As Regex
|
|
||||||
|
|
||||||
If oGame.IsRegEx Then
|
If oGame.IsRegEx Then
|
||||||
Try
|
Try
|
||||||
oProcessRegEx = New Regex(oGame.ProcessName)
|
If Regex.IsMatch(sProcessCheck, oGame.ProcessName) Then
|
||||||
If oProcessRegEx.IsMatch(sProcessCheck) Then
|
|
||||||
Return True
|
Return True
|
||||||
End If
|
End If
|
||||||
Catch
|
Catch
|
||||||
'Ignore malformed regular expressions
|
'Ignore malformed regular expressions that may have passed validation
|
||||||
End Try
|
End Try
|
||||||
Else
|
Else
|
||||||
If oGame.ProcessName = sProcessCheck Then
|
If oGame.ProcessName = sProcessCheck Then
|
||||||
|
|||||||
Generated
+18
@@ -177,6 +177,15 @@ Namespace My.Resources
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
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>
|
'''<summary>
|
||||||
''' Looks up a localized string similar to &Back.
|
''' Looks up a localized string similar to &Back.
|
||||||
'''</summary>
|
'''</summary>
|
||||||
@@ -1968,6 +1977,15 @@ Namespace My.Resources
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
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>
|
'''<summary>
|
||||||
''' Looks up a localized string similar to You must enter a valid game name..
|
''' Looks up a localized string similar to You must enter a valid game name..
|
||||||
'''</summary>
|
'''</summary>
|
||||||
|
|||||||
@@ -2017,4 +2017,10 @@
|
|||||||
<data name="frmGameManager_lblComments" xml:space="preserve">
|
<data name="frmGameManager_lblComments" xml:space="preserve">
|
||||||
<value>Comments:</value>
|
<value>Comments:</value>
|
||||||
</data>
|
</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>
|
</root>
|
||||||
Reference in New Issue
Block a user