Skip to content

Commit

Permalink
fix: 暂时使用波浪号检测修复 Hex-Dragon#4505
Browse files Browse the repository at this point in the history
  • Loading branch information
SALTWOOD committed Aug 15, 2024
1 parent c62ab46 commit 8b0d9e5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Plain Craft Launcher 2/Modules/Base/ModValidate.vb
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ Public Class ValidateFolderName
On Error Resume Next
PathIgnore = New DirectoryInfo(Path).EnumerateDirectories
End Sub

Public Overrides Function Validate(Str As String) As String
Try
'检查是否为空
Expand All @@ -233,6 +234,8 @@ Public Class ValidateFolderName
'检查特殊字符串
Dim InvalidStrCheck As String = New ValidateExceptSame({"CON", "PRN", "AUX", "CLOCK$", "NUL", "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}, "文件夹名不可为 %!", True).Validate(Str)
If Not InvalidStrCheck = "" Then Return InvalidStrCheck
'检查波浪号 (issue #4505)
If Str.Contains("~") Then Return "文件名不能包含波浪号!"
'检查文件夹重名
Dim Arr As New List(Of String)
If PathIgnore IsNot Nothing Then
Expand Down Expand Up @@ -286,6 +289,8 @@ Public Class ValidateFileName
'检查特殊字符串
Dim InvalidStrCheck As String = New ValidateExceptSame({"CON", "PRN", "AUX", "CLOCK$", "NUL", "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}, "文件名不可为 %!", True).Validate(Str)
If Not InvalidStrCheck = "" Then Return InvalidStrCheck
'检查波浪号 (issue #4505)
If Str.Contains("~") Then Return "文件名不能包含波浪号!"
'检查文件重名
If ParentFolder IsNot Nothing Then
Dim DirInfo As New DirectoryInfo(ParentFolder)
Expand Down Expand Up @@ -351,7 +356,9 @@ Fin:
'检查特殊字符串
Dim InvalidStrCheck As String = New ValidateExceptSame({"CON", "PRN", "AUX", "CLOCK$", "NUL", "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}, "文件夹名不可为 %!").Validate(SubStr)
If Not InvalidStrCheck = "" Then Return InvalidStrCheck
'检查波浪号 (issue #4505)
If Str.Contains("~") Then Return "文件夹名不能包含波浪号!"
Next
Return ""
End Function
End Class
End Class

0 comments on commit 8b0d9e5

Please sign in to comment.