Skip to content

Commit b9b8746

Browse files
committed
show error hint
1 parent 1932df5 commit b9b8746

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

OpenWithPPGUI/MainForm.vb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,12 @@ Public Class MainForm
730730
If Not BlockEvents AndAlso Not SelectedItem Is Nothing Then
731731
SelectedItem.Path = tbPath.Text
732732
End If
733+
734+
If tbPath.Text.Contains(":\") AndAlso Not File.Exists(tbPath.Text) Then
735+
tbPath.BackColor = Color.OrangeRed
736+
Else
737+
tbPath.ResetBackColor()
738+
End If
733739
End Sub
734740

735741
Sub tbArgs_TextChanged(sender As Object, e As EventArgs) Handles tbArguments.TextChanged
@@ -1101,6 +1107,8 @@ Public Class MainForm
11011107
End Sub
11021108

11031109
Sub tbIcon_TextChanged(sender As Object, e As EventArgs) Handles tbIcon.TextChanged
1110+
Dim match = Regex.Match(tbIcon.Text, "^(.+),(\d+)$")
1111+
11041112
If Not BlockEvents AndAlso Not SelectedItem Is Nothing Then
11051113
If File.Exists(tbIcon.Text) AndAlso tbIcon.Text.ToLower.EndsWith(".exe") OrElse
11061114
tbIcon.Text.ToLower.EndsWith(".dll") Then
@@ -1115,14 +1123,21 @@ Public Class MainForm
11151123
If File.Exists(tbIcon.Text) Then
11161124
SelectedItem.IconFile = tbIcon.Text
11171125
SelectedItem.IconIndex = 0
1118-
ElseIf Regex.IsMatch(tbIcon.Text, "^(.+),(\d+)$") Then
1119-
Dim match = Regex.Match(tbIcon.Text, "^(.+),(\d+)$")
1126+
ElseIf match.Success Then
11201127
SelectedItem.IconFile = match.Groups(1).Value
11211128
SelectedItem.IconIndex = CInt(match.Groups(2).Value)
11221129
Else
11231130
SelectedItem.IconFile = ""
11241131
SelectedItem.IconIndex = 0
11251132
End If
11261133
End If
1134+
1135+
Dim iconFile = If(match.Success, match.Groups(1).Value, tbIcon.Text)
1136+
1137+
If iconFile <> "" AndAlso Not File.Exists(iconFile) Then
1138+
tbIcon.BackColor = Color.OrangeRed
1139+
Else
1140+
tbIcon.ResetBackColor()
1141+
End If
11271142
End Sub
11281143
End Class

0 commit comments

Comments
 (0)