Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Plain Craft Launcher 2/Modules/Base/ModValidate.vb
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,16 @@ Public Class ValidateFolderName
Public Property UseMinecraftCharCheck As Boolean = True
Public Property IgnoreCase As Boolean = True
Private ReadOnly PathIgnore As IEnumerable(Of DirectoryInfo)
Public Property IgnoreFolderName As String = Nothing
Public Sub New()
End Sub
Public Sub New(Path As String, Optional UseMinecraftCharCheck As Boolean = True, Optional IgnoreCase As Boolean = True)
Public Sub New(Path As String, Optional UseMinecraftCharCheck As Boolean = True, Optional IgnoreCase As Boolean = True, Optional IgnoreFolderName As String = Nothing)
Me.Path = Path
Me.IgnoreCase = IgnoreCase
Me.UseMinecraftCharCheck = UseMinecraftCharCheck
On Error Resume Next
PathIgnore = New DirectoryInfo(Path).EnumerateDirectories
Me.IgnoreFolderName = IgnoreFolderName
End Sub
Public Overrides Function Validate(Str As String) As String
Try
Expand All @@ -255,7 +257,9 @@ Public Class ValidateFolderName
Dim Arr As New List(Of String)
If PathIgnore IsNot Nothing Then
For Each Folder As DirectoryInfo In PathIgnore
Arr.Add(Folder.Name)
If IgnoreFolderName Is Nothing OrElse Not Folder.Name.ToLower = IgnoreFolderName.ToLower OrElse Folder.Name = Str Then
Arr.Add(Folder.Name)
End If
Next
End If
Dim SameNameCheck = New ValidateExceptSame(Arr, "不可与现有文件夹重名!", IgnoreCase).Validate(Str)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
Dim OldName As String = PageVersionLeft.Version.Name
Dim OldPath As String = PageVersionLeft.Version.Path
'修改此部分的同时修改快速安装的版本名检测*
Dim NewName As String = MyMsgBoxInput("重命名版本", "", OldName, New ObjectModel.Collection(Of Validate) From {New ValidateFolderName(PathMcFolder & "versions", IgnoreCase:=False)})
Dim NewName As String = MyMsgBoxInput("重命名版本", "", OldName, New ObjectModel.Collection(Of Validate) From {New ValidateFolderName(PathMcFolder & "versions", IgnoreFolderName:=OldName)})
If String.IsNullOrWhiteSpace(NewName) Then Exit Sub
Dim NewPath As String = PathMcFolder & "versions\" & NewName & "\"
'获取临时中间名,以防止仅修改大小写的重命名失败
Expand Down