Skip to content

Commit

Permalink
Update latest progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Silverteal committed Jun 9, 2024
1 parent aa29759 commit 36224a6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
16 changes: 16 additions & 0 deletions Plain Craft Launcher 2/Modules/Base/ModBase.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,22 @@ Re:
Return tmp.ToString()
End Function
''' <summary>
''' 将没有或有符号的UUID转换为有符号UUID,没有进行格式检查
''' </summary>
Public Function GetSignedUuid(Str As String) As String
If Not Str.Contains("-") Then
Return Str.Substring(0, 8) & "-" & Str.Substring(8, 4) & "-" & Str.Substring(12, 4) & "-" & Str.Substring(16, 4) & "-" & Str.Substring(20)
Else
Return Str
End If
End Function
''' <summary>
''' 将没有或有符号的UUID转换为无符号UUID,没有进行格式检查
''' </summary>
Public Function GetUnignedUuid(Str As String) As String
Return Str.Replace("-", "")
End Function
''' <summary>
''' 检查字符串中的字符是否均为 ASCII 字符。
''' </summary>
<Extension> Public Function IsASCII(Input As String) As Boolean
Expand Down
9 changes: 6 additions & 3 deletions Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1076,15 +1076,18 @@ SystemBrowser:
Uuid = Mid(Uuid, 1, 32 - 5) & (Long.Parse(Right(Uuid, 5), Globalization.NumberStyles.AllowHexSpecifier) + 1).ToString("X")
Loop
Case 5 '每次都询问
Uuid = Uuid.ToLower()
Dim UuidAsked As String = MyMsgBoxInput(
Title:="设置自定义 UUID",
Text:="",
DefaultInput:=Uuid,
DefaultInput:=GetSignedUuid(Uuid),
ValidateRules:=New ObjectModel.Collection(Of Validate) From {New ValidateRegex("([A-Fa-f0-9]{32}|[A-Fa-f0-9]{8}(-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12})", "请输入一个UUID")},
HintText:="无符号纯小写32位字符串",
HintText:=GetSignedUuid(Uuid),
Button1:="使用此UUID",
Button2:="使用默认UUID"
)
If UuidAsked IsNot Nothing Then
Uuid = UuidAsked.Replace("-", "").ToLower()
Uuid = GetUnignedUuid(Uuid)
End If

End Select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<local:MyCard x:Name="CardSkin" Margin="0,15" Title="离线 UUID 和皮肤">
<StackPanel Margin="25,40,25,15">
<local:MyHint Text="由于PCL-Community专门版本的修改,此部分选项可能工作不正常或完全不工作" IsWarn="False" Margin="0,0,0,10" />
<local:MyHint Text="由于PCL-Community的修改,这些选项可能导致您以前的配置工作不完全或完全不工作" IsWarn="True" Margin="0,0,0,10" />
<Grid Margin="-1,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
Expand Down

0 comments on commit 36224a6

Please sign in to comment.