Răsfoiți Sursa

Merge branch 'main' into resourcepacks

Pigeon0v0 2 ani în urmă
părinte
comite
bec86c0022
46 a modificat fișierele cu 1171 adăugiri și 1089 ștergeri
  1. 3 0
      .github/FUNDING.yml
  2. 9 9
      LICENCE
  3. 2 1
      Plain Craft Launcher 2/Application.xaml.vb
  4. 10 1
      Plain Craft Launcher 2/Controls/MyIconButton.xaml.vb
  5. 23 11
      Plain Craft Launcher 2/FormMain.xaml.vb
  6. BIN
      Plain Craft Launcher 2/Images/Heads/DoodleHuang.png
  7. BIN
      Plain Craft Launcher 2/Images/Heads/z0z0r4.png
  8. 10 16
      Plain Craft Launcher 2/Modules/Base/ModBase.vb
  9. 18 30
      Plain Craft Launcher 2/Modules/Base/ModLoader.vb
  10. 36 52
      Plain Craft Launcher 2/Modules/Base/ModNet.vb
  11. 20 20
      Plain Craft Launcher 2/Modules/Minecraft/ModComp.vb
  12. 4 1
      Plain Craft Launcher 2/Modules/Minecraft/ModCrash.vb
  13. 105 14
      Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb
  14. 4 2
      Plain Craft Launcher 2/Modules/Minecraft/ModJava.vb
  15. 148 88
      Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb
  16. 6 4
      Plain Craft Launcher 2/Modules/Minecraft/ModMinecraft.vb
  17. 13 10
      Plain Craft Launcher 2/Modules/Minecraft/ModMod.vb
  18. 136 138
      Plain Craft Launcher 2/Modules/Minecraft/ModModpack.vb
  19. 7 7
      Plain Craft Launcher 2/Modules/ModSecret.vb
  20. 2 2
      Plain Craft Launcher 2/My Project/AssemblyInfo.vb
  21. 112 129
      Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb
  22. 7 1
      Plain Craft Launcher 2/Pages/PageDownload/PageDownloadClient.xaml.vb
  23. 5 5
      Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml.vb
  24. 6 0
      Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb
  25. 1 0
      Plain Craft Launcher 2/Pages/PageDownload/PageDownloadMod.xaml
  26. 2 1
      Plain Craft Launcher 2/Pages/PageDownload/PageDownloadPack.xaml
  27. 2 1
      Plain Craft Launcher 2/Pages/PageLaunch/MySkin.xaml.vb
  28. 38 24
      Plain Craft Launcher 2/Pages/PageLaunch/PageLaunchLeft.xaml.vb
  29. 12 10
      Plain Craft Launcher 2/Pages/PageLaunch/PageLoginAuthSkin.xaml.vb
  30. 92 312
      Plain Craft Launcher 2/Pages/PageOther/PageOtherAbout.xaml
  31. 1 1
      Plain Craft Launcher 2/Pages/PageOther/PageOtherAbout.xaml.vb
  32. 1 0
      Plain Craft Launcher 2/Pages/PageSetup/ModSetup.vb
  33. 2 2
      Plain Craft Launcher 2/Pages/PageSetup/PageSetupLaunch.xaml
  34. 34 17
      Plain Craft Launcher 2/Pages/PageSetup/PageSetupSystem.xaml
  35. 18 2
      Plain Craft Launcher 2/Pages/PageSetup/PageSetupSystem.xaml.vb
  36. 2 2
      Plain Craft Launcher 2/Pages/PageSetup/PageSetupUI.xaml.vb
  37. 8 12
      Plain Craft Launcher 2/Pages/PageSpeedLeft.xaml.vb
  38. 13 1
      Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml
  39. 118 21
      Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb
  40. 5 8
      Plain Craft Launcher 2/Pages/PageVersion/PageVersionOverall.xaml.vb
  41. 3 1
      Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj
  42. BIN
      Plain Craft Launcher 2/Resources/Help.zip
  43. 131 131
      Plain Craft Launcher 2/Resources/ModData.txt
  44. BIN
      Plain Craft Launcher 2/Resources/java-wrapper.jar
  45. 2 2
      README.md
  46. BIN
      最新正式版.zip

+ 3 - 0
.github/FUNDING.yml

@@ -0,0 +1,3 @@
+# These are supported funding model platforms
+
+custom: ['https://afdian.com/a/LTCat']

+ 9 - 9
LICENCE

@@ -2,23 +2,23 @@
 
 一、承诺与声明。
 
-  开发者承诺,在您遵守本指南的情况下,不会追究您的法律责任,但最终裁量权仍由开发者保留。
+  开发者承诺,在您遵守本指南的情况下,不会追究您的责任,但最终裁量权仍由开发者保留。
   法律上,开发者仍保留所有权利(All Rights Reserved),且可能随时修改本指南,本指南并不是永久性保证。
 
 二、少量使用情形。
 
   如果您仅合理使用本存储库中的少量内容,或是参考实现思路,您必须:
-  (一)给出适当的署名,且提供指向本存储库的链接。
-  (二)不得以任何方式暗示开发者为您或您的使用作担保。
+  1、给出适当的署名,且提供指向本存储库的链接。
+  2、不得以任何方式暗示开发者为您或您的使用作担保。
 
 三、大量使用情形。
 
-  如果您基于该存储库进行衍生创作,或合理使用了本存储库中的较大量内容,您必须:
-  (一)给出适当的署名,且提供指向本存储库的链接。
-  (二)不得以任何方式暗示开发者为您或您的使用作担保。
-  (三)给出适当的说明,表示这是第三方内容。在 GitHub 上直接进行 Fork 是允许的。
-  (四)使用本指南文件作为协议,不得附加额外条款。
-  (五)不得分发编译后的可执行文件。唯一的例外是,你可以在明确禁止再次分发的前提下,在小于 100 人的 QQ 群内分发编译后的可执行文件。
+  如果您基于该存储库创作衍生作品,或合理使用了本存储库中的较大量内容,您必须:
+  1、给出适当的署名,且提供指向本存储库的链接。GitHub 上的 Fork 可视为满足此条。
+  2、不得以任何方式暗示开发者为您或您的使用作担保,且需要给出适当的说明,表示这是非官方内容。
+  3、使用本指南文件作为协议,不得附加额外条款。
+  4、该衍生作品不能被允许用于再次分发,这包括制作整合包。
+  5、该衍生作品的名称必须以 “PCL” 或 “Plain Craft Launcher” 开头,并在其后添加后缀,例如 “PCL 启动修复版”、“PCL PR Collection”。
 
 ————————————
 

+ 2 - 1
Plain Craft Launcher 2/Application.xaml.vb

@@ -90,7 +90,7 @@ Public Class Application
             ToolTipService.HorizontalOffsetProperty.OverrideMetadata(GetType(DependencyObject), New FrameworkPropertyMetadata(8.0))
             ToolTipService.VerticalOffsetProperty.OverrideMetadata(GetType(DependencyObject), New FrameworkPropertyMetadata(4.0))
             '设置初始窗口
-            If Setup.Get("UiLauncherLogo") AndAlso Not FormMain.IsLinkRestart Then
+            If Setup.Get("UiLauncherLogo") Then
                 FrmStart = New SplashScreen("Images\icon.ico")
                 FrmStart.Show(False, True)
             End If
@@ -103,6 +103,7 @@ Public Class Application
             Log($"[Start] 识别码:{UniqueAddress}{If(ThemeCheckOne(9), ",已解锁反馈主题", "")}")
             Log($"[Start] 程序路径:{PathWithName}")
             Log($"[Start] 系统编码:{Encoding.Default} ({Encoding.Default.CodePage}, GBK={IsGBKEncoding})")
+            Log($"[Start] 管理员权限:{IsAdmin()}")
             '检测压缩包运行
             If Path.Contains(IO.Path.GetTempPath()) OrElse Path.Contains("AppData\Local\Temp\") Then
                 MyMsgBox("PCL 正在临时文件夹运行,设置、游戏存档等很可能无法保存,且部分功能会无法使用或出错。" & vbCrLf & "请将 PCL 从压缩文件中解压,或是更换文件夹后再继续使用!", "环境警告", "我知道了", IsWarn:=True)

+ 10 - 1
Plain Craft Launcher 2/Controls/MyIconButton.xaml.vb

@@ -111,7 +111,16 @@
             If IsLoaded AndAlso AniControlEnabled = 0 Then '防止默认属性变更触发动画
 
                 If PanBack.Background Is Nothing Then PanBack.Background = New MyColor(0, 255, 255, 255)
-                If Path.Fill Is Nothing AndAlso Theme = Themes.Black Then Path.Fill = New MyColor(140, 0, 0, 0)
+                If Path.Fill Is Nothing Then
+                    Select Case Theme
+                        Case Themes.Red
+                            Path.Fill = New MyColor(160, 255, 76, 76)
+                        Case Themes.Black
+                            Path.Fill = New MyColor(160, 0, 0, 0)
+                        Case Themes.Custom
+                            Path.Fill = New MyColor(160, Foreground)
+                    End Select
+                End If
                 If IsMouseOver Then
                     '指向
                     Dim AnimList As New List(Of AniData)

+ 23 - 11
Plain Craft Launcher 2/FormMain.xaml.vb

@@ -10,6 +10,9 @@ Public Class FormMain
         Dim FeatureList As New List(Of KeyValuePair(Of Integer, String))
         '统计更新日志条目
 #If BETA Then
+        If LastVersion < 332 Then 'Release 2.8.3
+            If LastVersion = 330 Then FeatureList.Add(New KeyValuePair(Of Integer, String)(2, "修复部分玩家无法启动 MC 的 Bug"))
+        End If
         If LastVersion < 330 Then 'Release 2.8.2
             FeatureList.Add(New KeyValuePair(Of Integer, String)(5, "NeoForge 兼容与自动安装"))
             FeatureList.Add(New KeyValuePair(Of Integer, String)(3, "支持编译、运行 PCL 开源代码"))
@@ -121,6 +124,18 @@ Public Class FormMain
         '3:BUG+ IMP* FEAT-
         '2:BUG* IMP-
         '1:BUG-
+        If LastVersion < 333 Then 'Snapshot 2.8.4
+            FeatureList.Add(New KeyValuePair(Of Integer, String)(4, "下载 Mod 时会使用 MCIM 国内镜像源"))
+            FeatureList.Add(New KeyValuePair(Of Integer, String)(3, "打开 PCL 时会自动安装同目录下的 modpack.zip"))
+            FeatureList.Add(New KeyValuePair(Of Integer, String)(3, "爱发电域名迁移至 afdian.com"))
+            FeatureList.Add(New KeyValuePair(Of Integer, String)(1, "修复 1.20.1+ 离线登录使用正版皮肤时无法保存游戏的 Bug"))
+            FeatureList.Add(New KeyValuePair(Of Integer, String)(1, "修复安装的 1.14~1.15 Forge+OptiFine 无法进入世界的 Bug"))
+            FeatureCount += 13
+            BugCount += 17
+        End If
+        If LastVersion < 331 Then 'Snapshot 2.8.3
+            If LastVersion = 329 Then FeatureList.Add(New KeyValuePair(Of Integer, String)(2, "修复部分玩家无法启动 MC 的 Bug"))
+        End If
         If LastVersion < 329 Then 'Snapshot 2.8.2
             If LastVersion >= 327 Then
                 FeatureList.Add(New KeyValuePair(Of Integer, String)(1, "修复无法安装 Beta 版 NeoForge 的整合包的 Bug"))
@@ -301,17 +316,13 @@ Public Class FormMain
         RunInNewThread(
         Sub()
             If MyMsgBox(Content, "PCL 已更新至 " & VersionDisplayName, "确定", "完整更新日志") = 2 Then
-                OpenWebsite("https://afdian.net/a/LTCat?tab=feed")
+                OpenWebsite("https://afdian.com/a/LTCat?tab=feed")
             End If
         End Sub, "UpdateLog Output")
     End Sub
 
     '窗口加载
     Private IsWindowLoadFinished As Boolean = False
-    ''' <summary>
-    ''' 是否为联机提权后自动重启。
-    ''' </summary>
-    Public Shared IsLinkRestart As Boolean = False
     Public Sub New()
         ApplicationStartTick = GetTimeTick()
         '窗体参数初始化
@@ -349,7 +360,6 @@ Public Class FormMain
         PanMainLeft.Child = FrmLaunchLeft
         PanMainRight.Child = FrmLaunchRight
         FrmLaunchRight.PageState = MyPageRight.PageStates.ContentStay
-        If IsLinkRestart Then PageChange(PageType.Link, PageSubType.LinkIoi)
         '模式提醒
 #If DEBUG Then
         Hint("[开发者模式] PCL 正以开发者模式运行,这可能会造成严重的性能下降,请务必立即向开发者反馈此问题!", HintType.Critical)
@@ -418,7 +428,7 @@ Public Class FormMain
             Sub()
                 PanBack.RenderTransform = Nothing
                 IsWindowLoadFinished = True
-                Log($"[System] DPI:{DPI},系统版本:{OsVersion},PCL 位置:{PathWithName}")
+                Log($"[System] DPI:{DPI},系统版本:{Environment.OSVersion.VersionString},PCL 位置:{PathWithName}")
             End Sub, , True)
         }, "Form Show")
         'Timer 启动
@@ -564,7 +574,7 @@ Public Class FormMain
                 RunInNewThread(
                 Sub()
                     Log("[System] 正在强行停止任务")
-                    For Each Task As LoaderBase In LoaderTaskbar.ToArray
+                    For Each Task As LoaderBase In LoaderTaskbar.ToList()
                         Task.Abort()
                     Next
                 End Sub, "强行停止下载任务")
@@ -883,10 +893,12 @@ Public Class FormMain
 Install:
                     Try
                         For Each ModFile In FilePathList
-                            CopyFile(ModFile, TargetVersion.PathIndie & "mods\" & GetFileNameFromPath(ModFile))
+                            Dim NewFileName = GetFileNameFromPath(ModFile).Replace(".disabled", "")
+                            If Not NewFileName.Contains(".") Then NewFileName += ".jar" '#4227
+                            CopyFile(ModFile, TargetVersion.PathIndie & "mods\" & NewFileName)
                         Next
                         If FilePathList.Count = 1 Then
-                            Hint($"已安装 {GetFileNameFromPath(FilePathList.First)}!", HintType.Finish)
+                            Hint($"已安装 {GetFileNameFromPath(FilePathList.First).Replace(".disabled", "")}!", HintType.Finish)
                         Else
                             Hint($"已安装 {FilePathList.Count} 个 Mod!", HintType.Finish)
                         End If
@@ -903,7 +915,7 @@ Install:
             '安装整合包
             If {"zip", "rar", "mrpack"}.Any(Function(t) t = Extension) Then '部分压缩包是 zip 格式但后缀为 rar,总之试一试
                 Log("[System] 文件为压缩包,尝试作为整合包安装")
-                If ModpackInstall(FilePath, ShowHint:=False) Then Exit Sub
+                If ModpackInstall(FilePath, ShowHint:=False) IsNot Nothing Then Exit Sub
             End If
             'RAR 处理
             If Extension = "rar" Then

BIN
Plain Craft Launcher 2/Images/Heads/DoodleHuang.png


BIN
Plain Craft Launcher 2/Images/Heads/z0z0r4.png


+ 10 - 16
Plain Craft Launcher 2/Modules/Base/ModBase.vb

@@ -11,12 +11,12 @@ Public Module ModBase
 #Region "声明"
 
     '下列版本信息由更新器自动修改
-    Public Const VersionBaseName As String = "2.8.2" '不含分支前缀的显示用版本名
-    Public Const VersionStandardCode As String = "2.8.2." & VersionBranchCode '标准格式的四段式版本号
+    Public Const VersionBaseName As String = "2.8.4" '不含分支前缀的显示用版本名
+    Public Const VersionStandardCode As String = "2.8.4." & VersionBranchCode '标准格式的四段式版本号
 #If BETA Then
-    Public Const VersionCode As Integer = 330 'Release
+    Public Const VersionCode As Integer = 332 'Release
 #Else
-    Public Const VersionCode As Integer = 329 'Snapshot
+    Public Const VersionCode As Integer = 333 'Snapshot
 #End If
     '自动生成的版本信息
     Public Const VersionDisplayName As String = VersionBranchName & " " & VersionBaseName
@@ -80,10 +80,6 @@ Public Module ModBase
     ''' </summary>
     Public IsGBKEncoding As Boolean = Encoding.Default.CodePage = 936
     ''' <summary>
-    ''' 操作系统版本。Win10 为 10.0。
-    ''' </summary>
-    Public OsVersion As Version = Environment.OSVersion.Version
-    ''' <summary>
     ''' 系统盘盘符,以 \ 结尾。例如 “C:\”。
     ''' </summary>
     Public OsDrive As String = Environment.GetLogicalDrives().Where(Function(p) Directory.Exists(p)).First.ToUpper.First & ":\" '#3799
@@ -1016,7 +1012,7 @@ Public Module ModBase
     ''' </summary>
     Public Function CheckPermission(Path As String) As Boolean
         Try
-            If Path = "" Then Return False
+            If String.IsNullOrEmpty(Path) Then Return False
             If Not Path.EndsWithF("\") Then Path += "\"
             If Path.EndsWithF(":\System Volume Information\") OrElse Path.EndsWithF(":\$RECYCLE.BIN\") Then Return False
             If Not Directory.Exists(Path) Then Return False
@@ -1108,8 +1104,6 @@ Re:
         Dim Retry As Boolean = False
 Re:
         Try
-            ''检测该文件是否在下载中,若在下载则放弃检测
-            'If IgnoreOnDownloading AndAlso NetManage.Files.ContainsKey(FilePath) AndAlso NetManage.Files(FilePath).State <= NetState.Merge Then Return ""
             '获取 SHA1
             Dim file As New FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
             Dim sha1 As SHA1 = New SHA1CryptoServiceProvider()
@@ -1587,14 +1581,14 @@ RetryDir:
     ''' 获取处于两个子字符串之间的部分。
     ''' 会裁切尽可能多的内容:匹配开始使用 LastIndexOf,匹配结束使用 IndexOf,但如果未找到子字符串则不裁切。
     ''' </summary>
-    <Extension> Public Function Between(Str As String, Before As String, After As String, Optional IgnoreCase As Boolean = False) As String
-        Dim StartPos As Integer = If(String.IsNullOrEmpty(Before), -1, Str.LastIndexOfF(Before, IgnoreCase))
+    <Extension> Public Function Between(Str As String, After As String, Before As String, Optional IgnoreCase As Boolean = False) As String
+        Dim StartPos As Integer = If(String.IsNullOrEmpty(After), -1, Str.LastIndexOfF(After, IgnoreCase))
         If StartPos >= 0 Then
-            StartPos += Before.Length
+            StartPos += After.Length
         Else
             StartPos = 0
         End If
-        Dim EndPos As Integer = If(String.IsNullOrEmpty(After), -1, Str.IndexOfF(After, StartPos, IgnoreCase))
+        Dim EndPos As Integer = If(String.IsNullOrEmpty(Before), -1, Str.IndexOfF(Before, StartPos, IgnoreCase))
         If EndPos >= 0 Then
             Return Str.Substring(StartPos, EndPos - StartPos)
         ElseIf StartPos > 0 Then
@@ -2682,7 +2676,7 @@ Retry:
     Public Sub FeedbackInfo()
         On Error Resume Next
         Log("[System] 诊断信息:" & vbCrLf &
-            "操作系统:" & My.Computer.Info.OSFullName & vbCrLf &
+            "操作系统:" & My.Computer.Info.OSFullName & "(32 位:" & Is32BitSystem & ")" & vbCrLf &
             "剩余内存:" & Int(My.Computer.Info.AvailablePhysicalMemory / 1024 / 1024) & " M / " & Int(My.Computer.Info.TotalPhysicalMemory / 1024 / 1024) & " M" & vbCrLf &
             "DPI:" & DPI & "(" & Math.Round(DPI / 96, 2) * 100 & "%)" & vbCrLf &
             "MC 文件夹:" & If(PathMcFolder, "Nothing") & vbCrLf &

+ 18 - 30
Plain Craft Launcher 2/Modules/Base/ModLoader.vb

@@ -566,38 +566,33 @@ Restart:
     End Class
 
     '任务栏进度条
-    Public LoaderTaskbarLock As New Object
-    Public LoaderTaskbar As New List(Of LoaderBase)
+    Public LoaderTaskbar As New Concurrent.ConcurrentBag(Of LoaderBase)
     Public LoaderTaskbarProgress As Double = 0 '平滑后的进度
     Private LoaderTaskbarProgressLast As Shell.TaskbarItemProgressState = Shell.TaskbarItemProgressState.None
 
     Public Sub LoaderTaskbarAdd(Of T)(Loader As LoaderCombo(Of T))
         If FrmSpeedLeft IsNot Nothing Then FrmSpeedLeft.TaskRemove(Loader)
-        SyncLock LoaderTaskbarLock
-            LoaderTaskbar.Add(Loader)
-            Log($"[Taskbar] {Loader.Name} 已加入任务列表")
-        End SyncLock
+        LoaderTaskbar.Add(Loader)
+        Log($"[Taskbar] {Loader.Name} 已加入任务列表")
     End Sub
     Public Sub LoaderTaskbarProgressRefresh()
         Try
             Dim NewState As Shell.TaskbarItemProgressState
             Dim NewProgress As Double = LoaderTaskbarProgressGet()
             '检查任务是否完成,若完成则移除
-            SyncLock LoaderTaskbarLock
-                '外显任务是否已经全部完成
-                Dim IsAllDownloadTaskCompleted As Boolean = True
-                For Each Loader In LoaderTaskbar
-                    If Loader.State = LoadState.Loading Then IsAllDownloadTaskCompleted = False
-                Next
-                '若单个任务已中止或全部任务已完成,则刷新并移除
-                For Each Task In LoaderTaskbar.ToList()
-                    If IsAllDownloadTaskCompleted OrElse Task.State = LoadState.Aborted OrElse Task.State = LoadState.Waiting Then
-                        If FrmSpeedLeft IsNot Nothing Then FrmSpeedLeft.TaskRefresh(Task)
-                        LoaderTaskbar.Remove(Task)
-                        Log($"[Taskbar] {Task.Name} 已移出任务列表")
-                    End If
-                Next
-            End SyncLock
+            '外显任务是否已经全部完成
+            Dim IsAllDownloadTaskCompleted As Boolean = True
+            For Each Loader In LoaderTaskbar
+                If Loader.State = LoadState.Loading Then IsAllDownloadTaskCompleted = False
+            Next
+            '若单个任务已中止或全部任务已完成,则刷新并移除
+            For Each Task In LoaderTaskbar.ToList()
+                If IsAllDownloadTaskCompleted OrElse Task.State = LoadState.Aborted OrElse Task.State = LoadState.Waiting Then
+                    If FrmSpeedLeft IsNot Nothing Then FrmSpeedLeft.TaskRefresh(Task)
+                    LoaderTaskbar.TryTake(Task)
+                    Log($"[Taskbar] {Task.Name} 已移出任务列表")
+                End If
+            Next
             '更新平滑后的进度
             If NewProgress <= 0 OrElse NewProgress >= 1 OrElse LoaderTaskbarProgress > NewProgress Then
                 LoaderTaskbarProgress = NewProgress
@@ -625,15 +620,8 @@ Restart:
     End Sub
     Public Function LoaderTaskbarProgressGet() As Double
         Try
-            Dim Total As Double = 0, Count As Integer = 0
-            SyncLock LoaderTaskbarLock
-                For Each Task In LoaderTaskbar.ToList
-                    Total += Task.Progress
-                    Count += 1 '避免多线程影响导致计数出错
-                Next
-            End SyncLock
-            If Count = 0 Then Return 1
-            Return MathClamp(Total / Count, 0, 1)
+            If Not LoaderTaskbar.Any Then Return 1
+            Return MathClamp(LoaderTaskbar.Select(Function(e) e.Progress).Average(), 0, 1)
         Catch ex As Exception
             Log(ex, "获取任务栏进度出错", LogLevel.Feedback)
             Return 0.5

+ 36 - 52
Plain Craft Launcher 2/Modules/Base/ModNet.vb

@@ -1,5 +1,4 @@
 Imports System.Net
-Imports PCL.ModNet
 
 Public Module ModNet
     Public Const NetDownloadEnd As String = ".PCLDownloading"
@@ -207,10 +206,10 @@ RequestFinished:
         Catch ex As ThreadInterruptedException
             Throw
         Catch ex As Exception
-            If ex.GetType.Equals(GetType(WebException)) AndAlso CType(ex, WebException).Status = WebExceptionStatus.Timeout Then
-                Throw New TimeoutException("连接服务器超时,已接收 " & Result.Count & " B(" & Url & ")")
+            If TypeOf ex Is WebException AndAlso CType(ex, WebException).Status = WebExceptionStatus.Timeout Then
+                Throw New TimeoutException($"获取结果失败({CType(ex, WebException).Status},{ex.Message},{Url})", ex)
             Else
-                Throw New WebException("获取结果失败," & ex.Message & "(" & Url & ")", ex)
+                Throw New WebException($"获取结果失败({If(TypeOf ex Is WebException, CType(ex, WebException).Status & ",", "")}{ex.Message},{Url})", ex)
             End If
         Finally
             Request.Abort()
@@ -419,7 +418,7 @@ RequestFinished:
             Throw
         Catch ex As WebException
             If ex.Status = WebExceptionStatus.Timeout Then
-                Throw New WebException("连接服务器超时,请检查你的网络环境是否良好(" & Url & ")", ex)
+                ex = New WebException($"连接服务器超时,请检查你的网络环境是否良好({ex.Message},{Url})", ex)
             Else
                 '获取请求失败的返回
                 Dim Res As String = ""
@@ -433,10 +432,14 @@ RequestFinished:
                     End Using
                 Catch
                 End Try
-                Throw New WebException("网络请求失败(" & Url & "," & ex.Message & ")" & If(String.IsNullOrEmpty(Res), "", vbCrLf & Res), ex)
+                ex = New WebException($"网络请求失败({ex.Status},{ex.Message},{Url}){If(String.IsNullOrEmpty(Res), "", vbCrLf & Res)}", ex)
             End If
+            If MakeLog Then Log(ex, "NetRequestOnce 失败", LogLevel.Developer)
+            Throw ex
         Catch ex As Exception
-            Throw New WebException("网络请求失败(" & Url & ")", ex)
+            ex = New WebException("网络请求失败(" & Url & ")", ex)
+            If MakeLog Then Log(ex, "NetRequestOnce 失败", LogLevel.Developer)
+            Throw ex
         Finally
             If DataStream IsNot Nothing Then DataStream.Dispose()
             If Resp IsNot Nothing Then Resp.Dispose()
@@ -688,7 +691,7 @@ RequestFinished:
         ''' <summary>
         ''' 所属的文件列表任务。
         ''' </summary>
-        Public Tasks As New List(Of LoaderDownload)
+        Public Tasks As New Concurrent.ConcurrentBag(Of LoaderDownload)
 
         ''' <summary>
         ''' 所有下载源。
@@ -881,7 +884,6 @@ RequestFinished:
         Public ReadOnly LockState As New Object
         Public ReadOnly LockChain As New Object
         Public ReadOnly LockSource As New Object
-        Public ReadOnly LockTasks As New Object
 
         Public ReadOnly Uuid As Integer = GetUuid()
         Public Overrides Function Equals(obj As Object) As Boolean
@@ -964,7 +966,7 @@ Capture:
                     Next
                     '是否禁用多线程,以及规定碎片大小
                     Dim TargetUrl As String = GetSource().Url
-                    If TargetUrl.Contains("pcl2-server") OrElse TargetUrl.Contains("gitcode.net") OrElse TargetUrl.Contains("github.com") OrElse TargetUrl.Contains("modrinth.com") Then Return Nothing
+                    If TargetUrl.Contains("pcl2-server") OrElse TargetUrl.Contains("gitcode.net") OrElse TargetUrl.Contains("github.com") OrElse TargetUrl.Contains("modrinth") Then Return Nothing
                     '寻找最大碎片
                     'FUTURE: 下载引擎重做,计算下载源平均链接时间和线程下载速度,按最高时间节省来开启多线程
                     Dim FilePieceMax As NetThread = Threads
@@ -980,10 +982,8 @@ StartThread:
                     If (StartPosition > FileSize AndAlso FileSize >= 0 AndAlso Not IsUnknownSize) OrElse StartPosition < 0 OrElse IsNothing(StartSource) Then Return Nothing
                     '构建线程
                     Dim ThreadUuid As Integer = GetUuid()
-                    SyncLock LockTasks
-                        If Not Tasks.Any() Then Return Nothing '由于中断,已没有可用任务
-                        Th = New Thread(AddressOf Thread) With {.Name = $"NetTask {Tasks(0).Uuid}/{Uuid} Download {ThreadUuid}#", .Priority = ThreadPriority.BelowNormal}
-                    End SyncLock
+                    If Not Tasks.Any() Then Return Nothing '由于中断,已没有可用任务
+                    Th = New Thread(AddressOf Thread) With {.Name = $"NetTask {Tasks(0).Uuid}/{Uuid} Download {ThreadUuid}#", .Priority = ThreadPriority.BelowNormal}
                     ThreadInfo = New NetThread With {.Uuid = ThreadUuid, .DownloadStart = StartPosition, .Thread = Th, .Source = StartSource, .Task = Me, .State = NetState.WaitForDownload}
                     '链表处理
                     If ThreadInfo.IsFirstThread OrElse Threads Is Nothing Then
@@ -1140,11 +1140,9 @@ NotSupportRange:
                                 End If
                                 SyncLock LockCount
                                     Info.Source.FailCount = 0
-                                    SyncLock LockTasks
-                                        For Each Task In Tasks
-                                            Task.FailCount = 0
-                                        Next
-                                    End SyncLock
+                                    For Each Task In Tasks
+                                        Task.FailCount = 0
+                                    Next
                                 End SyncLock
                                 NetManager.DownloadDone += RealDataCount
                                 SyncLock LockDone
@@ -1198,11 +1196,9 @@ SourceBreak:
                 '状态变更
                 SyncLock LockCount
                     Info.Source.FailCount += 1
-                    SyncLock LockTasks
-                        For Each Task In Tasks
-                            Task.FailCount += 1
-                        Next
-                    End SyncLock
+                    For Each Task In Tasks
+                        Task.FailCount += 1
+                    Next
                 End SyncLock
                 Dim IsTimeoutString As String = GetExceptionSummary(ex).ToLower.Replace(" ", "")
                 Dim IsTimeout As Boolean = IsTimeoutString.Contains("由于连接方在一段时间后没有正确答复或连接的主机没有反应") OrElse
@@ -1307,7 +1303,7 @@ Retry:
                     '合并文件
                     If IsNoSplit Then
                         '仅有一个线程,从缓存中输出
-                        If ModeDebug Then Log($"[Download] {LocalName}:下载结束,从缓存输出文件")
+                        If ModeDebug Then Log($"[Download] {LocalName}:下载结束,从缓存输出文件,长度:" & SmailFileCache.Count)
                         MergeFile = New FileStream(LocalPath, FileMode.Create)
                         AddWriter = New BinaryWriter(MergeFile)
                         AddWriter.Write(SmailFileCache.ToArray)
@@ -1344,7 +1340,7 @@ Retry:
                     '检查文件
                     Dim CheckResult As String = Check?.Check(LocalPath)
                     If CheckResult IsNot Nothing Then
-                        Log($"[Download] {LocalName} 合并文件失败,下载线程细节:")
+                        Log($"[Download] {LocalName} 文件校验失败,下载线程细节:")
                         For Each Th As NetThread In Threads
                             Log($"[Download]     {Th.Uuid}#,状态 {GetStringFromEnum(Th.State)},范围 {Th.DownloadStart}~{Th.DownloadStart + Th.DownloadDone},完成 {Th.DownloadDone},剩余 {Th.DownloadUndone}")
                         Next
@@ -1397,10 +1393,8 @@ Retry:
         ''' </summary>
         Public Sub Abort(CausedByTask As LoaderDownload)
             '从特定任务中移除,如果它还属于其他任务,则继续下载
-            SyncLock LockTasks
-                Tasks.Remove(CausedByTask)
-                If Tasks.Any Then Exit Sub
-            End SyncLock
+            Tasks.TryTake(CausedByTask)
+            If Tasks.Any Then Exit Sub
             '确认中断
             SyncLock LockState
                 If State >= NetState.Finish Then Exit Sub
@@ -1430,11 +1424,9 @@ Retry:
                 NetManager.FileRemain -= 1
                 If PrintLog Then Log("[Download] " & LocalName & ":已完成,剩余文件 " & NetManager.FileRemain)
             End SyncLock
-            SyncLock LockTasks
-                For Each Task In Tasks
-                    Task.OnFileFinish(Me)
-                Next
-            End SyncLock
+            For Each Task In Tasks
+                Task.OnFileFinish(Me)
+            Next
         End Sub
 
     End Class
@@ -1961,9 +1953,7 @@ Retry:
                         If Files(File.LocalPath).State >= NetState.Finish Then
                             '该文件已经下载过一次,且下载完成
                             '将已下载的文件替换成当前文件,重新下载
-                            SyncLock File.LockTasks
-                                File.Tasks.Add(Task)
-                            End SyncLock
+                            File.Tasks.Add(Task)
                             Files(File.LocalPath) = File
                             SyncLock LockRemain
                                 FileRemain += 1
@@ -1974,15 +1964,11 @@ Retry:
                             '该文件正在下载中
                             '将当前文件替换成下载中的文件,即两个任务指向同一个文件
                             File = Files(File.LocalPath)
-                            SyncLock File.LockTasks
-                                File.Tasks.Add(Task)
-                            End SyncLock
+                            File.Tasks.Add(Task)
                         End If
                     Else
                         '没有该文件
-                        SyncLock File.LockTasks
-                            File.Tasks.Add(Task)
-                        End SyncLock
+                        File.Tasks.Add(Task)
                         Files.Add(File.LocalPath, File)
                         SyncLock LockRemain
                             FileRemain += 1
@@ -2004,14 +1990,12 @@ Retry:
     ''' 是否有正在进行中、需要在下载管理页面显示的下载任务?
     ''' </summary>
     Public Function HasDownloadingTask(Optional IgnoreCustomDownload As Boolean = False) As Boolean
-        SyncLock LoaderTaskbarLock
-            For Each Task In LoaderTaskbar
-                If (Task.Show AndAlso Task.State = LoadState.Loading) AndAlso
-                   (Not IgnoreCustomDownload OrElse Not Task.Name.ToString.Contains("自定义下载")) Then
-                    Return True
-                End If
-            Next
-        End SyncLock
+        For Each Task In LoaderTaskbar
+            If (Task.Show AndAlso Task.State = LoadState.Loading) AndAlso
+               (Not IgnoreCustomDownload OrElse Not Task.Name.ToString.Contains("自定义下载")) Then
+                Return True
+            End If
+        Next
         Return False
     End Function
 

+ 20 - 20
Plain Craft Launcher 2/Modules/Minecraft/ModComp.vb

@@ -278,7 +278,8 @@
                     End If
                     'Tags
                     Tags = New List(Of String)
-                    For Each Category In Data("categories").Select(Of Integer)(Function(t) t("id")).Distinct.OrderByDescending(Function(c) c)
+                    For Each Category In If(Data("categories"), New JArray). '镜像源 API 可能丢失此字段:https://github.com/Hex-Dragon/PCL2/issues/4267#issuecomment-2254590831
+                        Select(Of Integer)(Function(t) t("id")).Distinct.OrderByDescending(Function(c) c)
                         Select Case Category
                         'Mod
                             Case 406 : Tags.Add("世界元素")
@@ -402,7 +403,7 @@
                             Case "technology" : Tags.Add("科技")
                             Case "magic" : Tags.Add("魔法")
                             Case "adventure" : Tags.Add("冒险")
-                            Case "kitchen-sink" : Tags.Add("烹饪")
+                            Case "kitchen-sink" : Tags.Add("大杂烩")
                             Case "lightweight" : Tags.Add("轻量")
                             '资源包
                             Case "8x-" : Tags.Add("8x-")
@@ -434,7 +435,6 @@
                             Case "tweaks" : Tags.Add("优化")
                             Case "utility" : Tags.Add("实用")
                             Case "vanilla-like" : Tags.Add("类原生")
-
                         End Select
                     Next
                     If Not Tags.Any() Then Tags.Add("杂项")
@@ -994,7 +994,7 @@ Retry:
                         Try
                             '获取工程列表
                             Log("[Comp] 开始从 CurseForge 获取工程列表:" & CurseForgeUrl)
-                            Dim RequestResult As JObject = NetGetCodeByRequestRetry(CurseForgeUrl, IsJson:=True, Encode:=Encoding.UTF8)
+                            Dim RequestResult As JObject = DlModRequest(CurseForgeUrl, IsJson:=True)
                             Task.Progress += 0.2
                             Dim ProjectList As New List(Of CompProject)
                             For Each JsonEntry As JObject In RequestResult("data")
@@ -1009,7 +1009,7 @@ Retry:
                             Log($"[Comp] 从 CurseForge 获取到了 {ProjectList.Count} 个工程(已获取 {Storage.CurseForgeOffset} 个,共 {Storage.CurseForgeTotal} 个)")
                         Catch ex As Exception
                             Log(ex, "从 CurseForge 获取工程列表失败")
-                            Storage.CurseForgeTotal = Storage.CurseForgeOffset
+                            Storage.CurseForgeTotal = -1 'Storage.CurseForgeOffset
                             [Error] = ex
                             CurseForgeFailed = True
                         End Try
@@ -1024,7 +1024,7 @@ Retry:
                     Sub()
                         Try
                             Log("[Comp] 开始从 Modrinth 获取工程列表:" & ModrinthUrl)
-                            Dim RequestResult As JObject = NetGetCodeByRequestRetry(ModrinthUrl, IsJson:=True, Encode:=Encoding.UTF8)
+                            Dim RequestResult As JObject = DlModRequest(ModrinthUrl, IsJson:=True)
                             Task.Progress += 0.2
                             Dim ProjectList As New List(Of CompProject)
                             For Each JsonEntry As JObject In RequestResult("hits")
@@ -1042,7 +1042,7 @@ Retry:
                             Log($"[Comp] 从 Modrinth 获取到了 {ProjectList.Count} 个工程(已获取 {Storage.ModrinthOffset} 个,共 {Storage.ModrinthTotal} 个)")
                         Catch ex As Exception
                             Log(ex, "从 Modrinth 获取工程列表失败")
-                            Storage.ModrinthTotal = Storage.ModrinthOffset
+                            Storage.ModrinthTotal = -1 'Storage.ModrinthOffset
                             [Error] = ex
                             ModrinthFailed = True
                         End Try
@@ -1068,7 +1068,7 @@ Retry:
                     ElseIf Task.Input.Source = CompSourceType.Modrinth AndAlso Task.Input.Tag.EndsWithF("/") Then
                         Throw New Exception("Modrinth 不兼容所选的类型")
                     Else
-                        Throw New Exception("没有符合条件的结果")
+                        Throw New Exception("没有搜索结果")
                     End If
                 End If
             ElseIf [Error] IsNot Nothing Then
@@ -1300,7 +1300,9 @@ Retry:
                     DownloadUrls = (New List(Of String) From {Url.Replace("-service.overwolf.wtf", ".forgecdn.net").Replace("://edge", "://media"),
                                        Url.Replace("-service.overwolf.wtf", ".forgecdn.net"),
                                        Url.Replace("://edge", "://media"),
-                                       Url}).Distinct().ToList()
+                                       Url}).Distinct.ToList '对脑残 CurseForge 的下载地址进行多种修正
+                    DownloadUrls.AddRange(DownloadUrls.Select(Function(u) DlSourceModGet(u)).ToList) '添加镜像源,这个写法是为了让镜像源排在后面
+                    DownloadUrls = DownloadUrls.Distinct.ToList '最终去重
                     'Dependencies
                     If Type = CompType.Mod Then
                         RawDependencies = Data("dependencies").
@@ -1334,11 +1336,10 @@ Retry:
                     ReleaseDate = Data("date_published")
                     Status = If(Data("version_type").ToString = "release", CompFileStatus.Release, If(Data("version_type").ToString = "beta", CompFileStatus.Beta, CompFileStatus.Alpha))
                     DownloadCount = Data("downloads")
-                    '可能为空
-                    If CType(Data("files"), JArray).Any() Then
+                    If CType(Data("files"), JArray).Any() Then '可能为空
                         Dim File As JToken = Data("files")(0)
                         FileName = File("filename")
-                        DownloadUrls = New List(Of String) From {File("url")}
+                        DownloadUrls = New List(Of String) From {File("url"), DlSourceModGet(File("url"))}.Distinct.ToList '同时添加了镜像源
                         Hash = File("hashes")("sha1")
                     End If
                     'Dependencies
@@ -1474,9 +1475,9 @@ Retry:
         If CompProjectCache.ContainsKey(ProjectId) Then '存在缓存
             TargetProject = CompProjectCache(ProjectId)
         ElseIf FromCurseForge Then 'CurseForge
-            TargetProject = New CompProject(NetGetCodeByRequestRetry("https://api.curseforge.com/v1/mods/" & ProjectId, IsJson:=True, Encode:=Encoding.UTF8)("data"))
+            TargetProject = New CompProject(DlModRequest("https://api.curseforge.com/v1/mods/" & ProjectId, IsJson:=True)("data"))
         Else 'Modrinth
-            TargetProject = New CompProject(NetGetCodeByRequestRetry("https://api.modrinth.com/v2/project/" & ProjectId, IsJson:=True, Encode:=Encoding.UTF8))
+            TargetProject = New CompProject(DlModRequest("https://api.modrinth.com/v2/project/" & ProjectId, IsJson:=True))
         End If
         '获取工程对象的文件列表
         Log("[Comp] 开始获取文件列表:" & ProjectId)
@@ -1484,13 +1485,13 @@ Retry:
         If FromCurseForge Then
             'CurseForge
             If TargetProject.Type = CompType.Mod Then 'Mod 使用每个版本最新的文件
-                ResultJsonArray = GetJson(NetRequestRetry("https://api.curseforge.com/v1/mods/files", "POST", "{""fileIds"": [" & Join(TargetProject.CurseForgeFileIds, ",") & "]}", "application/json"))("data")
+                ResultJsonArray = GetJson(DlModRequest("https://api.curseforge.com/v1/mods/files", "POST", "{""fileIds"": [" & Join(TargetProject.CurseForgeFileIds, ",") & "]}", "application/json"))("data")
             Else '否则使用全部文件
-                ResultJsonArray = NetGetCodeByRequestRetry($"https://api.curseforge.com/v1/mods/{ProjectId}/files?pageSize=999", Accept:="application/json", IsJson:=True)("data")
+                ResultJsonArray = DlModRequest($"https://api.curseforge.com/v1/mods/{ProjectId}/files?pageSize=999", IsJson:=True)("data")
             End If
         Else
             'Modrinth
-            ResultJsonArray = NetGetCodeByRequestRetry($"https://api.modrinth.com/v2/project/{ProjectId}/version", Accept:="application/json", IsJson:=True)
+            ResultJsonArray = DlModRequest($"https://api.modrinth.com/v2/project/{ProjectId}/version", IsJson:=True)
         End If
         CompFilesCache(ProjectId) = ResultJsonArray.Select(Function(a) New CompFile(a, TargetProject.Type)).
             Where(Function(a) a.Available).ToList.Distinct(Function(a, b) a.Id = b.Id) 'CurseForge 可能会重复返回相同项(#1330)
@@ -1504,11 +1505,10 @@ Retry:
             Log($"[Comp] {ProjectId} 文件列表中还需要获取信息的前置 Mod:{Join(UndoneDeps, ",")}")
             Dim Projects As JArray
             If TargetProject.FromCurseForge Then
-                Projects = GetJson(NetRequestRetry("https://api.curseforge.com/v1/mods",
+                Projects = GetJson(DlModRequest("https://api.curseforge.com/v1/mods",
                     "POST", "{""modIds"": [" & Join(UndoneDeps, ",") & "]}", "application/json"))("data")
             Else
-                Projects = NetGetCodeByRequestRetry($"https://api.modrinth.com/v2/projects?ids=[""{Join(UndoneDeps, """,""")}""]",
-                    Accept:="application/json", IsJson:=True)
+                Projects = DlModRequest($"https://api.modrinth.com/v2/projects?ids=[""{Join(UndoneDeps, """,""")}""]", IsJson:=True)
             End If
             For Each Project In Projects
                 Dim NewProject As New CompProject(Project) '在 New 的时候就添加了缓存

+ 4 - 1
Plain Craft Launcher 2/Modules/Minecraft/ModCrash.vb

@@ -881,7 +881,10 @@ NextStack:
                                 FileName = "游戏崩溃前的输出.txt"
                         End Select
                         If File.Exists(OutputFile) Then
-                            WriteFile(TempFolder & "Report\" & FileName, SecretFilter(ReadFile(OutputFile), If(FileName = "启动脚本.bat", "F", "*")))
+                            Dim FileEncoding As Encoding = GetEncoding(OutputFile)
+                            WriteFile(TempFolder & "Report\" & FileName,
+                                      SecretFilter(ReadFile(OutputFile, FileEncoding), If(FileName = "启动脚本.bat", "F", "*")),
+                                      Encoding:=FileEncoding)
                         End If
                     Next
                     '导出报告

+ 105 - 14
Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb

@@ -836,8 +836,8 @@
     ''' <summary>
     ''' NeoForge 版本列表,BMCLAPI。
     ''' </summary>
-    Public DlNeoForgeListBmclapiLoader As New LoaderTask(Of Integer, DlNeoForgeListResult)("DlNeoForgeList Bmclapi", AddressOf DlNeoForgeListOfficialMain)
-    Public Sub DlNeoForgeVersionBmclapiMain(Loader As LoaderTask(Of Integer, DlNeoForgeListResult))
+    Public DlNeoForgeListBmclapiLoader As New LoaderTask(Of Integer, DlNeoForgeListResult)("DlNeoForgeList Bmclapi", AddressOf DlNeoForgeListBmclapiMain)
+    Public Sub DlNeoForgeListBmclapiMain(Loader As LoaderTask(Of Integer, DlNeoForgeListResult))
         '获取版本列表 JSON
         Dim ResultLatest As String = NetGetCodeByDownload("https://bmclapi2.bangbang93.com/neoforge/meta/api/maven/details/releases/net/neoforged/neoforge", UseBrowserUserAgent:=True, IsJson:=True)
         Dim ResultLegacy As String = NetGetCodeByDownload("https://bmclapi2.bangbang93.com/neoforge/meta/api/maven/details/releases/net/neoforged/forge", UseBrowserUserAgent:=True, IsJson:=True)
@@ -1083,29 +1083,120 @@
 
 #End Region
 
+#Region "DlMod | Mod 镜像源请求"
+
+    ''' <summary>
+    ''' 对可能涉及 Mod 镜像源的请求进行处理,返回字符串或 JObject。
+    ''' 调用 NetGetCodeByRequestOnce。
+    ''' </summary>
+    Public Function DlModRequest(Url As String, Optional IsJson As Boolean = False) As Object
+        Dim McimUrl As String = DlSourceModGet(Url)
+        Dim Urls As New List(Of KeyValuePair(Of String, Integer))
+        If McimUrl <> Url Then
+            Select Case Setup.Get("ToolDownloadMod")
+                Case 0
+                    Urls.Add(New KeyValuePair(Of String, Integer)(McimUrl, 30))
+                    Urls.Add(New KeyValuePair(Of String, Integer)(Url, 60))
+                Case 1
+                    Urls.Add(New KeyValuePair(Of String, Integer)(Url, 5))
+                    Urls.Add(New KeyValuePair(Of String, Integer)(McimUrl, 35))
+                Case Else
+                    Urls.Add(New KeyValuePair(Of String, Integer)(Url, 60))
+                    Urls.Add(New KeyValuePair(Of String, Integer)(McimUrl, 60))
+            End Select
+        End If
+        Dim Exs As String = ""
+        For Each Source In Urls
+            Try
+                Return NetGetCodeByRequestOnce(Source.Key, Encode:=Encoding.UTF8, Timeout:=Source.Value * 1000,
+                                               IsJson:=IsJson, UseBrowserUserAgent:=True)
+            Catch ex As Exception
+                Exs += ex.Message + vbCrLf
+            End Try
+        Next
+        Throw New Exception(Exs)
+    End Function
+
+    ''' <summary>
+    ''' 对可能涉及 Mod 镜像源的请求进行处理。
+    ''' 调用 NetRequestOnce。
+    ''' </summary>
+    Public Function DlModRequest(Url As String, Method As String, Data As String, ContentType As String, Optional Headers As Dictionary(Of String, String) = Nothing) As String
+        Dim McimUrl As String = DlSourceModGet(Url)
+        Dim Urls As New List(Of KeyValuePair(Of String, Integer))
+        If McimUrl <> Url Then
+            Select Case Setup.Get("ToolDownloadMod")
+                Case 0
+                    Urls.Add(New KeyValuePair(Of String, Integer)(McimUrl, 30))
+                    Urls.Add(New KeyValuePair(Of String, Integer)(Url, 60))
+                Case 1
+                    Urls.Add(New KeyValuePair(Of String, Integer)(Url, 5))
+                    Urls.Add(New KeyValuePair(Of String, Integer)(McimUrl, 35))
+                Case Else
+                    Urls.Add(New KeyValuePair(Of String, Integer)(Url, 60))
+                    Urls.Add(New KeyValuePair(Of String, Integer)(McimUrl, 60))
+            End Select
+        End If
+        Dim Exs As String = ""
+        For Each Source In Urls
+            Try
+                Return NetRequestOnce(Source.Key, Method, Data, ContentType, Timeout:=Source.Value * 1000, Headers:=Headers)
+            Catch ex As Exception
+                Exs += ex.Message + vbCrLf
+            End Try
+        Next
+        Throw New Exception(Exs)
+    End Function
+
+#End Region
+
 #Region "DlSource | 镜像下载源"
 
-    Public Function DlSourceResourceGet(MojangBase As String) As String()
-        MojangBase = MojangBase.Replace("http://resources.download.minecraft.net", "https://resources.download.minecraft.net")
+    Public Function DlSourceResourceGet(Original As String) As String()
+        Original = Original.Replace("http://resources.download.minecraft.net", "https://resources.download.minecraft.net")
         Return {
-            MojangBase.Replace("https://piston-data.mojang.com", "https://bmclapi2.bangbang93.com/assets").Replace("https://piston-meta.mojang.com", "https://bmclapi2.bangbang93.com/assets").Replace("https://resources.download.minecraft.net", "https://bmclapi2.bangbang93.com/assets"),
-            MojangBase
+            Original.
+                Replace("https://piston-data.mojang.com", "https://bmclapi2.bangbang93.com/assets").
+                Replace("https://piston-meta.mojang.com", "https://bmclapi2.bangbang93.com/assets").
+                Replace("https://resources.download.minecraft.net", "https://bmclapi2.bangbang93.com/assets"),
+            Original
         }
     End Function
 
-    Public Function DlSourceLibraryGet(MojangBase As String) As String()
+    Public Function DlSourceLibraryGet(Original As String) As String()
         Return {
-            MojangBase.Replace("https://piston-data.mojang.com", "https://bmclapi2.bangbang93.com/maven").Replace("https://piston-meta.mojang.com", "https://bmclapi2.bangbang93.com/maven").Replace("https://libraries.minecraft.net", "https://bmclapi2.bangbang93.com/maven"),
-            MojangBase.Replace("https://piston-data.mojang.com", "https://bmclapi2.bangbang93.com/libraries").Replace("https://piston-meta.mojang.com", "https://bmclapi2.bangbang93.com/libraries").Replace("https://libraries.minecraft.net", "https://bmclapi2.bangbang93.com/libraries"),
-            MojangBase
+            Original.
+                Replace("https://piston-data.mojang.com", "https://bmclapi2.bangbang93.com/maven").
+                Replace("https://piston-meta.mojang.com", "https://bmclapi2.bangbang93.com/maven").
+                Replace("https://libraries.minecraft.net", "https://bmclapi2.bangbang93.com/maven"),
+            Original.
+                Replace("https://piston-data.mojang.com", "https://bmclapi2.bangbang93.com/libraries").
+                Replace("https://piston-meta.mojang.com", "https://bmclapi2.bangbang93.com/libraries").
+                Replace("https://libraries.minecraft.net", "https://bmclapi2.bangbang93.com/libraries"),
+            Original
         }
     End Function
 
-    Public Function DlSourceLauncherOrMetaGet(MojangBase As String) As String()
-        If MojangBase Is Nothing Then Throw New Exception("无对应的 json 下载地址")
+    Public Function DlSourceModGet(Original As String) As String
+        Return Original.
+            Replace("api.modrinth.com", "mod.mcimirror.top/modrinth").
+            Replace("staging-api.modrinth.com", "mod.mcimirror.top/modrinth").
+            Replace("cdn.modrinth.com", "mod.mcimirror.top").
+            Replace("api.curseforge.com", "mod.mcimirror.top/curseforge").
+            Replace("edge.forgecdn.net", "mod.mcimirror.top").
+            Replace("mediafilez.forgecdn.net", "mod.mcimirror.top").
+            Replace("media.forgecdn.net", "mod.mcimirror.top")
+    End Function
+
+    Public Function DlSourceLauncherOrMetaGet(Original As String) As String()
+        If Original Is Nothing Then Throw New Exception("无对应的 json 下载地址")
         Return {
-            MojangBase.Replace("https://piston-data.mojang.com", "https://bmclapi2.bangbang93.com").Replace("https://piston-meta.mojang.com", "https://bmclapi2.bangbang93.com").Replace("https://launcher.mojang.com", "https://bmclapi2.bangbang93.com").Replace("https://launchermeta.mojang.com", "https://bmclapi2.bangbang93.com"),
-            MojangBase
+            Original.
+                Replace("https://piston-data.mojang.com", "https://bmclapi2.bangbang93.com").
+                Replace("https://piston-meta.mojang.com", "https://bmclapi2.bangbang93.com").
+                Replace("https://launcher.mojang.com", "https://bmclapi2.bangbang93.com").
+                Replace("https://launchermeta.mojang.com", "https://bmclapi2.bangbang93.com"),
+            Original
         }
     End Function
 

+ 4 - 2
Plain Craft Launcher 2/Modules/Minecraft/ModJava.vb

@@ -1,5 +1,5 @@
 Public Module ModJava
-    Public JavaListCacheVersion As Integer = 6
+    Public JavaListCacheVersion As Integer = 7
 
     ''' <summary>
     ''' 目前所有可用的 Java。
@@ -220,6 +220,8 @@
                 JavaSearchFolder(GetPathFromFullPath(PathMcFolder), JavaPreList, False, True) 'Minecraft 文件夹的父文件夹(如果不是根目录的话)
             End If
             JavaSearchFolder(PathMcFolder, JavaPreList, False, True) 'Minecraft 文件夹
+            JavaPreList = JavaPreList.Where(Function(j) Not j.Key.Contains(".minecraft\runtime")).
+                ToDictionary(Function(j) j.Key, Function(j) j.Value) '排除官启自带 Java(#4286)
             If RelatedVersion IsNot Nothing Then JavaSearchFolder(RelatedVersion.Path, JavaPreList, False, True) '所选版本文件夹
             Dim TargetJavaList As New List(Of JavaEntry)
             For Each Entry In JavaPreList
@@ -550,7 +552,7 @@ NoUserJava:
             '若不全为特殊引用,则清除特殊引用的地址
             Dim JavaWithoutInherit As New Dictionary(Of String, Boolean)
             For Each Pair In JavaPreList
-                If Pair.Key.Contains("javapath_target_") OrElse Pair.Key.Contains("javatmp") Then
+                If Pair.Key.Contains("java8path_target_") OrElse Pair.Key.Contains("javapath_target_") OrElse Pair.Key.Contains("javatmp") Then
                     Log("[Java] 位于 " & Pair.Key & " 的 Java 包含特殊引用")
                 Else
                     Log("[Java] 位于 " & Pair.Key & " 的 Java 不含特殊引用")

+ 148 - 88
Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb

@@ -225,7 +225,7 @@ NextInner:
                                                "如果觉得 PCL 还算好用的话,也可以考虑赞助一下作者……一点心意也行……" & vbCrLf &
                                                "毕竟一个人开发也不容易(悲)……",
                                                "求赞助啦……", "这就赞助!", "但是我拒绝") = 1 Then
-                                       OpenWebsite("https://afdian.net/a/LTCat")
+                                       OpenWebsite("https://afdian.com/a/LTCat")
                                    End If
                            End Select
                        End Sub, "Donate")
@@ -510,6 +510,7 @@ NextInner:
             '无 RefreshToken
 Relogin:
             Dim OAuthCode As String = MsLoginStep1(Data)
+            If OAuthCode = "Cancel" Then Exit Sub
             If Data.IsAborted Then Throw New ThreadInterruptedException
             Data.Progress = 0.2
             OAuthTokens = MsLoginStep2(OAuthCode, False)
@@ -518,6 +519,7 @@ Relogin:
             OAuthTokens = MsLoginStep2(Input.OAuthRefreshToken, True)
         End If
         '要求重新打开登录网页认证
+        If OAuthTokens(0) = "Cancel" Then Exit Sub
         If OAuthTokens(0) = "Relogin" Then GoTo Relogin
         Data.Progress = 0.35
         If Data.IsAborted Then Throw New ThreadInterruptedException
@@ -808,62 +810,18 @@ LoginFinish:
     '微软登录步骤 1:打开网页认证,获取 OAuth Code
     Private Function MsLoginStep1(Data As LoaderTask(Of McLoginMs, McLoginResult)) As String
         McLaunchLog("开始微软登录步骤 1")
-        If True OrElse OsVersion <= New Version(10, 0, 17763, 0) Then '由于 #3849,WebBrowser 已经无法正常加载微软登录网页了
-SystemBrowser:
-            'Windows 7 或老版 Windows 10 登录
-            OpenWebsite(FormLoginOAuth.LoginUrl1)
-            Dim Result As String =
-                MyMsgBoxInput("等待网页登录",
-                              "登录完成后,网页会变得完全空白,把那个空白网页的网址复制到下面的框中就行了!" & vbCrLf &
-                              "如果网络环境不佳,它可能一直加载不出来,那就只能试试用 VPN 或加速器了。",
-                              ValidateRules:=New ObjectModel.Collection(Of Validate) From {New ValidateRegex("(?<=code\=)[^&]+", "返回网址应以 https://login.live.com/oauth20_desktop.srf?code= 开头")},
-                              HintText:="https://login.live.com/oauth20_desktop.srf?code=XXXXXX")
-            If Result Is Nothing Then
-                McLaunchLog("微软登录已在步骤 1 被取消")
-                Throw New ThreadInterruptedException("$$")
-            Else
-                Return RegexSeek(Result, "(?<=code\=)[^&]+")
-            End If
-            Hint("网页登录成功,你可以关闭浏览器啦!", HintType.Finish)
+        OpenWebsite(FormLoginOAuth.LoginUrl1)
+        Dim Result As String =
+            MyMsgBoxInput("等待网页登录",
+                          "登录完成后,网页会变得完全空白。把那个空白网页的网址复制到下面的框中就行!" & vbCrLf &
+                          "如果网络环境不佳,它可能一直加载不出来,那就只能试试用 VPN 或加速器了。",
+                          ValidateRules:=New ObjectModel.Collection(Of Validate) From {New ValidateRegex("(?<=code\=)[^&]+", "返回网址应以 https://login.live.com/oauth20_desktop.srf?code= 开头")},
+                          HintText:="https://login.live.com/oauth20_desktop.srf?code=XXXXXX")
+        If Result Is Nothing Then
+            McLaunchLog("微软登录已在步骤 1 被取消")
+            Throw New ThreadInterruptedException("$$")
         Else
-            'Windows 10 登录
-            Dim ReturnCode As String = Nothing
-            Dim ReturnEx As Exception = Nothing
-            Dim IsFinished As LoadState = LoadState.Loading
-            Dim LoginForm As FormLoginOAuth = Nothing
-            Dim IsSwitchToSystemBrowser As Boolean = False
-            RunInUi(Sub()
-                        Try
-                            LoginForm = New FormLoginOAuth
-                            LoginForm.Show()
-                            AddHandler LoginForm.OnLoginSuccess, Sub(Code As String)
-                                                                     ReturnCode = Code
-                                                                     IsFinished = LoadState.Finished
-                                                                 End Sub
-                            AddHandler LoginForm.OnLoginCanceled, Sub(IsSwitch As Boolean)
-                                                                      IsFinished = LoadState.Aborted
-                                                                      IsSwitchToSystemBrowser = IsSwitch
-                                                                  End Sub
-                        Catch ex As Exception
-                            ReturnEx = ex
-                            IsFinished = LoadState.Failed
-                        End Try
-                    End Sub)
-            Do While IsFinished = LoadState.Loading AndAlso Not Data.IsAborted
-                Thread.Sleep(20)
-            Loop
-            RunInUi(Sub() If LoginForm IsNot Nothing Then LoginForm.Close())
-            If IsFinished = LoadState.Finished Then
-                Return ReturnCode
-            ElseIf IsFinished = LoadState.Failed Then
-                Throw ReturnEx
-            ElseIf IsSwitchToSystemBrowser Then
-                McLaunchLog("微软登录在步骤 1 要求切换到系统浏览器")
-                GoTo SystemBrowser
-            Else
-                McLaunchLog("微软登录已在步骤 1 被取消")
-                Throw New ThreadInterruptedException("$$")
-            End If
+            Return RegexSeek(Result, "(?<=code\=)[^&]+")
         End If
     End Function
     '微软登录步骤 2:从 OAuth Code 或 OAuth RefreshToken 获取 {OAuth AccessToken, OAuth RefreshToken}
@@ -900,19 +858,112 @@ SystemBrowser:
         Dim RefreshToken As String = ResultJson("refresh_token").ToString
         Return {AccessToken, RefreshToken}
     End Function
+
+    ''微软登录步骤 1:获取 DeviceCode 并显示验证提示
+    ''https://learn.microsoft.com/zh-cn/entra/identity-platform/v2-oauth2-device-code
+    'Private Function MsLoginStep1(Data As LoaderTask(Of McLoginMs, McLoginResult)) As String
+    '    McLaunchLog("开始微软登录步骤 1:获取验证信息")
+    '    Dim PrepareJson As JObject = GetJson(NetRequestMulty("https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode", "POST",
+    '        $"client_id={OAuthClientId}&scope=XboxLive.signin%20offline_access", "application/x-www-form-urlencoded", 2))
+
+    '    '从这里开始直到步骤 2 结束都没有 Review
+    '    '参考:https://learn.microsoft.com/zh-cn/entra/identity-platform/v2-oauth2-device-code
+    '    If MyMsgBox("请在打开的网页里输入 PCL2 提供的设备代码(会自动复制到剪贴板)。" & vbCrLf &
+    '                            "设备代码有时效性,若操作时间过长需要重新进行登录流程。", "正版验证确认", "继续", "取消") <> 1 Then
+    '        Return "Cancel"
+    '    End If
+
+    '    Dim DeviceCode As String = PrepareJson("device_code")
+    '    Dim UserCode As String = PrepareJson("user_code")
+    '    Dim VerifyUri As String = PrepareJson("verification_uri")
+    '    'ResultJson("expires_in")
+    '    ClipboardSet(UserCode)
+    '    OpenWebsite(VerifyUri)
+
+    '    Dim MsgBoxValue As String = ""
+    '    While MsgBoxValue IsNot "1"
+    '        MsgBoxValue = MyMsgBox("本次验证的设备代码为:" & UserCode & vbCrLf & vbCrLf & "你也可以在任意设备上打开下列网址进行验证:" & vbCrLf & VerifyUri & vbCrLf & vbCrLf & "在验证完成后,你可以直接关闭这个弹窗,PCL2 会自动完成接下来的流程。", "正版验证", "关闭", "复制网址", "复制设备代码").ToString
+    '        If MsgBoxValue = "2" Then
+    '            ClipboardSet(VerifyUri)
+    '            Continue While
+    '        ElseIf MsgBoxValue = "3" Then
+    '            ClipboardSet(UserCode)
+    '            Continue While
+    '        ElseIf MsgBoxValue = "1" Then
+    '            Exit While
+    '        End If
+    '    End While
+
+    '    Return DeviceCode
+    'End Function
+
+    ''微软登录步骤 2:从 OAuth Code 或 OAuth RefreshToken 获取 {OAuth AccessToken, OAuth RefreshToken}
+    'Private Function MsLoginStep2(Code As String, IsRefresh As Boolean, Optional ExpiresIn As String = "900") As String()
+    '    McLaunchLog("开始微软登录步骤 2(" & If(IsRefresh, "", "非") & "刷新登录)")
+
+    '    Dim Request As String
+    '    If IsRefresh Then
+    '        Request = "grant_type=refresh_token" & "&" &
+    '                  "client_id=" & OAuthClientId & "&" &
+    '                  "device_code=" & Code & "&" &
+    '                  "refresh_token=" & Uri.EscapeDataString(Code) & "&" &
+    '                  "scope=XboxLive.signin%20offline_access"
+    '    Else
+    '        Request = "grant_type=urn:ietf:params:oauth:grant-type:device_code" & "&" &
+    '                  "client_id=" & OAuthClientId & "&" &
+    '                  "device_code=" & Code & "&" &
+    '                  "scope=XboxLive.signin%20offline_access"
+    '    End If
+    '    Dim Result As String
+    '    Dim stopwatch As Stopwatch = Stopwatch.StartNew()
+
+    '    While stopwatch.Elapsed < TimeSpan.FromSeconds(ExpiresIn)
+    '        Try
+    '            Result = NetRequestMulty("https://login.microsoftonline.com/consumers/oauth2/v2.0/token", "POST", Request, "application/x-www-form-urlencoded", 2)
+    '        Catch ex As Exception
+    '            If ex.Message.Contains("must sign in again") OrElse ex.Message.Contains("invalid_grant") Then '#269
+    '                Return {"Relogin", ""}
+    '            ElseIf ex.Message.Contains("authorization_declined") Then
+    '                Hint("你拒绝了 PCL2 的访问权限申请,验证过程被中断!")
+    '                Return {"Cancel", ""}
+    '            ElseIf ex.Message.Contains("expired_token") Then
+    '                Hint("Token 已过期,请尝试重新验证!")
+    '                Exit While
+    '            ElseIf ex.Message.Contains("AADSTS70016") Then
+    '                Continue While
+    '            Else
+    '                Throw
+    '            End If
+    '        End Try
+
+    '        If Result IsNot Nothing Then
+    '            Dim ResultJson As JObject = GetJson(Result)
+    '            Dim AccessToken As String = ResultJson("access_token").ToString
+    '            Dim RefreshToken As String = ResultJson("refresh_token").ToString
+    '            Return {AccessToken, RefreshToken}
+    '        End If
+
+    '        Thread.Sleep(1000)
+    '    End While
+
+    '    Hint("验证超时,请尝试重新验证!")
+    '    Return {"Cancel", ""}
+
+    'End Function
+
     '微软登录步骤 3:从 OAuth AccessToken 获取 XBLToken
     Private Function MsLoginStep3(AccessToken As String) As String
         McLaunchLog("开始微软登录步骤 3")
 
         Dim Request As String = "{
-                                    ""Properties"": {
-                                        ""AuthMethod"": ""RPS"",
-                                        ""SiteName"": ""user.auth.xboxlive.com"",
-                                        ""RpsTicket"": """ & AccessToken & """
-                                    },
-                                    ""RelyingParty"": ""http://auth.xboxlive.com"",
-                                    ""TokenType"": ""JWT""
-                                 }"
+           ""Properties"": {
+               ""AuthMethod"": ""RPS"",
+               ""SiteName"": ""user.auth.xboxlive.com"",
+               ""RpsTicket"": """ & AccessToken & """
+           },
+           ""RelyingParty"": ""http://auth.xboxlive.com"",
+           ""TokenType"": ""JWT""
+        }" 'TODO: 新版登录改为 ""RpsTicket"": ""d=" & AccessToken & """
         Dim Result As String = NetRequestMulty("https://user.auth.xboxlive.com/user/authenticate", "POST", Request, "application/json", 3)
 
         Dim ResultJson As JObject = GetJson(Result)
@@ -1069,7 +1120,7 @@ SystemBrowser:
             Case 3
                 '使用正版用户名
                 Try
-                    If Not SkinName = "" Then
+                    If SkinName <> "" AndAlso McVersionCurrent.Version.McCodeMain < 20 Then '1.20+ 或快照版不能使用该项(#3746)
                         Log("[Skin] 由于离线皮肤设置,使用正版 UUID:" & SkinName)
                         Uuid = McLoginMojangUuid(SkinName, False)
                     End If
@@ -1199,7 +1250,7 @@ SystemBrowser:
         '统一通行证检测
         If Setup.Get("LoginType") = McLoginType.Nide Then
             '至少 Java 8u101
-            MinVer = If(New Version(1, 8, 0, 101) > MinVer, New Version(1, 8, 0, 101), MinVer)
+            MinVer = If(New Version(1, 8, 0, 141) > MinVer, New Version(1, 8, 0, 141), MinVer)
         End If
 
         SyncLock JavaLock
@@ -1226,12 +1277,12 @@ SystemBrowser:
             ElseIf MaxVer < New Version(1, 8, 0, 0) Then
                 JavaCode = 7
                 If Not JavaDownloadConfirm("Java 7", True) Then Throw New Exception("$$")
-            ElseIf MinVer > New Version(1, 8, 0, 100) AndAlso MaxVer < New Version(1, 8, 0, 321) Then
-                JavaCode = "8u101"
-                If Not JavaDownloadConfirm("Java 8.0.101 ~ 8.0.320", True) Then Throw New Exception("$$")
-            ElseIf MinVer > New Version(1, 8, 0, 100) Then
-                JavaCode = "8u101"
-                If Not JavaDownloadConfirm("Java 8.0.101 或更高版本的 Java 8", True) Then Throw New Exception("$$")
+            ElseIf MinVer > New Version(1, 8, 0, 140) AndAlso MaxVer < New Version(1, 8, 0, 321) Then
+                JavaCode = "8u141"
+                If Not JavaDownloadConfirm("Java 8.0.141 ~ 8.0.320", True) Then Throw New Exception("$$")
+            ElseIf MinVer > New Version(1, 8, 0, 140) Then
+                JavaCode = "8u141"
+                If Not JavaDownloadConfirm("Java 8.0.141 或更高版本的 Java 8", True) Then Throw New Exception("$$")
             ElseIf MaxVer < New Version(1, 8, 0, 321) Then
                 JavaCode = 8
                 If Not JavaDownloadConfirm("Java 8.0.320 或更低版本的 Java 8") Then Throw New Exception("$$")
@@ -1276,27 +1327,40 @@ SystemBrowser:
     ''' 释放 Java Wrapper 并返回完整文件路径。
     ''' </summary>
     Public Function ExtractJavaWrapper() As String
-        Dim WrapperPath As String = GetJavaWrapperDir() & "\JavaWrapper.jar"
+        Dim BaseDir As String = GetJavaWrapperDir()
+        Dim WrapperPath As String = BaseDir & "\JavaWrapper.jar"
+        Log("[Java] 选定的 Java Wrapper 路径:" & WrapperPath)
         SyncLock ExtractJavaWrapperLock '避免 OptiFine 和 Forge 安装时同时释放 Java Wrapper 导致冲突
-            If Not WriteFile(WrapperPath, GetResources("JavaWrapper")) Then
-                Throw New FileNotFoundException("释放 Java Wrapper 失败")
+            Dim IsWrapperWritten As Boolean = WriteFile(WrapperPath, GetResources("JavaWrapper"))
+            If Not IsWrapperWritten AndAlso File.Exists(WrapperPath) Then
+                '以下为 #4243 的修复,因为未知原因 Java Wrapper 可能变为只读文件
+                Log("[Java] Java Wrapper 文件释放失败,但文件已存在,将在删除后尝试重新生成", LogLevel.Debug)
+                Try
+                    File.Delete(WrapperPath)
+                    IsWrapperWritten = WriteFile(WrapperPath, GetResources("JavaWrapper"))
+                Catch ex As Exception
+                    Log(ex, "Java Wrapper 文件重新释放失败,将尝试更换文件名重新生成")
+                    WrapperPath = BaseDir & "\JavaWrapper2.jar"
+                    IsWrapperWritten = WriteFile(WrapperPath, GetResources("JavaWrapper"))
+                End Try
             End If
+            If Not IsWrapperWritten Then Throw New FileNotFoundException("释放 Java Wrapper 失败,请查看 PCL 日志查找详细信息")
         End SyncLock
-        Log("[Java] 已释放 Java Wrapper:" & WrapperPath)
         Return WrapperPath
     End Function
     Private ExtractJavaWrapperLock As New Object
+
     ''' <summary>
     ''' 获取 Java Wrapper 所在的文件夹,不以 \ 结尾。
     ''' </summary>
     Public Function GetJavaWrapperDir() As String
-        If PathAppdata.IsASCII() Then
+        If (Path & "PCL").IsASCII() Then
+            Return Path & "PCL"
+        ElseIf PathAppdata.IsASCII() Then
             Return PathAppdata.TrimEnd("\")
         ElseIf PathTemp.IsASCII() Then
-            Log("[Java] Wrapper:AppData 路径中包含非 ASCII 字符,换用 Temp 目录")
             Return PathTemp.TrimEnd("\")
         Else
-            Log("[Java] Wrapper:AppData 路径与 Temp 路径中均包含非 ASCII 字符,换用 ProgramData 目录")
             Return OsDrive & "ProgramData\PCL"
         End If
     End Function
@@ -1772,7 +1836,6 @@ NextVersion:
             {
               ""authenticationDatabase"": {
                 ""00000111112222233333444445555566"": {
-                  ""accessToken"": """ & McLoginLoader.Output.AccessToken & """,
                   ""username"": """ & McLoginLoader.Output.Name.Replace("""", "-") & """,
                   ""profiles"": {
                     ""66666555554444433333222221111100"": {
@@ -1803,7 +1866,6 @@ NextVersion:
                     {
                       ""authenticationDatabase"": {
                         ""00000111112222233333444445555566"": {
-                          ""accessToken"": """ & McLoginLoader.Output.AccessToken & """,
                           ""username"": """ & McLoginLoader.Output.Name.Replace("""", "-") & """,
                           ""profiles"": {
                             ""66666555554444433333222221111100"": {
@@ -1879,16 +1941,12 @@ NextVersion:
         End Try
 
         '离线皮肤 Alex 警告
-        Try
-            If McVersionCurrent.Version.McCodeMain <= 7 AndAlso McVersionCurrent.Version.McCodeMain >= 2 AndAlso '1.7 ~ 1.2
+        If McVersionCurrent.Version.McCodeMain <= 7 AndAlso McVersionCurrent.Version.McCodeMain >= 2 AndAlso '1.2 ~ 1.7
                McLoginLoader.Input.Type = McLoginType.Legacy AndAlso '离线登录
                (Setup.Get("LaunchSkinType") = 2 OrElse '强制 Alex
                (Setup.Get("LaunchSkinType") = 4 AndAlso Setup.Get("LaunchSkinSlim"))) Then '或选用 Alex 皮肤
-                Hint("此 Minecraft 版本尚不支持 Alex 皮肤,你的皮肤可能会显示为 Steve!", HintType.Critical)
-            End If
-        Catch ex As Exception
-            Log(ex, "检查离线皮肤失效失败")
-        End Try
+            Hint("此 Minecraft 版本尚不支持 Alex 皮肤,你的皮肤可能会显示为 Steve!", HintType.Critical)
+        End If
 
         '离线皮肤资源包
         Try
@@ -2130,6 +2188,8 @@ IgnoreCustomSkin:
         StartInfo.EnvironmentVariables("Path") = Join(Paths.Distinct.ToList, ";")
 
         '设置其他参数
+        StartInfo.StandardErrorEncoding = Encoding.UTF8
+        StartInfo.StandardOutputEncoding = Encoding.UTF8
         StartInfo.WorkingDirectory = McVersionCurrent.PathIndie
         StartInfo.UseShellExecute = False
         StartInfo.RedirectStandardOutput = True

+ 6 - 4
Plain Craft Launcher 2/Modules/Minecraft/ModMinecraft.vb

@@ -565,6 +565,7 @@ Recheck:
                             Log(ex, "合并版本依赖项 json 失败(" & If(InheritVersion, "null").ToString & ")")
                         End Try
                     Catch ex As Exception
+                        Log($"[Minecraft] 传入的版本 json 文件内容(共 {Text.Length} 字符,最多输出前 5000 字符):{vbCrLf}{Text.Substring(0, 5000)}")
                         Throw New Exception("版本 json 不规范(" & If(Name, "null") & ")", ex)
                     End Try
                     Try
@@ -665,7 +666,7 @@ Recheck:
             Try
                 Dim JsonObjCheck = JsonObject
             Catch ex As Exception
-                Log(ex, "版本 json 可用性检查失败(" & Path & ")")
+                Log(ex, "版本 JSON 可用性检查失败(" & Path & ")")
                 JsonText = ""
                 JsonObject = Nothing
                 Info = ex.Message
@@ -2026,8 +2027,9 @@ OnLoaded:
             If Token.Url IsNot Nothing Then
                 '获取 Url 的真实地址
                 Urls.Add(Token.Url)
-                If Token.Url.Contains("launcher.mojang.com/v1/objects") Then
-                    Urls = DlSourceLauncherOrMetaGet(Token.Url).ToList() 'Mappings
+                If Token.Url.Contains("launcher.mojang.com/v1/objects") OrElse Token.Url.Contains("client.txt") OrElse
+                   Token.Url.Contains(".tsrg") Then
+                    Urls.AddRange(DlSourceLauncherOrMetaGet(Token.Url).ToList()) 'Mappings(#4425)
                 End If
                 If Token.Url.Contains("maven") Then
                     Urls.Insert(0, Token.Url.Replace(Mid(Token.Url, 1, Token.Url.IndexOfF("maven")), "https://bmclapi2.bangbang93.com/").
@@ -2049,7 +2051,7 @@ OnLoaded:
                 '普通文件
                 Urls.AddRange(DlSourceLibraryGet("https://libraries.minecraft.net" & Token.LocalPath.Replace(If(Token.IsJumpLoader, JumpLoaderFolder, CustomMcFolder) & "libraries", "").Replace("\", "/")))
             End If
-            Result.Add(New NetFile(Urls.Distinct.ToArray, Token.LocalPath, Checker))
+            Result.Add(New NetFile(Urls.Distinct, Token.LocalPath, Checker))
         Next
         '去重并返回
         Return Result.Distinct(Function(a, b) a.LocalPath = b.LocalPath)

+ 13 - 10
Plain Craft Launcher 2/Modules/Minecraft/ModMod.vb

@@ -924,7 +924,7 @@ Finished:
         End Try
     End Sub
     '联网加载 Mod 详情
-    Private Const LocalModCacheVersion As Integer = 5
+    Private Const LocalModCacheVersion As Integer = 6
     Public McModDetailLoader As New LoaderTask(Of KeyValuePair(Of List(Of McMod), JObject), Integer)("Mod List Detail Loader", AddressOf McModDetailLoad)
     Private Sub McModDetailLoad(Loader As LoaderTask(Of KeyValuePair(Of List(Of McMod), JObject), Integer))
         Dim Mods As List(Of McMod) = Loader.Input.Key
@@ -952,7 +952,7 @@ Finished:
             Try
                 '步骤 1:获取 Hash 与对应的工程 ID
                 Dim ModrinthHashes = Mods.Select(Function(m) m.ModrinthHash).ToList()
-                Dim ModrinthVersion = CType(GetJson(NetRequestRetry("https://api.modrinth.com/v2/version_files", "POST",
+                Dim ModrinthVersion = CType(GetJson(DlModRequest("https://api.modrinth.com/v2/version_files", "POST",
                     $"{{""hashes"": [""{ModrinthHashes.Join(""",""")}""], ""algorithm"": ""sha1""}}", "application/json")), JObject)
                 Log($"[Mod] 从 Modrinth 获取到 {ModrinthVersion.Count} 个本地 Mod 的对应信息")
                 '步骤 2:尝试读取工程信息缓存,构建其他 Mod 的对应关系
@@ -973,7 +973,7 @@ Finished:
                 Log($"[Mod] 需要从 Modrinth 获取 {ModrinthMapping.Count} 个本地 Mod 的工程信息")
                 '步骤 3:获取工程信息
                 If Not ModrinthMapping.Any() Then Exit Sub
-                Dim ModrinthProject = CType(GetJson(NetRequestRetry(
+                Dim ModrinthProject = CType(GetJson(DlModRequest(
                     $"https://api.modrinth.com/v2/projects?ids=[""{ModrinthMapping.Keys.Join(""",""")}""]",
                     "GET", "", "application/json")), JArray)
                 For Each ProjectJson In ModrinthProject
@@ -985,7 +985,7 @@ Finished:
                 Next
                 Log($"[Mod] 已从 Modrinth 获取本地 Mod 信息,继续获取更新信息")
                 '步骤 4:获取更新信息
-                Dim ModrinthUpdate = CType(GetJson(NetRequestRetry("https://api.modrinth.com/v2/version_files/update", "POST",
+                Dim ModrinthUpdate = CType(GetJson(DlModRequest("https://api.modrinth.com/v2/version_files/update", "POST",
                     $"{{""hashes"": [""{ModrinthMapping.SelectMany(Function(l) l.Value.Select(Function(m) m.ModrinthHash)).Join(""",""")}""], ""algorithm"": ""sha1"", 
                     ""loaders"": [""{ModLoaders.Join(""",""").ToLower}""],""game_versions"": [""{McVersion}""]}}", "application/json")), JObject)
                 For Each Entry In Mods
@@ -1022,7 +1022,7 @@ Finished:
                     CurseForgeHashes.Add(Entry.CurseForgeHash)
                     If Loader.IsAbortedWithThread(MainThread) Then Exit Sub
                 Next
-                Dim CurseForgeRaw = CType(CType(GetJson(NetRequestRetry("https://api.curseforge.com/v1/fingerprints/432/", "POST",
+                Dim CurseForgeRaw = CType(CType(GetJson(DlModRequest("https://api.curseforge.com/v1/fingerprints/432", "POST",
                                     $"{{""fingerprints"": [{CurseForgeHashes.Join(",")}]}}", "application/json")), JObject)("data")("exactMatches"), JContainer)
                 Log($"[Mod] 从 CurseForge 获取到 {CurseForgeRaw.Count} 个本地 Mod 的对应信息")
                 '步骤 2:尝试读取工程信息缓存,构建其他 Mod 的对应关系
@@ -1045,12 +1045,12 @@ Finished:
                 Log($"[Mod] 需要从 CurseForge 获取 {CurseForgeMapping.Count} 个本地 Mod 的工程信息")
                 '步骤 3:获取工程信息
                 If Not CurseForgeMapping.Any() Then Exit Sub
-                Dim CurseForgeProject = CType(GetJson(NetRequestRetry("https://api.curseforge.com/v1/mods", "POST",
+                Dim CurseForgeProject = CType(GetJson(DlModRequest("https://api.curseforge.com/v1/mods", "POST",
                                     $"{{""modIds"": [{CurseForgeMapping.Keys.Join(",")}]}}", "application/json")), JObject)("data")
                 Dim UpdateFileIds As New Dictionary(Of Integer, List(Of McMod)) 'FileId -> 本地 Mod 文件列表
                 Dim FileIdToProjectSlug As New Dictionary(Of Integer, String)
                 For Each ProjectJson In CurseForgeProject
-                    If Not ProjectJson("isAvailable").ToObject(Of Boolean) Then Continue For
+                    If ProjectJson("isAvailable") IsNot Nothing AndAlso Not ProjectJson("isAvailable").ToObject(Of Boolean) Then Continue For
                     '设置 Entry 中的工程信息
                     Dim Project As New CompProject(ProjectJson)
                     For Each Entry In CurseForgeMapping(Project.Id) '倒查防止 CurseForge 返回的内容有漏
@@ -1066,7 +1066,8 @@ Finished:
                         Dim NewestVersion As String = Nothing
                         Dim NewestFileIds As New List(Of Integer)
                         For Each IndexEntry In ProjectJson("latestFilesIndexes")
-                            If ModLoaders.Single <> IndexEntry("modLoader")?.ToObject(Of Integer) Then Continue For 'ModLoader 唯一且匹配
+                            If IndexEntry("modLoader") Is Nothing OrElse Not IndexEntry("modLoader").HasValues OrElse '镜像源会返回一个值为 null 的键
+                            ModLoaders.Single <> IndexEntry("modLoader").ToObject(Of Integer) Then Continue For 'ModLoader 唯一且匹配
                             Dim IndexVersion As String = IndexEntry("gameVersion")
                             If McVersion <> IndexVersion Then Continue For 'MC 版本匹配
                             '由于 latestFilesIndexes 是按时间从新到老排序的,所以只需取第一个;如果需要检查多个 releaseType 下的文件,将 > -1 改为 = 1,但这应当并不会获取到更新的文件
@@ -1087,7 +1088,7 @@ Finished:
                 Log($"[Mod] 已从 CurseForge 获取本地 Mod 信息,需要获取 {UpdateFileIds.Count} 个用于检查更新的文件信息")
                 '步骤 4:获取更新文件信息
                 If Not UpdateFileIds.Any() Then Exit Sub
-                Dim CurseForgeFiles = CType(GetJson(NetRequestRetry("https://api.curseforge.com/v1/mods/files", "POST",
+                Dim CurseForgeFiles = CType(GetJson(DlModRequest("https://api.curseforge.com/v1/mods/files", "POST",
                                     $"{{""fileIds"": [{UpdateFileIds.Keys.Join(",")}]}}", "application/json")), JObject)("data")
                 Dim UpdateFiles As New Dictionary(Of McMod, CompFile)
                 For Each FileJson In CurseForgeFiles
@@ -1134,6 +1135,8 @@ Finished:
             Cache(Entry.ModrinthHash & McVersion & ModLoaders.Join("")) = Entry.ToJson()
         Next
         WriteFile(PathTemp & "Cache\LocalMod.json", Cache.ToString(If(ModeDebug, Newtonsoft.Json.Formatting.Indented, Newtonsoft.Json.Formatting.None)))
+        '刷新下边栏(#4377)
+        RunInUi(Sub() FrmVersionMod?.RefreshBottomBar())
     End Sub
     Private Function GetTargetModLoaders() As List(Of CompModLoaderType)
         Dim ModLoaders As New List(Of CompModLoaderType)
@@ -1275,4 +1278,4 @@ Finished:
     End Function
 #End If
 
-End Module
+End Module

+ 136 - 138
Plain Craft Launcher 2/Modules/Minecraft/ModModpack.vb

@@ -12,9 +12,10 @@ Public Module ModModpack
         RunInThread(Sub() ModpackInstall(File))
     End Sub
     ''' <summary>
-    ''' 安装一个给定的整合包文件,返回是否安装成功。必须在工作线程执行。
+    ''' 安装一个给定的整合包文件,返回启动的安装加载器,如果未成功启动则返回 Nothing。
+    ''' 必须在工作线程执行。
     ''' </summary>
-    Public Function ModpackInstall(File As String, Optional VersionName As String = Nothing, Optional ShowHint As Boolean = True, Optional Logo As String = Nothing) As Boolean
+    Public Function ModpackInstall(File As String, Optional VersionName As String = Nothing, Optional ShowHint As Boolean = True, Optional Logo As String = Nothing) As LoaderCombo(Of String)
         Log("[ModPack] 整合包安装请求:" & If(File, "null"))
         Dim Archive As ZipArchive = Nothing
         Dim ArchiveBaseFolder As String = ""
@@ -45,6 +46,7 @@ Public Module ModModpack
                     If FullNames.Count <> 2 Then Continue For
                     '判断是否为关键文件
                     If FullNames(1) = "mcbbs.packmeta" Then PackType = 3 : Exit Try 'MCBBS 整合包(优先于 manifest.json 判断)
+                    If FullNames(1) = "mmc-pack.json" Then PackType = 2 : Exit Try 'MMC 整合包(优先于 manifest.json 判断,#4194)
                     If FullNames(1) = "modrinth.index.json" Then PackType = 4 : Exit Try 'Modrinth 整合包
                     If FullNames(1) = "manifest.json" Then
                         Dim Json As JObject = GetJson(ReadFile(Entry.Open, Encoding.UTF8))
@@ -55,54 +57,52 @@ Public Module ModModpack
                         End If
                     End If
                     If FullNames(1) = "modpack.json" Then PackType = 1 : Exit Try 'HMCL 整合包
-                    If FullNames(1) = "mmc-pack.json" Then PackType = 2 : Exit Try 'MMC 整合包
                 Next
             Catch ex As Exception
                 If GetExceptionDetail(ex, True).Contains("Error.WinIOError") Then
                     Log(ex, "打开整合包文件失败", If(ShowHint, LogLevel.Hint, LogLevel.Normal))
-                    Return False
+                    Return Nothing
                 ElseIf File.EndsWithF(".rar", True) Then
                     Log(ex, "PCL 无法处理 rar 格式的压缩包,请在解压后重新压缩为 zip 格式再试", If(ShowHint, LogLevel.Hint, LogLevel.Normal))
-                    Return False
+                    Return Nothing
                 Else
                     Log(ex, "打开整合包文件失败,文件可能损坏或为不支持的压缩包格式", If(ShowHint, LogLevel.Hint, LogLevel.Normal))
-                    Return False
+                    Return Nothing
                 End If
             End Try
             '执行对应的安装方法
             Select Case PackType
                 Case 0
                     Log("[ModPack] 整合包种类:CurseForge")
-                    InstallPackCurseForge(File, Archive, ArchiveBaseFolder, VersionName, Logo)
+                    Return InstallPackCurseForge(File, Archive, ArchiveBaseFolder, VersionName, Logo)
                 Case 1
                     Log("[ModPack] 整合包种类:HMCL")
-                    InstallPackHMCL(File, Archive, ArchiveBaseFolder)
+                    Return InstallPackHMCL(File, Archive, ArchiveBaseFolder)
                 Case 2
                     Log("[ModPack] 整合包种类:MMC")
-                    InstallPackMMC(File, Archive, ArchiveBaseFolder)
+                    Return InstallPackMMC(File, Archive, ArchiveBaseFolder)
                 Case 3
                     Log("[ModPack] 整合包种类:MCBBS")
-                    InstallPackMCBBS(File, Archive, ArchiveBaseFolder)
+                    Return InstallPackMCBBS(File, Archive, ArchiveBaseFolder, VersionName)
                 Case 4
                     Log("[ModPack] 整合包种类:Modrinth")
-                    InstallPackModrinth(File, Archive, ArchiveBaseFolder, VersionName, Logo)
+                    Return InstallPackModrinth(File, Archive, ArchiveBaseFolder, VersionName, Logo)
                 Case 9
                     Log("[ModPack] 整合包种类:压缩包")
                     Archive.Dispose()
                     Archive = Nothing
-                    InstallPackCompress(File, ArchiveBaseFolder)
+                    Return InstallPackCompress(File, ArchiveBaseFolder)
                 Case Else
                     If ShowHint Then
                         Hint("未能识别该整合包的种类,无法安装!", HintType.Critical)
                     Else
                         Log("[ModPack] 未能识别该整合包的种类,无法安装!")
                     End If
-                    Return False
+                    Return Nothing
             End Select
-            Return True
         Catch ex As Exception
             Log(ex, "准备安装整合包失败", LogLevel.Feedback)
-            Return False
+            Return Nothing
         Finally
             If Archive IsNot Nothing Then Archive.Dispose()
         End Try
@@ -159,7 +159,8 @@ Retry:
 #Region "不同类型整合包的安装方法"
 
     'CurseForge
-    Private Sub InstallPackCurseForge(FileAddress As String, Archive As Compression.ZipArchive, ArchiveBaseFolder As String, Optional VersionName As String = Nothing, Optional Logo As String = Nothing)
+    Private Function InstallPackCurseForge(FileAddress As String, Archive As Compression.ZipArchive, ArchiveBaseFolder As String,
+                                           Optional VersionName As String = Nothing, Optional Logo As String = Nothing) As LoaderCombo(Of String)
 
         '读取 Json 文件
         Dim Json As JObject
@@ -167,18 +168,18 @@ Retry:
             Json = GetJson(ReadFile(Archive.GetEntry(ArchiveBaseFolder & "manifest.json").Open))
             If Json("minecraft") Is Nothing OrElse Json("minecraft")("version") Is Nothing Then Throw New Exception("整合包未提供 Minecraft 版本信息")
         Catch ex As Exception
-            Log(ex, "整合包安装信息存在问题", LogLevel.Hint)
-            Exit Sub
+            Log(ex, "CurseForge 整合包安装信息存在问题", LogLevel.Hint)
+            Return Nothing
         End Try
 
         '获取版本名
         Dim ShowRibble As Boolean = VersionName Is Nothing
         If VersionName Is Nothing Then
-            Dim PackName As String = If(Json("name"), "")
+            VersionName = If(Json("name"), "")
             Dim Validate As New ValidateFolderName(PathMcFolder & "versions")
-            If Validate.Validate(PackName) <> "" Then PackName = ""
-            VersionName = MyMsgBoxInput("输入版本名称", "", PackName, New ObjectModel.Collection(Of Validate) From {Validate})
-            If String.IsNullOrEmpty(VersionName) Then Exit Sub
+            If Validate.Validate(VersionName) <> "" Then VersionName = ""
+            If VersionName = "" Then VersionName = MyMsgBoxInput("输入版本名称", "", "", New ObjectModel.Collection(Of Validate) From {Validate})
+            If String.IsNullOrEmpty(VersionName) Then Return Nothing
         End If
 
         '获取 Mod API 版本信息
@@ -191,7 +192,7 @@ Retry:
                 'Forge 指定
                 If Id.Contains("recommended") Then
                     Log("[ModPack] 该整合包版本过老,已不支持进行安装!", LogLevel.Hint)
-                    Exit Sub
+                    Return Nothing
                 End If
                 Try
                     Log("[ModPack] 整合包 Forge 版本:" & Id)
@@ -319,7 +320,7 @@ Retry:
             .FabricVersion = FabricVersion
         }
         Dim MergeLoaders As List(Of LoaderBase) = McInstallLoader(Request, True)
-        If MergeLoaders Is Nothing Then Exit Sub
+        If MergeLoaders Is Nothing Then Return Nothing
         '构造 Libraries 加载器
         Dim LoadersLib As New List(Of LoaderBase)
         LoadersLib.Add(New LoaderTask(Of String, List(Of NetFile))("分析游戏支持库文件(副加载器)", Sub(Task As LoaderTask(Of String, List(Of NetFile))) Task.Output = McLibFix(New McVersion(VersionName))) With {.ProgressWeight = 1, .Show = False})
@@ -350,14 +351,10 @@ Retry:
 
         '重复任务检查
         Dim LoaderName As String = "CurseForge 整合包安装:" & VersionName & " "
-        SyncLock LoaderTaskbarLock
-            For i = 0 To LoaderTaskbar.Count - 1
-                If LoaderTaskbar(i).Name = LoaderName Then
-                    Hint("该整合包正在安装中!", HintType.Critical)
-                    Exit Sub
-                End If
-            Next
-        End SyncLock
+        If LoaderTaskbar.Any(Function(l) l.Name = LoaderName) Then
+            Hint("该整合包正在安装中!", HintType.Critical)
+            Return Nothing
+        End If
 
         '启动
         Dim Loader As New LoaderCombo(Of String)(LoaderName, Loaders) With {.OnStateChanged = AddressOf McInstallState}
@@ -365,11 +362,11 @@ Retry:
         LoaderTaskbarAdd(Loader)
         FrmMain.BtnExtraDownload.ShowRefresh()
         If ShowRibble Then FrmMain.BtnExtraDownload.Ribble()
-
-    End Sub
+        Return Loader
+    End Function
 
     'Modrinth
-    Private Sub InstallPackModrinth(FileAddress As String, Archive As Compression.ZipArchive, ArchiveBaseFolder As String, Optional VersionName As String = Nothing, Optional Logo As String = Nothing)
+    Private Function InstallPackModrinth(FileAddress As String, Archive As Compression.ZipArchive, ArchiveBaseFolder As String, Optional VersionName As String = Nothing, Optional Logo As String = Nothing) As LoaderCombo(Of String)
 
         '读取 Json 文件
         Dim Json As JObject
@@ -378,7 +375,7 @@ Retry:
             If Json("dependencies") Is Nothing OrElse Json("dependencies")("minecraft") Is Nothing Then Throw New Exception("整合包未提供 Minecraft 版本信息")
         Catch ex As Exception
             Log(ex, "整合包安装信息存在问题", LogLevel.Hint)
-            Exit Sub
+            Return Nothing
         End Try
         '获取 Mod API 版本信息
         Dim MinecraftVersion As String = Nothing
@@ -400,42 +397,42 @@ Retry:
                     Log("[ModPack] 整合包 Fabric 版本:" & FabricVersion)
                 Case "quilt-loader" 'eg. 1.0.0
                     Hint("PCL 暂不支持安装需要 Quilt 的整合包!", HintType.Critical)
-                    Exit Sub
+                    Return Nothing
                 Case Else
                     Hint($"无法安装整合包,其中出现了未知的 Mod 加载器 {Entry.Value}!", HintType.Critical)
-                    Exit Sub
+                    Return Nothing
             End Select
         Next
         '获取版本名
         Dim ShowRibble As Boolean = VersionName Is Nothing
         If VersionName Is Nothing Then
-            Dim PackName As String = If(Json("name"), "")
+            VersionName = If(Json("name"), "")
             Dim Validate As New ValidateFolderName(PathMcFolder & "versions")
-            If Validate.Validate(PackName) <> "" Then PackName = ""
-            VersionName = MyMsgBoxInput("输入版本名称", "", PackName, New ObjectModel.Collection(Of Validate) From {Validate})
-            If String.IsNullOrEmpty(VersionName) Then Exit Sub
+            If Validate.Validate(VersionName) <> "" Then VersionName = ""
+            If VersionName = "" Then VersionName = MyMsgBoxInput("输入版本名称", "", "", New ObjectModel.Collection(Of Validate) From {Validate})
+            If String.IsNullOrEmpty(VersionName) Then Return Nothing
         End If
         '解压和配置文件
         Dim InstallTemp As String = PathTemp & "PackInstall\" & RandomInteger(0, 100000) & "\"
         Dim InstallLoaders As New List(Of LoaderBase)
         InstallLoaders.Add(New LoaderTask(Of String, Integer)("解压整合包文件",
-            Sub(Task As LoaderTask(Of String, Integer))
-                UnpackFiles(InstallTemp, FileAddress, Task)
-                Task.Progress = 0.5
-                '复制 overrides 文件夹和 client-overrides 文件夹
-                If Directory.Exists(InstallTemp & ArchiveBaseFolder & "overrides") Then
-                    CopyDirectory(InstallTemp & ArchiveBaseFolder & "overrides", PathMcFolder & "versions\" & VersionName)
-                Else
-                    Log("[ModPack] 整合包中未找到 override 目录,已跳过")
-                End If
-                Task.Progress = 0.8
-                If Directory.Exists(InstallTemp & ArchiveBaseFolder & "client-overrides") Then
-                    CopyDirectory(InstallTemp & ArchiveBaseFolder & "client-overrides", PathMcFolder & "versions\" & VersionName)
-                End If
-                Task.Progress = 0.9
-                '开启版本隔离
-                WriteIni(PathMcFolder & "versions\" & VersionName & "\PCL\Setup.ini", "VersionArgumentIndie", 1)
-            End Sub) With {.ProgressWeight = New FileInfo(FileAddress).Length / 1024 / 1024 / 6, .Block = False}) '每 6M 需要 1s
+        Sub(Task As LoaderTask(Of String, Integer))
+            UnpackFiles(InstallTemp, FileAddress, Task)
+            Task.Progress = 0.5
+            '复制 overrides 文件夹和 client-overrides 文件夹
+            If Directory.Exists(InstallTemp & ArchiveBaseFolder & "overrides") Then
+                CopyDirectory(InstallTemp & ArchiveBaseFolder & "overrides", PathMcFolder & "versions\" & VersionName)
+            Else
+                Log("[ModPack] 整合包中未找到 override 目录,已跳过")
+            End If
+            Task.Progress = 0.8
+            If Directory.Exists(InstallTemp & ArchiveBaseFolder & "client-overrides") Then
+                CopyDirectory(InstallTemp & ArchiveBaseFolder & "client-overrides", PathMcFolder & "versions\" & VersionName)
+            End If
+            Task.Progress = 0.9
+            '开启版本隔离
+            WriteIni(PathMcFolder & "versions\" & VersionName & "\PCL\Setup.ini", "VersionArgumentIndie", 1)
+        End Sub) With {.ProgressWeight = New FileInfo(FileAddress).Length / 1024 / 1024 / 6, .Block = False}) '每 6M 需要 1s
         '获取下载文件列表
         Dim FileList As New List(Of NetFile)
         For Each File In If(Json("files"), {})
@@ -452,8 +449,10 @@ Retry:
                 End Select
             End If
             '添加下载文件
-            FileList.Add(New NetFile(File("downloads").Select(Function(t) t.ToString.Replace("://edge.forgecdn", "://media.forgecdn")).ToArray, '修复 #2390
-                PathMcFolder & "versions\" & VersionName & "\" & File("path").ToString,
+            Dim Urls = File("downloads").Select(Function(t) t.ToString.Replace("://edge.forgecdn", "://media.forgecdn")).ToList
+            Urls.AddRange(Urls.Select(Function(u) DlSourceModGet(u)).ToList)
+            Urls = Urls.Distinct.ToList()
+            FileList.Add(New NetFile(Urls, PathMcFolder & "versions\" & VersionName & "\" & File("path").ToString,
                 New FileChecker(ActualSize:=File("fileSize").ToObject(Of Long), Hash:=File("hashes")("sha1").ToString), True))
         Next
         If FileList.Any Then
@@ -470,7 +469,7 @@ Retry:
             .FabricVersion = FabricVersion
         }
         Dim MergeLoaders As List(Of LoaderBase) = McInstallLoader(Request, True)
-        If MergeLoaders Is Nothing Then Exit Sub
+        If MergeLoaders Is Nothing Then Return Nothing
         '构造 Libraries 加载器
         Dim LoadersLib As New List(Of LoaderBase)
         LoadersLib.Add(New LoaderTask(Of String, List(Of NetFile))("分析游戏支持库文件(副加载器)", Sub(Task As LoaderTask(Of String, List(Of NetFile))) Task.Output = McLibFix(New McVersion(VersionName))) With {.ProgressWeight = 1, .Show = False})
@@ -501,14 +500,10 @@ Retry:
 
         '重复任务检查
         Dim LoaderName As String = "Modrinth 整合包安装:" & VersionName & " "
-        SyncLock LoaderTaskbarLock
-            For i = 0 To LoaderTaskbar.Count - 1
-                If LoaderTaskbar(i).Name = LoaderName Then
-                    Hint("该整合包正在安装中!", HintType.Critical)
-                    Exit Sub
-                End If
-            Next
-        End SyncLock
+        If LoaderTaskbar.Any(Function(l) l.Name = LoaderName) Then
+            Hint("该整合包正在安装中!", HintType.Critical)
+            Return Nothing
+        End If
 
         '启动
         Dim Loader As New LoaderCombo(Of String)(LoaderName, Loaders) With {.OnStateChanged = AddressOf McInstallState}
@@ -516,25 +511,26 @@ Retry:
         LoaderTaskbarAdd(Loader)
         FrmMain.BtnExtraDownload.ShowRefresh()
         If ShowRibble Then FrmMain.BtnExtraDownload.Ribble()
+        Return Loader
 
-    End Sub
+    End Function
 
     'HMCL
-    Private Sub InstallPackHMCL(FileAddress As String, Archive As Compression.ZipArchive, ArchiveBaseFolder As String)
+    Private Function InstallPackHMCL(FileAddress As String, Archive As Compression.ZipArchive, ArchiveBaseFolder As String) As LoaderCombo(Of String)
         '读取 Json 文件
         Dim Json As JObject
         Try
             Json = GetJson(ReadFile(Archive.GetEntry(ArchiveBaseFolder & "modpack.json").Open, Encoding.UTF8))
         Catch ex As Exception
             Log(ex, "整合包安装信息存在问题", LogLevel.Hint)
-            Exit Sub
+            Return Nothing
         End Try
         '获取版本名
-        Dim PackName As String = If(Json("name"), "")
+        Dim VersionName As String = If(Json("name"), "")
         Dim Validate As New ValidateFolderName(PathMcFolder & "versions")
-        If Validate.Validate(PackName) <> "" Then PackName = ""
-        Dim VersionName As String = MyMsgBoxInput("输入版本名称", "", PackName, New ObjectModel.Collection(Of Validate) From {Validate})
-        If VersionName Is Nothing Then Exit Sub
+        If Validate.Validate(VersionName) <> "" Then VersionName = ""
+        If VersionName = "" Then VersionName = MyMsgBoxInput("输入版本名称", "", "", New ObjectModel.Collection(Of Validate) From {Validate})
+        If String.IsNullOrEmpty(VersionName) Then Return Nothing
         '解压与配置文件
         Dim InstallTemp As String = PathTemp & "PackInstall\" & RandomInteger(0, 100000) & "\"
         Dim InstallLoaders As New List(Of LoaderBase)
@@ -555,7 +551,7 @@ Retry:
         '构造加载器
         If Json("gameVersion") Is Nothing Then
             Hint("该整合包未提供游戏版本信息,无法安装!", HintType.Critical)
-            Exit Sub
+            Return Nothing
         End If
         Dim Request As New McInstallRequest With {
             .TargetVersionName = VersionName,
@@ -563,7 +559,7 @@ Retry:
             .MinecraftName = Json("gameVersion").ToString
         }
         Dim MergeLoaders As List(Of LoaderBase) = McInstallLoader(Request, True)
-        If MergeLoaders Is Nothing Then Exit Sub
+        If MergeLoaders Is Nothing Then Return Nothing
         '构造 Libraries 加载器(为了使得 Mods 下载结束后再构造,这样才会下载 JumpLoader 文件)
         Dim LoadersLib As New List(Of LoaderBase)
         LoadersLib.Add(New LoaderTask(Of String, String)("重命名版本 Json(副加载器)",
@@ -591,14 +587,10 @@ Retry:
 
         '重复任务检查
         Dim LoaderName As String = "HMCL 整合包安装:" & VersionName & " "
-        SyncLock LoaderTaskbarLock
-            For i = 0 To LoaderTaskbar.Count - 1
-                If LoaderTaskbar(i).Name = LoaderName Then
-                    Hint("该整合包正在安装中!", HintType.Critical)
-                    Exit Sub
-                End If
-            Next
-        End SyncLock
+        If LoaderTaskbar.Any(Function(l) l.Name = LoaderName) Then
+            Hint("该整合包正在安装中!", HintType.Critical)
+            Return Nothing
+        End If
 
         '启动
         Dim Loader As New LoaderCombo(Of String)(LoaderName, Loaders) With {.OnStateChanged = AddressOf McInstallState}
@@ -607,10 +599,11 @@ Retry:
         LoaderTaskbarAdd(Loader)
         FrmMain.BtnExtraDownload.ShowRefresh()
         FrmMain.BtnExtraDownload.Ribble()
-    End Sub
+        Return Loader
+    End Function
 
     'MMC
-    Private Sub InstallPackMMC(FileAddress As String, Archive As Compression.ZipArchive, ArchiveBaseFolder As String)
+    Private Function InstallPackMMC(FileAddress As String, Archive As Compression.ZipArchive, ArchiveBaseFolder As String) As LoaderCombo(Of String)
         '读取 Json 文件
         Dim PackJson As JObject, PackInstance As String
         Try
@@ -618,14 +611,14 @@ Retry:
             PackInstance = ReadFile(Archive.GetEntry(ArchiveBaseFolder & "instance.cfg").Open, Encoding.UTF8)
         Catch ex As Exception
             Log(ex, "整合包安装信息存在问题", LogLevel.Hint)
-            Exit Sub
+            Return Nothing
         End Try
         '获取版本名
-        Dim PackName As String = If(RegexSeek(PackInstance, "(?<=\nname\=)[^\n]+"), "")
+        Dim VersionName As String = If(RegexSeek(PackInstance, "(?<=\nname\=)[^\n]+"), "")
         Dim Validate As New ValidateFolderName(PathMcFolder & "versions")
-        If Validate.Validate(PackName) <> "" Then PackName = ""
-        Dim VersionName As String = MyMsgBoxInput("输入版本名称", "", PackName, New ObjectModel.Collection(Of Validate) From {Validate})
-        If VersionName Is Nothing Then Exit Sub
+        If Validate.Validate(VersionName) <> "" Then VersionName = ""
+        If VersionName = "" Then VersionName = MyMsgBoxInput("输入版本名称", "", "", New ObjectModel.Collection(Of Validate) From {Validate})
+        If String.IsNullOrEmpty(VersionName) Then Return Nothing
         '解压、配置设置文件
         Dim InstallTemp As String = $"{PathTemp}PackInstall\{RandomInteger(0, 100000)}\"
         Dim SetupFile As String = $"{PathMcFolder}versions\{VersionName}\PCL\Setup.ini"
@@ -685,7 +678,7 @@ Retry:
         '构造版本安装请求
         If PackJson("components") Is Nothing Then
             Hint("该整合包未提供游戏版本信息,无法安装!", HintType.Critical)
-            Exit Sub
+            Return Nothing
         End If
         Dim Request As New McInstallRequest With {.TargetVersionName = VersionName, .TargetVersionFolder = $"{PathMcFolder}versions\{VersionName}\"}
         For Each Component In PackJson("components")
@@ -702,12 +695,12 @@ Retry:
                     Request.FabricVersion = Component("version")
                 Case "org.quiltmc.quilt-loader" 'eg. 1.0.0
                     Hint("PCL 暂不支持安装需要 Quilt 的整合包!", HintType.Critical)
-                    Exit Sub
+                    Return Nothing
             End Select
         Next
         '构造加载器
         Dim MergeLoaders As List(Of LoaderBase) = McInstallLoader(Request, True)
-        If MergeLoaders Is Nothing Then Exit Sub
+        If MergeLoaders Is Nothing Then Return Nothing
         '构造 Libraries 加载器
         Dim LoadersLib As New List(Of LoaderBase)
         LoadersLib.Add(New LoaderTask(Of String, List(Of NetFile))("分析游戏支持库文件(副加载器)", Sub(Task As LoaderTask(Of String, List(Of NetFile))) Task.Output = McLibFix(New McVersion(VersionName))) With {.ProgressWeight = 1, .Show = False})
@@ -720,14 +713,10 @@ Retry:
 
         '重复任务检查
         Dim LoaderName As String = "MMC 整合包安装:" & VersionName & " "
-        SyncLock LoaderTaskbarLock
-            For i = 0 To LoaderTaskbar.Count - 1
-                If LoaderTaskbar(i).Name = LoaderName Then
-                    Hint("该整合包正在安装中!", HintType.Critical)
-                    Exit Sub
-                End If
-            Next
-        End SyncLock
+        If LoaderTaskbar.Any(Function(l) l.Name = LoaderName) Then
+            Hint("该整合包正在安装中!", HintType.Critical)
+            Return Nothing
+        End If
 
         '启动
         Dim Loader As New LoaderCombo(Of String)(LoaderName, Loaders) With {.OnStateChanged = AddressOf McInstallState}
@@ -735,10 +724,12 @@ Retry:
         LoaderTaskbarAdd(Loader)
         FrmMain.BtnExtraDownload.ShowRefresh()
         FrmMain.BtnExtraDownload.Ribble()
-    End Sub
+        Return Loader
+    End Function
 
     'MCBBS
-    Private Sub InstallPackMCBBS(FileAddress As String, Archive As Compression.ZipArchive, ArchiveBaseFolder As String)
+    Private Function InstallPackMCBBS(FileAddress As String, Archive As Compression.ZipArchive, ArchiveBaseFolder As String,
+                                      Optional VersionName As String = Nothing) As LoaderCombo(Of String)
         '读取 Json 文件
         Dim Json As JObject
         Try
@@ -746,14 +737,17 @@ Retry:
             Json = GetJson(ReadFile(Entry.Open, Encoding.UTF8))
         Catch ex As Exception
             Log(ex, "整合包安装信息存在问题", LogLevel.Hint)
-            Exit Sub
+            Return Nothing
         End Try
         '获取版本名
-        Dim PackName As String = If(Json("name"), "")
-        Dim Validate As New ValidateFolderName(PathMcFolder & "versions")
-        If Validate.Validate(PackName) <> "" Then PackName = ""
-        Dim VersionName As String = MyMsgBoxInput("输入版本名称", "", PackName, New ObjectModel.Collection(Of Validate) From {Validate})
-        If VersionName Is Nothing Then Exit Sub
+        Dim ShowRibble As Boolean = VersionName Is Nothing
+        If VersionName Is Nothing Then
+            VersionName = If(Json("name"), "")
+            Dim Validate As New ValidateFolderName(PathMcFolder & "versions")
+            If Validate.Validate(VersionName) <> "" Then VersionName = ""
+            If VersionName = "" Then VersionName = MyMsgBoxInput("输入版本名称", "", "", New ObjectModel.Collection(Of Validate) From {Validate})
+            If String.IsNullOrEmpty(VersionName) Then Return Nothing
+        End If
         '解压与配置文件
         Dim InstallTemp As String = PathTemp & "PackInstall\" & RandomInteger(0, 100000) & "\"
         Dim InstallLoaders As New List(Of LoaderBase)
@@ -774,7 +768,7 @@ Retry:
         '构造加载器
         If Json("addons") Is Nothing Then
             Hint("该整合包未提供游戏版本附加信息,无法安装!", HintType.Critical)
-            Exit Sub
+            Return Nothing
         End If
         Dim Addons As New Dictionary(Of String, String)
         For Each Entry In Json("addons")
@@ -782,11 +776,11 @@ Retry:
         Next
         If Not Addons.ContainsKey("game") Then
             Hint("该整合包未提供游戏版本信息,无法安装!", HintType.Critical)
-            Exit Sub
+            Return Nothing
         End If
         If Addons.ContainsKey("quilt") Then
             Hint("PCL 暂不支持安装需要 Quilt 的整合包!", HintType.Critical)
-            Exit Sub
+            Return Nothing
         End If
         Dim Request As New McInstallRequest With {
             .TargetVersionName = VersionName,
@@ -798,7 +792,7 @@ Retry:
             .FabricVersion = If(Addons.ContainsKey("fabric"), Addons("fabric"), Nothing)
         }
         Dim MergeLoaders As List(Of LoaderBase) = McInstallLoader(Request, True)
-        If MergeLoaders Is Nothing Then Exit Sub
+        If MergeLoaders Is Nothing Then Return Nothing
         '构造 Libraries 加载器
         Dim LoadersLib As New List(Of LoaderBase)
         LoadersLib.Add(New LoaderTask(Of String, List(Of NetFile))("分析游戏支持库文件(副加载器)", Sub(Task As LoaderTask(Of String, List(Of NetFile))) Task.Output = McLibFix(New McVersion(VersionName))) With {.ProgressWeight = 1, .Show = False})
@@ -811,14 +805,10 @@ Retry:
 
         '重复任务检查
         Dim LoaderName As String = "MCBBS 整合包安装:" & VersionName & " "
-        SyncLock LoaderTaskbarLock
-            For i = 0 To LoaderTaskbar.Count - 1
-                If LoaderTaskbar(i).Name = LoaderName Then
-                    Hint("该整合包正在安装中!", HintType.Critical)
-                    Exit Sub
-                End If
-            Next
-        End SyncLock
+        If LoaderTaskbar.Any(Function(l) l.Name = LoaderName) Then
+            Hint("该整合包正在安装中!", HintType.Critical)
+            Return Nothing
+        End If
 
         '启动
         Dim Loader As New LoaderCombo(Of String)(LoaderName, Loaders) With {.OnStateChanged = AddressOf McInstallState}
@@ -826,28 +816,36 @@ Retry:
         Loader.Start(Request.TargetVersionFolder)
         LoaderTaskbarAdd(Loader)
         FrmMain.BtnExtraDownload.ShowRefresh()
-        FrmMain.BtnExtraDownload.Ribble()
-    End Sub
+        If ShowRibble Then FrmMain.BtnExtraDownload.Ribble()
+        Return Loader
+    End Function
 
     '普通压缩包
-    Private Sub InstallPackCompress(FileAddress As String, ArchiveBaseFolder As String)
+    Private Function InstallPackCompress(FileAddress As String, ArchiveBaseFolder As String) As LoaderCombo(Of String)
         MyMsgBox("请在接下来打开的窗口中选择安装目标文件夹,它必须是一个空文件夹。", "安装提示", "继续", ForceWait:=True)
         '获取解压路径
         Dim TargetFolder As String = SelectFolder("选择安装目标(必须是一个空文件夹)")
-        If String.IsNullOrEmpty(TargetFolder) Then Exit Sub
-        If TargetFolder.Contains("!") OrElse TargetFolder.Contains(";") Then Hint("Minecraft 文件夹路径中不能含有感叹号或分号!", HintType.Critical) : Exit Sub
-        If Directory.GetFileSystemEntries(TargetFolder).Length > 0 Then Hint("请选择一个空文件夹作为安装目标!", HintType.Critical) : Exit Sub
+        If String.IsNullOrEmpty(TargetFolder) Then Return Nothing
+        If TargetFolder.Contains("!") OrElse TargetFolder.Contains(";") Then Hint("Minecraft 文件夹路径中不能含有感叹号或分号!", HintType.Critical) : Return Nothing
+        If Directory.GetFileSystemEntries(TargetFolder).Length > 0 Then Hint("请选择一个空文件夹作为安装目标!", HintType.Critical) : Return Nothing
         '要求显示名称
         Dim NewName As String = MyMsgBoxInput("输入显示名称", "输入该文件夹在左边栏列表中显示的名称。", GetFolderNameFromPath(TargetFolder),
                                               New ObjectModel.Collection(Of Validate) From {New ValidateNullOrWhiteSpace, New ValidateLength(1, 30), New ValidateExcept({">", "|"})})
-        If String.IsNullOrWhiteSpace(NewName) Then Exit Sub
+        If String.IsNullOrWhiteSpace(NewName) Then Return Nothing
         '解压
-        Hint("正在解压压缩包……")
-        UnpackFiles(TargetFolder, FileAddress, Nothing)
-        '加入文件夹列表
-        PageSelectLeft.AddFolder(TargetFolder, NewName, False)
-        Hint("已加入游戏文件夹列表:" & NewName, HintType.Finish)
-    End Sub
+        Dim Loader As New LoaderCombo(Of String)("安装压缩包", {
+             New LoaderTask(Of String, Integer)("安装压缩包",
+             Sub()
+                 UnpackFiles(TargetFolder, FileAddress, Nothing)
+                 PageSelectLeft.AddFolder(TargetFolder, NewName, False) '加入文件夹列表
+             End Sub)
+        })
+        Loader.Start()
+        LoaderTaskbarAdd(Loader)
+        FrmMain.BtnExtraDownload.ShowRefresh()
+        FrmMain.BtnExtraDownload.Ribble()
+        Return Loader
+    End Function
 
 #End Region
 

+ 7 - 7
Plain Craft Launcher 2/Modules/ModSecret.vb

@@ -10,6 +10,8 @@ Friend Module ModSecret
 
     '在开源内容的注册表键与普通内容的注册表键隔离
     Public Const RegFolder As String = "PCLDebug"
+    '用于微软登录的 ClientId
+    Public Const OAuthClientId As String = ""
 
     Friend Sub SecretOnApplicationStart()
         '提升 UI 线程优先级
@@ -41,8 +43,9 @@ Friend Module ModSecret
             Environment.[Exit](Result.Cancel)
         End If
         '开源版本提示
-        MyMsgBox($"该版本中不包含以下特性:
-- CurseForge 查询:需要 API Key(你可以申请一个,然后添加到 SecretHeadersSign 方法中)
+        MyMsgBox($"该版本中无法使用以下特性:
+- CurseForge API 调用:需要你自行申请 API Key,然后添加到 SecretHeadersSign 方法中
+- 正版登录:需要你自行申请 Client ID,然后添加到 ModSecret.vb 的开头
 - 更新与联网通知:避免滥用隐患
 - 主题切换:这是需要赞助解锁的纪念性质的功能,别让赞助者太伤心啦……
 - 百宝箱:开发早期往里面塞了些开发工具,整理起来太麻烦了", "开源版本说明")
@@ -89,7 +92,6 @@ Friend Module ModSecret
 #Region "网络鉴权"
 
     Friend Function SecretCdnSign(UrlWithMark As String)
-        '只处理以 {CDN} 结尾的链接
         If Not UrlWithMark.EndsWithF("{CDN}") Then Return UrlWithMark
         Return UrlWithMark.Replace("{CDN}", "").Replace(" ", "%20")
     End Function
@@ -97,26 +99,24 @@ Friend Module ModSecret
     ''' 设置 Headers 的 UA、Referer。
     ''' </summary>
     Friend Sub SecretHeadersSign(Url As String, ByRef Client As CookieWebClient, Optional UseBrowserUserAgent As Boolean = False)
-        If ApplicationStartTick < 1 Then Return '禁止在没有运行程序的情况下通过反射调用
         If UseBrowserUserAgent Then
             Client.Headers("User-Agent") = "PCL2/" & VersionStandardCode & " Mozilla/5.0 AppleWebKit/537.36 Chrome/63.0.3239.132 Safari/537.36"
         Else
             Client.Headers("User-Agent") = "PCL2/" & VersionStandardCode
         End If
-        Client.Headers("Referer") = "http://" & VersionCode & ".pcl2.server/"
+        Client.Headers("Referer") = "http://" & VersionCode & ".pcl2.open.server/"
         '如果你有 CurseForge API Key,请添加到 Headers 中,以恢复对 CurseForge 的访问
     End Sub
     ''' <summary>
     ''' 设置 Headers 的 UA、Referer。
     ''' </summary>
     Friend Sub SecretHeadersSign(Url As String, ByRef Request As HttpWebRequest, Optional UseBrowserUserAgent As Boolean = False)
-        If ApplicationStartTick < 1 Then Return '禁止在没有运行程序的情况下通过反射调用
         If UseBrowserUserAgent Then
             Request.UserAgent = "PCL2/" & VersionStandardCode & " Mozilla/5.0 AppleWebKit/537.36 Chrome/63.0.3239.132 Safari/537.36"
         Else
             Request.UserAgent = "PCL2/" & VersionStandardCode
         End If
-        Request.Referer = "http://" & VersionCode & ".pcl2.server/"
+        Request.Referer = "http://" & VersionCode & ".pcl2.open.server/"
         '如果你有 CurseForge API Key,请添加到 Headers 中,以恢复对 CurseForge 的访问
     End Sub
 

+ 2 - 2
Plain Craft Launcher 2/My Project/AssemblyInfo.vb

@@ -51,6 +51,6 @@ Imports System.Runtime.InteropServices
 ' 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
 ' 方法是按如下所示使用“*”
 
-<Assembly: AssemblyVersion("2.8.2.0")>
-<Assembly: AssemblyFileVersion("2.8.2.0")>
+<Assembly: AssemblyVersion("2.8.4.0")>
+<Assembly: AssemblyFileVersion("2.8.4.0")>
 <Assembly: NeutralResourcesLanguage("")>

+ 112 - 129
Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb

@@ -28,15 +28,12 @@ Public Module ModDownloadLib
             Dim VersionFolder As String = PathMcFolder & "versions\" & Id & "\"
 
             '重复任务检查
-            SyncLock LoaderTaskbarLock
-                For i = 0 To LoaderTaskbar.Count - 1
-                    If LoaderTaskbar(i).Name = "Minecraft " & Id & " 下载" Then
-                        If Behaviour = NetPreDownloadBehaviour.ExitWhileExistsOrDownloading Then Return LoaderTaskbar(i)
-                        Hint("该版本正在下载中!", HintType.Critical)
-                        Return LoaderTaskbar(i)
-                    End If
-                Next
-            End SyncLock
+            For Each OngoingLoader In LoaderTaskbar
+                If OngoingLoader.Name <> $"Minecraft {Id} 下载" Then Continue For
+                If Behaviour = NetPreDownloadBehaviour.ExitWhileExistsOrDownloading Then Return OngoingLoader
+                Hint("该版本正在下载中!", HintType.Critical)
+                Return OngoingLoader
+            Next
 
             '已有版本检查
             If Behaviour <> NetPreDownloadBehaviour.IgnoreCheck AndAlso File.Exists(VersionFolder & Id & ".json") AndAlso File.Exists(VersionFolder & Id & ".jar") Then
@@ -74,15 +71,12 @@ Public Module ModDownloadLib
             VersionFolder = VersionFolder & Id & "\"
 
             '重复任务检查
-            SyncLock LoaderTaskbarLock
-                For i = 0 To LoaderTaskbar.Count - 1
-                    If LoaderTaskbar(i).Name = "Minecraft " & Id & " 下载" Then
-                        If Behaviour = NetPreDownloadBehaviour.ExitWhileExistsOrDownloading Then Exit Sub
-                        Hint("该版本正在下载中!", HintType.Critical)
-                        Exit Sub
-                    End If
-                Next
-            End SyncLock
+            For Each OngoingLoader In LoaderTaskbar
+                If OngoingLoader.Name <> $"Minecraft {Id} 下载" Then Continue For
+                If Behaviour = NetPreDownloadBehaviour.ExitWhileExistsOrDownloading Then Exit Sub
+                Hint("该版本正在下载中!", HintType.Critical)
+                Exit Sub
+            Next
 
             Dim Loaders As New List(Of LoaderBase)
             '下载版本 Json 文件
@@ -323,14 +317,11 @@ Public Module ModDownloadLib
             If Not Target.Contains("\") Then Exit Sub
 
             '重复任务检查
-            SyncLock LoaderTaskbarLock
-                For i = 0 To LoaderTaskbar.Count - 1
-                    If LoaderTaskbar(i).Name = "OptiFine " & DownloadInfo.NameDisplay & " 下载" Then
-                        Hint("该版本正在下载中!", HintType.Critical)
-                        Exit Sub
-                    End If
-                Next
-            End SyncLock
+            For Each OngoingLoader In LoaderTaskbar
+                If OngoingLoader.Name <> $"OptiFine {DownloadInfo.NameDisplay} 下载" Then Continue For
+                Hint("该版本正在下载中!", HintType.Critical)
+                Exit Sub
+            Next
 
             Dim Loader As New LoaderCombo(Of DlOptiFineListEntry)("OptiFine " & DownloadInfo.NameDisplay & " 下载", McDownloadOptiFineSaveLoader(DownloadInfo, Target)) With {.OnStateChanged = AddressOf DownloadStateSave}
             Loader.Start(DownloadInfo)
@@ -753,14 +744,11 @@ Retry:
             Dim VersionFolder As String = PathMcFolder & "versions\" & VersionName & "\"
 
             '重复任务检查
-            SyncLock LoaderTaskbarLock
-                For i = 0 To LoaderTaskbar.Count - 1
-                    If LoaderTaskbar(i).Name = "LiteLoader " & Id & " 下载" Then
-                        Hint("该版本正在下载中!", HintType.Critical)
-                        Exit Sub
-                    End If
-                Next
-            End SyncLock
+            For Each OngoingLoader In LoaderTaskbar
+                If OngoingLoader.Name <> $"LiteLoader {Id} 下载" Then Continue For
+                Hint("该版本正在下载中!", HintType.Critical)
+                Exit Sub
+            Next
 
             '已有版本检查
             If File.Exists(VersionFolder & VersionName & ".json") Then
@@ -790,14 +778,11 @@ Retry:
             If Not Target.Contains("\") Then Exit Sub
 
             '重复任务检查
-            SyncLock LoaderTaskbarLock
-                For i = 0 To LoaderTaskbar.Count - 1
-                    If LoaderTaskbar(i).Name = "LiteLoader " & Id & " 下载" Then
-                        Hint("该版本正在下载中!", HintType.Critical)
-                        Exit Sub
-                    End If
-                Next
-            End SyncLock
+            For Each OngoingLoader In LoaderTaskbar
+                If OngoingLoader.Name <> $"LiteLoader {Id} 下载" Then Continue For
+                Hint("该版本正在下载中!", HintType.Critical)
+                Exit Sub
+            Next
 
             '构造步骤加载器
             Dim Loaders As New List(Of LoaderBase)
@@ -975,14 +960,11 @@ Retry:
             If Not Target.Contains("\") Then Exit Sub
 
             '重复任务检查
-            SyncLock LoaderTaskbarLock
-                For i = 0 To LoaderTaskbar.Count - 1
-                    If LoaderTaskbar(i).Name = DisplayName & " 下载" Then
-                        Hint("该版本正在下载中!", HintType.Critical)
-                        Exit Sub
-                    End If
-                Next
-            End SyncLock
+            For Each OngoingLoader In LoaderTaskbar
+                If OngoingLoader.Name <> $"{DisplayName} 下载" Then Continue For
+                Hint("该版本正在下载中!", HintType.Critical)
+                Exit Sub
+            Next
 
             '获取下载地址
             Dim Files As New List(Of NetFile)
@@ -1278,15 +1260,17 @@ Retry:
                         '[net.minecraft:client:1.17.1-20210706.113038:mappings@txt] 或 @tsrg]
                         Dim OriginalName As String = Json("data")("MOJMAPS")("client").ToString.Trim("[]".ToCharArray()).Before("@")
                         Dim Address = McLibGet(OriginalName).Replace(".jar", "-mappings." & Json("data")("MOJMAPS")("client").ToString.Trim("[]".ToCharArray()).Split("@")(1))
-                        Libs.Add(New McLibToken With {.IsJumpLoader = False, .IsNatives = False, .LocalPath = Address, .OriginalName = OriginalName,
-                                                                                                            .Url = RawJson("downloads")("client_mappings")("url"), .Size = RawJson("downloads")("client_mappings")("size"), .SHA1 = RawJson("downloads")("client_mappings")("sha1")})
-                        Log("[Download] 需要下载 Mappings:" & Address)
+                        Dim ClientMappings As JToken = RawJson("downloads")("client_mappings")
+                        Libs.Add(New McLibToken With {
+                                 .IsJumpLoader = False, .IsNatives = False, .LocalPath = Address, .OriginalName = OriginalName,
+                                 .Url = ClientMappings("url"), .Size = ClientMappings("size"), .SHA1 = ClientMappings("sha1")})
+                        Log($"[Download] 需要下载 Mappings:{ClientMappings("url")} (SHA1: {ClientMappings("sha1")})")
                     End If
                     Task.Progress = 0.8
                     '去除其中的原始 Forgelike 项
                     For i = 0 To Libs.Count - 1
                         If Libs(i).LocalPath.EndsWithF($"{LoaderName.ToLower}-{Inherit}-{LoaderVersion}.jar") OrElse
-                           Libs(i).LocalPath.EndsWithF($"{LoaderName.ToLower}-{Inherit}-{LoaderVersion}-client.jar") Then
+Libs(i).LocalPath.EndsWithF($"{LoaderName.ToLower}-{Inherit}-{LoaderVersion}-client.jar") Then
                             Log($"[Download] 已从待下载 {LoaderName} 支持库中移除:" & Libs(i).LocalPath, LogLevel.Debug)
                             Libs.RemoveAt(i)
                             Exit For
@@ -1413,55 +1397,55 @@ Retry:
             End Sub) With {.ProgressWeight = 10})
         Else
             Log("[Download] 检测为非新版 Forge:" & LoaderVersion)
-                        Loaders.Add(New LoaderTask(Of List(Of NetFile), Boolean)($"安装 {LoaderName}(方式 B)",
-            Sub(Task As LoaderTask(Of List(Of NetFile), Boolean))
-                Dim Installer As ZipArchive = Nothing
-                Try
-                    '解压并获取信息
-                    Installer = New ZipArchive(New FileStream(InstallerAddress, FileMode.Open))
-                    Task.Progress = 0.2
-                    Dim Json As JObject = GetJson(ReadFile(Installer.GetEntry("install_profile.json").Open))
-                    Task.Progress = 0.4
-                    '新建版本文件夹
-                    Directory.CreateDirectory(VersionFolder)
-                    Task.Progress = 0.5
-                    If Json("install") Is Nothing Then
-                        '中版:Legacy 方式 1
-                        Log("[Download] 开始进行 Forge 安装,Legacy 方式 1:" & InstallerAddress)
-                        '建立 Json 文件
-                        Dim JsonVersion As JObject = GetJson(ReadFile(Installer.GetEntry(Json("json").ToString.TrimStart("/")).Open))
-                        JsonVersion("id") = TargetVersion
-                        WriteFile(VersionFolder & TargetVersion & ".json", JsonVersion.ToString)
-                        Task.Progress = 0.6
-                        '解压支持库文件
-                        Installer.Dispose()
-                        ExtractFile(InstallerAddress, InstallerAddress & "_unrar\")
-                        CopyDirectory(InstallerAddress & "_unrar\maven\", McFolder & "libraries\")
-                        DeleteDirectory(InstallerAddress & "_unrar\")
-                    Else
-                        '旧版:Legacy 方式 2
-                        Log("[Download] 开始进行 Forge 安装,Legacy 方式 2:" & InstallerAddress)
-                        '解压 Jar 文件
-                        Dim JarAddress As String = McLibGet(Json("install")("path"), CustomMcFolder:=McFolder)
-                        If File.Exists(JarAddress) Then File.Delete(JarAddress)
-                        WriteFile(JarAddress, Installer.GetEntry(Json("install")("filePath")).Open)
-                        Task.Progress = 0.9
-                        '建立 Json 文件
-                        Json("versionInfo")("id") = TargetVersion
-                        If Json("versionInfo")("inheritsFrom") Is Nothing Then CType(Json("versionInfo"), JObject).Add("inheritsFrom", Inherit)
-                        WriteFile(VersionFolder & TargetVersion & ".json", Json("versionInfo").ToString)
-                    End If
-                    '新建 mods 文件夹
-                    Directory.CreateDirectory(New McVersion(VersionFolder).GetPathIndie(True) & "mods\")
-                Catch ex As Exception
-                    Throw New Exception("非新版方式安装 Forge 失败", ex)
-                Finally
-                    Try
-                        '清理文件
-                        If Installer IsNot Nothing Then Installer.Dispose()
-                        If File.Exists(InstallerAddress) Then File.Delete(InstallerAddress)
-                        If Directory.Exists(InstallerAddress & "_unrar\") Then DeleteDirectory(InstallerAddress & "_unrar\")
-                    Catch ex As Exception
+            Loaders.Add(New LoaderTask(Of List(Of NetFile), Boolean)($"安装 {LoaderName}(方式 B)",
+Sub(Task As LoaderTask(Of List(Of NetFile), Boolean))
+    Dim Installer As ZipArchive = Nothing
+    Try
+        '解压并获取信息
+        Installer = New ZipArchive(New FileStream(InstallerAddress, FileMode.Open))
+        Task.Progress = 0.2
+        Dim Json As JObject = GetJson(ReadFile(Installer.GetEntry("install_profile.json").Open))
+        Task.Progress = 0.4
+        '新建版本文件夹
+        Directory.CreateDirectory(VersionFolder)
+        Task.Progress = 0.5
+        If Json("install") Is Nothing Then
+            '中版:Legacy 方式 1
+            Log("[Download] 开始进行 Forge 安装,Legacy 方式 1:" & InstallerAddress)
+            '建立 Json 文件
+            Dim JsonVersion As JObject = GetJson(ReadFile(Installer.GetEntry(Json("json").ToString.TrimStart("/")).Open))
+            JsonVersion("id") = TargetVersion
+            WriteFile(VersionFolder & TargetVersion & ".json", JsonVersion.ToString)
+            Task.Progress = 0.6
+            '解压支持库文件
+            Installer.Dispose()
+            ExtractFile(InstallerAddress, InstallerAddress & "_unrar\")
+            CopyDirectory(InstallerAddress & "_unrar\maven\", McFolder & "libraries\")
+            DeleteDirectory(InstallerAddress & "_unrar\")
+        Else
+            '旧版:Legacy 方式 2
+            Log("[Download] 开始进行 Forge 安装,Legacy 方式 2:" & InstallerAddress)
+            '解压 Jar 文件
+            Dim JarAddress As String = McLibGet(Json("install")("path"), CustomMcFolder:=McFolder)
+            If File.Exists(JarAddress) Then File.Delete(JarAddress)
+            WriteFile(JarAddress, Installer.GetEntry(Json("install")("filePath")).Open)
+            Task.Progress = 0.9
+            '建立 Json 文件
+            Json("versionInfo")("id") = TargetVersion
+            If Json("versionInfo")("inheritsFrom") Is Nothing Then CType(Json("versionInfo"), JObject).Add("inheritsFrom", Inherit)
+            WriteFile(VersionFolder & TargetVersion & ".json", Json("versionInfo").ToString)
+        End If
+        '新建 mods 文件夹
+        Directory.CreateDirectory(New McVersion(VersionFolder).GetPathIndie(True) & "mods\")
+    Catch ex As Exception
+        Throw New Exception("非新版方式安装 Forge 失败", ex)
+    Finally
+        Try
+            '清理文件
+            If Installer IsNot Nothing Then Installer.Dispose()
+            If File.Exists(InstallerAddress) Then File.Delete(InstallerAddress)
+            If Directory.Exists(InstallerAddress & "_unrar\") Then DeleteDirectory(InstallerAddress & "_unrar\")
+        Catch ex As Exception
                         Log(ex, "非新版方式安装 Forge 清理文件时出错")
                     End Try
                 End Try
@@ -1730,14 +1714,11 @@ Retry:
             If Not Target.Contains("\") Then Exit Sub
 
             '重复任务检查
-            SyncLock LoaderTaskbarLock
-                For i = 0 To LoaderTaskbar.Count - 1
-                    If LoaderTaskbar(i).Name = "Fabric " & Version & " 安装器下载" Then
-                        Hint("该版本正在下载中!", HintType.Critical)
-                        Exit Sub
-                    End If
-                Next
-            End SyncLock
+            For Each OngoingLoader In LoaderTaskbar
+                If OngoingLoader.Name <> $"Fabric {Version} 安装器下载" Then Continue For
+                Hint("该版本正在下载中!", HintType.Critical)
+                Exit Sub
+            Next
 
             '构造步骤加载器
             Dim Loaders As New List(Of LoaderBase)
@@ -1773,26 +1754,26 @@ Retry:
         '下载 Json
         MinecraftName = MinecraftName.Replace("∞", "infinite") '放在 ID 后面避免影响版本文件夹名称
         Loaders.Add(New LoaderTask(Of String, List(Of NetFile))("获取 Fabric 主文件下载地址",
-                                                            Sub(Task As LoaderTask(Of String, List(Of NetFile)))
-                                                                '启动依赖版本的下载
-                                                                If FixLibrary Then
-                                                                    McDownloadClient(NetPreDownloadBehaviour.ExitWhileExistsOrDownloading, MinecraftName)
-                                                                End If
-                                                                Task.Progress = 0.5
-                                                                '构造文件请求
-                                                                Task.Output = New List(Of NetFile) From {New NetFile({
-                                                                    "https://bmclapi2.bangbang93.com/fabric-meta/v2/versions/loader/" & MinecraftName & "/" & FabricVersion & "/profile/json",
-                                                                    "https://meta.fabricmc.net/v2/versions/loader/" & MinecraftName & "/" & FabricVersion & "/profile/json"
-                                                                }, VersionFolder & Id & ".json", New FileChecker(IsJson:=True))}
-                                                                '新建 mods 文件夹
-                                                                Directory.CreateDirectory(New McVersion(VersionFolder).GetPathIndie(True) & "mods\")
-                                                            End Sub) With {.ProgressWeight = 0.5})
+        Sub(Task As LoaderTask(Of String, List(Of NetFile)))
+            '启动依赖版本的下载
+            If FixLibrary Then
+                McDownloadClient(NetPreDownloadBehaviour.ExitWhileExistsOrDownloading, MinecraftName)
+            End If
+            Task.Progress = 0.5
+            '构造文件请求
+            Task.Output = New List(Of NetFile) From {New NetFile({
+                "https://bmclapi2.bangbang93.com/fabric-meta/v2/versions/loader/" & MinecraftName & "/" & FabricVersion & "/profile/json",
+                "https://meta.fabricmc.net/v2/versions/loader/" & MinecraftName & "/" & FabricVersion & "/profile/json"
+            }, VersionFolder & Id & ".json", New FileChecker(IsJson:=True))}
+            '新建 mods 文件夹
+            Directory.CreateDirectory(New McVersion(VersionFolder).GetPathIndie(True) & "mods\")
+        End Sub) With {.ProgressWeight = 0.5})
         Loaders.Add(New LoaderDownload("下载 Fabric 主文件", New List(Of NetFile)) With {.ProgressWeight = 2.5})
 
         '下载支持库
         If FixLibrary Then
             Loaders.Add(New LoaderTask(Of String, List(Of NetFile))("分析 Fabric 支持库文件",
-                                                                Sub(Task As LoaderTask(Of String, List(Of NetFile))) Task.Output = McLibFix(New McVersion(VersionFolder))) With {.ProgressWeight = 1, .Show = False})
+                Sub(Task) Task.Output = McLibFix(New McVersion(VersionFolder))) With {.ProgressWeight = 1, .Show = False})
             Loaders.Add(New LoaderDownload("下载 Fabric 支持库文件", New List(Of NetFile)) With {.ProgressWeight = 8})
         End If
 
@@ -2039,9 +2020,11 @@ Retry:
         Dim LiteLoaderFolder As String = Nothing
         If Request.LiteLoaderEntry IsNot Nothing Then LiteLoaderFolder = TempMcFolder & "versions\" & Request.MinecraftName & "-LiteLoader"
 
-        'OptiFine 是否作为 Mod 进行下载
-        Dim OptiFineAsMod As Boolean =
-            (Request.OptiFineEntry IsNot Nothing OrElse Request.OptiFineVersion IsNot Nothing) AndAlso Request.FabricVersion IsNot Nothing
+        '判断 OptiFine 是否作为 Mod 进行下载
+        Dim MinecraftCode As Integer = If(Request.MinecraftName.Contains("."), Request.MinecraftName.Split(".")(1), 99)
+        Dim OptiFineAsMod As Boolean = Request.OptiFineEntry IsNot Nothing AndAlso '1. 选择了 OptiFine
+            (Request.FabricVersion IsNot Nothing OrElse '2. 选择了 Fabric...
+            (Request.ForgeEntry IsNot Nothing AndAlso MinecraftCode >= 14 AndAlso MinecraftCode <= 15)) '...或者 Forge 1.14~15(#4134)
         If OptiFineAsMod Then
             Log("[Download] OptiFine 将作为 Mod 进行下载")
             OptiFineFolder = New McVersion(OutputFolder).GetPathIndie(True) & "mods\"

+ 7 - 1
Plain Craft Launcher 2/Pages/PageDownload/PageDownloadClient.xaml.vb

@@ -43,6 +43,12 @@
                                 Type = "愚人节版"
                                 Version("type") = "special"
                                 Version.Add("lore", GetMcFoolName(Version("id")))
+                            Case Else '4/1 自动视作愚人节版
+                                Dim ReleaseDate = Version("releaseTime").Value(Of Date).ToUniversalTime().AddHours(2)
+                                If ReleaseDate.Month = 4 AndAlso ReleaseDate.Day = 1 Then
+                                    Type = "愚人节版"
+                                    Version("type") = "special"
+                                End If
                         End Select
                     Case "special"
                         '已被处理的愚人节版
@@ -56,7 +62,7 @@
             '排序
             For i = 0 To Dict.Keys.Count - 1
                 Dict(Dict.Keys(i)) = Sort(Dict.Values(i),
-                                          Function(a, b) a("releaseTime").Value(Of Date) > b("releaseTime").Value(Of Date))
+                    Function(a, b) a("releaseTime").Value(Of Date) > b("releaseTime").Value(Of Date))
             Next
             '清空当前
             PanMain.Children.Clear()

+ 5 - 5
Plain Craft Launcher 2/Pages/PageDownload/PageDownloadCompDetail.xaml.vb

@@ -170,11 +170,11 @@
             Dim LogoFileAddress As String = PathTemp & "CompLogo\" & GetHash(CompItem.Logo) & ".png"
             Loaders.Add(New LoaderDownload("下载整合包文件", New List(Of NetFile) From {File.ToNetFile(Target)}) With {.ProgressWeight = 10, .Block = True})
             Loaders.Add(New LoaderTask(Of Integer, Integer)("准备安装整合包",
-                Sub()
-                    If Not ModpackInstall(Target, VersionName, Logo:=If(IO.File.Exists(LogoFileAddress), LogoFileAddress, Nothing)) Then
-                        Throw New Exception("整合包安装出现异常!")
-                    End If
-                End Sub) With {.ProgressWeight = 0.1})
+            Sub()
+                If ModpackInstall(Target, VersionName, Logo:=If(IO.File.Exists(LogoFileAddress), LogoFileAddress, Nothing)) Is Nothing Then
+                    Throw New Exception("整合包安装出现异常!")
+                End If
+            End Sub) With {.ProgressWeight = 0.1})
 
             '启动
             Dim Loader As New LoaderCombo(Of String)(LoaderName, Loaders) With {.OnStateChanged =

+ 6 - 0
Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb

@@ -618,6 +618,12 @@
                                 Type = "愚人节版"
                                 Version("type") = "special"
                                 Version.Add("lore", GetMcFoolName(Version("id")))
+                            Case Else '4/1 自动视作愚人节版
+                                Dim ReleaseDate = Version("releaseTime").Value(Of Date).ToUniversalTime().AddHours(2)
+                                If ReleaseDate.Month = 4 AndAlso ReleaseDate.Day = 1 Then
+                                    Type = "愚人节版"
+                                    Version("type") = "special"
+                                End If
                         End Select
                     Case "special"
                         '已被处理的愚人节版

+ 1 - 0
Plain Craft Launcher 2/Pages/PageDownload/PageDownloadMod.xaml

@@ -33,6 +33,7 @@
                         <TextBlock VerticalAlignment="Center" Grid.Row="2" HorizontalAlignment="Left" Text="版本" Margin="0,0,18,0" />
                         <local:MyComboBox x:Name="TextSearchVersion" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" IsEditable="True" MaxDropDownHeight="320">
                             <local:MyComboBoxItem Content="全部 (也可自行输入)" IsSelected="True" />
+                            <local:MyComboBoxItem Content="1.21.1" />
                             <local:MyComboBoxItem Content="1.21" />
                             <local:MyComboBoxItem Content="1.20.6" />
                             <local:MyComboBoxItem Content="1.20.4" />

+ 2 - 1
Plain Craft Launcher 2/Pages/PageDownload/PageDownloadPack.xaml

@@ -32,6 +32,7 @@
                         <TextBlock VerticalAlignment="Center" Grid.Row="2" HorizontalAlignment="Left" Text="版本" Margin="0,0,18,0" />
                         <local:MyComboBox x:Name="TextSearchVersion" Grid.Row="2" Grid.Column="1" IsEditable="True" MaxDropDownHeight="320">
                             <local:MyComboBoxItem Content="全部 (也可自行输入)" IsSelected="True" />
+                            <local:MyComboBoxItem Content="1.21.1" />
                             <local:MyComboBoxItem Content="1.21" />
                             <local:MyComboBoxItem Content="1.20.6" />
                             <local:MyComboBoxItem Content="1.20.4" />
@@ -60,7 +61,7 @@
                             <local:MyComboBoxItem Tag="4472/technology" Content="科技" />
                             <local:MyComboBoxItem Tag="4473/magic" Content="魔法" />
                             <local:MyComboBoxItem Tag="4475/adventure" Content="冒险" />
-                            <local:MyComboBoxItem Tag="/kitchen-sink" Content="烹饪" />
+                            <local:MyComboBoxItem Tag="/kitchen-sink" Content="大杂烩" />
                             <local:MyComboBoxItem Tag="4476/" Content="探索" />
                             <local:MyComboBoxItem Tag="4477/" Content="小游戏" />
                             <local:MyComboBoxItem Tag="4471/" Content="科幻" />

+ 2 - 1
Plain Craft Launcher 2/Pages/PageLaunch/MySkin.xaml.vb

@@ -241,7 +241,8 @@ Retry:
                             {"Translator-Chinese", "Crowdin 中文翻译者披风"}, {"Translator", "Crowdin 翻译者披风"}, {"Cobalt", "Cobalt 披风"},
                             {"Vanilla", "原版披风"}, {"Minecon2011", "Minecon 2011 参与者披风"}, {"Minecon2012", "Minecon 2012 参与者披风"},
                             {"Minecon2013", "Minecon 2013 参与者披风"}, {"Minecon2015", "Minecon 2015 参与者披风"}, {"Minecon2016", "Minecon 2016 参与者披风"},
-                            {"Cherry Blossom", "樱花披风"}, {"15th Anniversary", "15 周年纪念披风"}, {"Purple Heart", "紫色心形披风"}, {"Follower's", "追随者披风"}
+                            {"Cherry Blossom", "樱花披风"}, {"15th Anniversary", "15 周年纪念披风"}, {"Purple Heart", "紫色心形披风"},
+                            {"Follower's", "追随者披风"}, {"MCC 15th Year", "MCC 15 周年披风"}
                         }
                         Dim SelectionControl As New List(Of IMyRadio) From {New MyRadioBox With {.Text = "无披风"}}
                         For Each Cape In SkinData("capes")

+ 38 - 24
Plain Craft Launcher 2/Pages/PageLaunch/PageLaunchLeft.xaml.vb

@@ -21,19 +21,27 @@
         '加载版本
         RunInNewThread(
         Sub()
-            ''自动整合包安装:准备
-            'Dim PackInstallPath As String = Nothing
-            'If File.Exists(Path & "modpack.zip") Then PackInstallPath = Path & "modpack.zip"
-            'If File.Exists(Path & "modpack.mrpack") Then PackInstallPath = Path & "modpack.mrpack"
-            'If PackInstallPath IsNot Nothing Then
-            '    Log("[Launch] 需自动安装整合包:" & PackInstallPath, LogLevel.Debug)
-            '    If Not Directory.Exists(Path & ".minecraft\") Then
-            '        Directory.CreateDirectory(Path & ".minecraft\")
-            '        Directory.CreateDirectory(Path & ".minecraft\versions\")
-            '        McFolderLauncherProfilesJsonCreate(Path & ".minecraft\")
-            '    End If
-            '    Setup.Set("LaunchFolderSelect", "$.minecraft\")
-            'End If
+            '自动整合包安装:准备
+            Dim PackInstallPath As String = Nothing
+            If File.Exists(Path & "modpack.zip") Then PackInstallPath = Path & "modpack.zip"
+            If File.Exists(Path & "modpack.mrpack") Then PackInstallPath = Path & "modpack.mrpack"
+            If PackInstallPath IsNot Nothing Then
+                If MyMsgBox($"PCL 即将在当前文件夹下自动安装整合包。", "自动安装", "继续", "取消") = 1 Then
+                    '确认自动安装
+                    Log("[Launch] 需自动安装整合包:" & PackInstallPath, LogLevel.Debug)
+                    Setup.Set("LaunchFolderSelect", "$.minecraft\")
+                    If Not Directory.Exists(Path & ".minecraft\") Then
+                        Directory.CreateDirectory(Path & ".minecraft\")
+                        Directory.CreateDirectory(Path & ".minecraft\versions\")
+                        McFolderLauncherProfilesJsonCreate(Path & ".minecraft\")
+                    End If
+                    McFolderListLoader.WaitForExit(IsForceRestart:=True)
+                Else
+                    '取消自动安装
+                    Log("[Launch] 取消自动安装整合包:" & PackInstallPath, LogLevel.Debug)
+                    PackInstallPath = Nothing
+                End If
+            End If
             '确认 Minecraft 文件夹存在
             PathMcFolder = Setup.Get("LaunchFolderSelect").ToString.Replace("$", Path)
             If PathMcFolder = "" OrElse Not Directory.Exists(PathMcFolder) Then
@@ -48,21 +56,27 @@
             End If
             Log("[Launch] Minecraft 文件夹:" & PathMcFolder)
             If Setup.Get("SystemDebugDelay") Then Thread.Sleep(RandomInteger(500, 3000))
-            ''自动整合包安装
-            'If PackInstallPath IsNot Nothing Then
-            '    If ModpackInstall(PackInstallPath) Then
-            '        Log("[Launch] 自动安装整合包成功:" & PackInstallPath)
-            '        File.Delete(PackInstallPath)
-            '    Else
-            '        Log("[Launch] 自动安装整合包失败:" & PackInstallPath)
-            '    End If
-            'End If
+            '自动整合包安装
+            If PackInstallPath IsNot Nothing Then
+                Dim InstallLoader = ModpackInstall(PackInstallPath)
+                If InstallLoader Is Nothing Then
+                    Log("[Launch] 自动安装整合包失败:" & PackInstallPath)
+                Else
+                    Log("[Launch] 自动安装整合包开始:" & PackInstallPath)
+                    RunInUi(Sub() FrmMain.PageChange(FormMain.PageType.DownloadManager))
+                    InstallLoader.WaitForExit()
+                    If InstallLoader.State = LoadState.Finished Then
+                        Log("[Launch] 自动安装整合包成功,删除安装包:" & PackInstallPath)
+                        File.Delete(PackInstallPath)
+                    End If
+                End If
+            End If
             '确认 Minecraft 版本存在
             Dim Selection As String = Setup.Get("LaunchVersionSelect")
             Dim Version As McVersion = If(Selection = "", Nothing, New McVersion(Selection))
-            If Version Is Nothing OrElse Not (Version.Path.StartsWith(PathMcFolder) AndAlso Version.Check) Then
+            If Version Is Nothing OrElse Not Version.Path.StartsWithF(PathMcFolder) OrElse Not Version.Check() Then
                 '无效的版本
-                Log("[Launch] Minecraft 版本无效" & If(Version Is Nothing, ",没有有效版本", ":" & Version.Path), If(IsNothing(Version), LogLevel.Normal, LogLevel.Debug))
+                Log("[Launch] 当前选择的 Minecraft 版本无效:" & If(Version Is Nothing, "null", Version.Path), If(IsNothing(Version), LogLevel.Normal, LogLevel.Debug))
                 If Not McVersionListLoader.State = LoadState.Finished Then LoaderFolderRun(McVersionListLoader, PathMcFolder, LoaderFolderRunType.ForceRun, MaxDepth:=1, ExtraPath:="versions\", WaitForExit:=True)
                 If Not McVersionList.Any() OrElse McVersionList.First.Value(0).Logo.Contains("RedstoneBlock") Then
                     Version = Nothing

+ 12 - 10
Plain Craft Launcher 2/Pages/PageLaunch/PageLoginAuthSkin.xaml.vb

@@ -58,19 +58,21 @@
         Hint("正在尝试更换,请稍候!")
         Setup.Set("CacheAuthUuid", "") '清空选择缓存
         Setup.Set("CacheAuthName", "")
-        RunInThread(Sub()
-                        Try
-                            Dim Data As McLoginServer = GetLoginData()
-                            Data.ForceReselectProfile = True
-                            McLoginLoader.WaitForExit(Data, IsForceRestart:=True)
-                            RunInUi(Sub() Reload(True))
-                        Catch ex As Exception
-                            Log(ex, "更换角色失败", LogLevel.Hint)
-                        End Try
-                    End Sub)
+        RunInThread(
+        Sub()
+            Try
+                Dim Data As McLoginServer = GetLoginData()
+                Data.ForceReselectProfile = True
+                McLoginLoader.WaitForExit(Data, IsForceRestart:=True)
+                RunInUi(Sub() Reload(True))
+            Catch ex As Exception
+                Log(ex, "更换角色失败", LogLevel.Hint)
+            End Try
+        End Sub)
     End Sub
     Private Sub BtnExit_Click() Handles BtnExit.Click
         Setup.Set("CacheAuthAccess", "")
+        Setup.Set("CacheAuthUuid", "")
         FrmLaunchLeft.RefreshPage(False, True)
     End Sub
 

+ 92 - 312
Plain Craft Launcher 2/Pages/PageOther/PageOtherAbout.xaml

@@ -29,7 +29,7 @@
                             <EllipseGeometry Center="17 17" RadiusX="17" RadiusY="17" />
                         </Image.Clip>
                     </Image>
-                    <local:MyButton Text="赞助作者" Grid.Column="2" Grid.Row="0" Height="35" EventType="打开网页" EventData="https://afdian.net/a/LTCat" />
+                    <local:MyButton Text="赞助作者" Grid.Column="2" Grid.Row="0" Height="35" EventType="打开网页" EventData="https://afdian.com/a/LTCat" />
                     <local:MyButton Text="查看源代码" Grid.Column="2" Grid.Row="1" Height="35" EventType="打开网页" EventData="https://github.com/Hex-Dragon/PCL2" />
                 </Grid>
             </local:MyCard>
@@ -55,7 +55,7 @@
                     <local:MyListItem Title="MC 百科" Margin="-5,0,0,0" IsHitTestVisible="False" Grid.ColumnSpan="2" Info="提供了 Mod 名称的中文翻译和更多相关信息!" Grid.Row="1" Grid.Column="1" />
                     <local:MyButton x:Name="BtnAboutWiki" Text="打开百科" Grid.Row="1" Grid.Column="2" Height="35" />
                     <local:MyListItem Title="00ll00" Margin="-5,0,0,0" IsHitTestVisible="False" Grid.ColumnSpan="2" Info="提供了 Java Launch Wrapper 和一些重要服务支持!" Grid.Row="2" Grid.Column="1" />
-                    <local:MyListItem Title="DoodleHuang" Margin="-5,0,0,0" IsHitTestVisible="False" Grid.ColumnSpan="2" Info="提供了部分很难找到的 Minecraft 版本与一些技术支持!" Grid.Row="3" Grid.Column="1" />
+                    <local:MyListItem Title="z0z0r4" Margin="-5,0,0,0" IsHitTestVisible="False" Grid.ColumnSpan="2" Info="提供了 MCIM 中国 Mod 下载镜像源和帮助库图床!" Grid.Row="3" Grid.Column="1" />
                     <local:MyListItem Title="Patrick" Margin="-5,0,0,0" IsHitTestVisible="False" Grid.ColumnSpan="2" Info="设计并制作了 PCL 图标,让我从做图标的水深火热中得到了解脱……" Grid.Row="4" Grid.Column="1" />
                     <local:MyListItem Title="Hao_Tian" Margin="-5,0,0,0" IsHitTestVisible="False" Grid.ColumnSpan="2" Info="在内测中找出了一大堆没人想得到的诡异 Bug,有非同寻常的 Bug 体质" Grid.Row="5" Grid.Column="1" />
                     <local:MyListItem Title="Minecraft 中文论坛" Margin="-5,0,15,0" IsHitTestVisible="False" Info="虽然已经关站了,但感谢此前提供了 MCBBS 镜像源……" Grid.Row="6" Grid.Column="1" />
@@ -75,7 +75,7 @@
                             <EllipseGeometry Center="17 17" RadiusX="17" RadiusY="17" />
                         </Image.Clip>
                     </Image>
-                    <Image Source="/Plain Craft Launcher 2;component/Images/Heads/DoodleHuang.png" Grid.Row="3" Margin="3">
+                    <Image Source="/Plain Craft Launcher 2;component/Images/Heads/z0z0r4.png" Grid.Row="3" Margin="3">
                         <Image.Clip>
                             <EllipseGeometry Center="17 17" RadiusX="17" RadiusY="17" />
                         </Image.Clip>
@@ -104,312 +104,92 @@
             </local:MyCard>
             <local:MyCard Margin="0,0,0,15" Title="赞助者">
                 <StackPanel Margin="25,40,10,20">
-                    <TextBlock HorizontalAlignment="Left" Text="以下是 2024 年 5~6 月的高级赞助者们!感谢各位对 PCL 和伟大的咕咕咕事业的支持!" Margin="0,0,25,5.5" TextTrimming="None" TextWrapping="WrapWithOverflow" />
+                    <TextBlock HorizontalAlignment="Left" Text="以下是 2024 年 7 月的高级赞助者们!感谢各位对 PCL 和伟大的咕咕咕事业的支持!" Margin="0,0,25,5.5" TextTrimming="None" TextWrapping="WrapWithOverflow" />
                     <WrapPanel Margin="0,0,0,10">
-                        <TextBlock Width="120" Margin="0,1.5" Text="哈哈哈哈哈" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="江户川柯南" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="loner..?" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="野比大豆" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="无心之举" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="林禊" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="??!" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Petrichor" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="一只可爱的frisk啊" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="luvFwt" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="厨师长" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="星輝月下゛" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="密早宪综籽" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="黑云月稀" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="星月球" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="ADerAQi" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="van" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Eterfrusa" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="kpocc07" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="觉莫" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="我是DGHSFG" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="lhw0616" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="2DGIRL" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="雨猫霖" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Grazie" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="鲲鹏roc" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="皮皮苏" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="哆啦哆啦" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="serendipity" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="W-Qi" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="tenneidp" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="叢沄" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="jian_ke" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="ZHypocrite" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="浑荀" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="yoo-ovo" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="洛梓风anemo" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="胡桃的狗" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="落灯花" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="涩图来一份" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="FSAH217" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="炽绪" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="JUBEYsl" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="阿祺27" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="江上数峰青" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="ECHO" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="路易斯" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="别曹曹了" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Szy" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="长安常安" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="鲨鲨" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="对白拼拼凑凑" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="月下吃米糖" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="小雨要" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="臻榛搸殝" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="王富贵" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="久久" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="嗯哼?" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="木沐" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="永久里" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="小白狐" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Z." />
-                        <TextBlock Width="120" Margin="0,1.5" Text="芝惑鱼" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="MegnaAegwynn " />
-                        <TextBlock Width="120" Margin="0,1.5" Text="DJLD" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="曦月" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="TylerDeng" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="1899年的提拉米苏" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="bzwm" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="GhaMZz" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="雪游" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="奇怪的大土豆" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Moonlight-池绾" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="fusocietyck" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="爬爬鸡" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="山千海千" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="氿离Yoi" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="如风沐烟" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="一条博子" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="m1679" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="snow" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="3瓶奶茶" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Elkanah_" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="孤默少言" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="也要拿出真本事" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="武彩鱼" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="雷霆兴哥" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="EnsoNani" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Ann.Midnight" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="郁子恒是FW" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="ZIHE_kk" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="文八" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="寂月星落" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Writer_DaMao" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="gwd233" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Sutvh" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="崔东山" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Botaiii" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="凛仙子D-" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="MooFaH" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="嘿哈吼" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="下山吃肉的兔子" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="warship" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="木落微雨" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="杨阳baby" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="白茶" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="路过一下的尘垒" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="counterea" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="雨中盛开的花朵" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="珊瑚宫心海" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="luner" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="时崎王罪丶" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Nicht" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="冰薇" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Archetto" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="蓝冰之刃" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Baguette" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="KenshenLove" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="风见翎" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="雷霆" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="[擦汗]" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="远东雪橇猫" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="安夏洛克" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="acac" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="瑞风" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="xiankeQAQ" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="BDUCK" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="fuaglove" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="prprprrrpop" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="YOCE" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="忹." />
-                        <TextBlock Width="120" Margin="0,1.5" Text="夜青" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="橘糸侑You" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="薇克波顿" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="夂冬螽" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Colitary" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Harm_b10ck" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="乆月" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Kaoukala" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="墨染★希" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="松菀" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="疾驰火车" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="疾影烬" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Awfrlu+" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Lava_drop_" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="? *???* ?" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Gwynsur" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="许淼淼" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="waneng0807" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="安anLa" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="MQDCB" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="我dnmd" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="猫舍旁边有恶犬" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="yk" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Cik-z" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="胡桃不是桃丫" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="陌白" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="C418" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="醉梦仙露" />
-                        <TextBlock Width="240" Margin="0,1.5" Text="Re.从零开始跟猪鲨鲨恋爱" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="玄?" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="olwlm" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="XiaoLe_SH" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="龙大炮" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="陆阿藏" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="lo" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="七夜英理" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="lizi" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="范德Fa" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="云自无心" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="尚可" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="回转命运" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="恶搞的人格" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="安安生生" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="蛋仔派对-小冷" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="间铃" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="瀧柳" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="IRasciblebh" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="15183318101" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="LALALA" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="大香蕉" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Another0" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="丢天帝" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="魔法喵酱" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="wshilaoliu" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="PangDaHusky" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="qi_lu" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="LetvGodyan" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Amo" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="liang" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="baijillys" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="栗悟飯とカメハメ波" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="姜路扬" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="LuluPipi" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Atuo" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="泳圈鼬用攀瀑" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="EWD" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="孟然君" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="num61" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Elysia_mc" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Wehrmacht" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="野生的小乐子" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="星韵林" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="剁椒鱼头" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Jking" />
-                        <TextBlock Width="240" Margin="0,1.5" Text="抖音搜索:清凉夏日一只瓜" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="HEARLEY" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="woaini_awa" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="龙天行" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="亦羽君" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="言十七" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="zzc" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="w?z?r?y" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="havoc" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="一条咸鱼" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="大鸡翅膀" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="月语" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="BBQ" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="糖糖" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="七月一" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="独角受" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="10000cituitui" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Television" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="......" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="LONG11" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="OP仙人" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="陌音依矢—笠风" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="kinno_mc" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Avid" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="brimobe" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Momoki" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="徐小疯" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="我爱龙猫!!!" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="233" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="礼尚往来" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="会吐槽的毛熊" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="耶梦加得" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="pumpkin" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Solaray3" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="m1a0w0" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="懿轩" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="圆圆xyz" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="EchoLong" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="光与影的对白" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="AptS:1547" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="中转站" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="情猫" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="胡桃Mahero" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Ew_o" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="叽里呱啦" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="MHNIO" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="小洺" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="龙儿" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="ccll48" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Ling7844" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="不会写网名的屑" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Aresposeidon1124" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="钻石Daiyamondo" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="七月无风" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="YuTian" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="csleep" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="小天使" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="墨水" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="阿耀" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="青绵kipilu" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="IWI_Margarita" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="小林カンナ" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="TD-Clotys" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="哈先生" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="老潘" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="绝少" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="咸鱼汤鱼咸" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Celery" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="简称FV" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="飞翔的PUMA" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="123456。?" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="heitong_shu" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Lan" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="sanjuou" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="芙芙" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="zyc11230170" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="TOUHOULUO" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="在下雾切" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="exusiai2357" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="???" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="润煌Ricardo" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="无风" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="缘花乐" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Willian" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="墨尘烟雨" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="加五九九五" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="白裘峪" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="加载中..." />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Стразар" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="夜语霖" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="Wolfgang_233" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="小螺浩" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="rtoe332" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="lliiooll" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="QFwushang" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="竹翼" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="没差" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="用户13223" />
-                        <TextBlock Width="120" Margin="0,1.5" Text="猫羽喵" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="nemonemo" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="矢坕" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="梁景瑜" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="GhostZiLie" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="靈曦蠡醯" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="zzdr" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="井下啊~" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="zkQkWyQkz" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="fill" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="法老" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="aleafsautumn" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="聪明的凉生" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="干嘛1337" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="dlxw4" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="古神" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="朝仓理香子" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="Raper_Sulin" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="vv" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="QuinnL" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="pigeno" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="whx61" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="peoprem" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="慕言" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="白雾云-白少" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="S0CK" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="1111" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="怕做苦力的苦力怕" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="慕柒茗桜" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="DsxiaKsxia" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="lucca" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="时酱" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="666a" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="Rigilkent" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="亡灵引渡" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="初音末来" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="king" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="zzhm" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="半自动M9716" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="MMIAO780" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="7930" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="Jedro" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="寂灭星云" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="天上北辰星" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="黄为很高" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="a酱" />
+                        <TextBlock Width="240" Margin="0,1.5" Text="Pedlar Mayweather" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="Daddy江" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="汣魰" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="lawaass" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="scz" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="tiredl" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="Jeffy0314" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="青云一梦" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="摸鱼大湿" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="PIGEON" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="Redio" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="无垠星海" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="Z10" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="嗯哼" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="_Ejvy" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="LG.神梦" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="叫爱丽丝的墨鱼" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="芙芙雪糕" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="屑萨你" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="qianlan" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="dndjkdkdms" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="时空乂猎人" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="芒果" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="小比登T^T" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="北川兔兔" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="q_q!!!" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="eric" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="Min" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="JTOPfujo》" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="CZALIZI" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="outsider" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="Kimmo" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="超爱居居巧" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="quin22" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="贤者摸鱼" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="chsero" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="幽梦瞳鸭" />
+                        <TextBlock Width="120" Margin="0,1.5" Text="Thankscrazy" />
+
                     </WrapPanel>
                     <Grid Height="35">
                         <Grid.ColumnDefinitions>
@@ -418,7 +198,7 @@
                             <ColumnDefinition Width="Auto" SharedSizeGroup="Button" />
                         </Grid.ColumnDefinitions>
                         <local:MyButton x:Name="BtnDonateOutput" Grid.Column="0" MinWidth="140" Text="生成解锁码" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" ColorType="Highlight" Visibility="Collapsed" />
-                        <local:MyButton x:Name="BtnDonateDonate" Grid.Column="0" MinWidth="140" Text="赞助作者" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" ColorType="Highlight" EventType="打开网页" EventData="https://afdian.net/a/LTCat" />
+                        <local:MyButton x:Name="BtnDonateDonate" Grid.Column="0" MinWidth="140" Text="赞助作者" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" ColorType="Highlight" EventType="打开网页" EventData="https://afdian.com/a/LTCat" />
                         <local:MyButton x:Name="BtnDonateCopy" Grid.Column="1" MinWidth="140" Text="复制识别码" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" />
                         <local:MyButton x:Name="BtnDonateInput" Grid.Column="2" MinWidth="140" Text="输入解锁码" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" />
                     </Grid>
@@ -427,12 +207,12 @@
             <local:MyCard Margin="0,0,0,15" Title="法律信息" IsSwaped="True" CanSwap="True">
                 <StackPanel Margin="25,39,23,20">
                     <TextBlock Text="隐私说明" TextWrapping="Wrap" Margin="0,6,0,4" FontWeight="Bold" />
-                    <TextBlock Margin="0,0,0,2" LineHeight="17" Text="本软件会汇报自己的版本名与版本号,以统计用户数量与各版本的用户数量占比。除此之外,本软件不会上传您的任何信息。&#13;若您能提供未经外部修改的本软件本体上传隐私信息的确凿证据,开发者会向您支付 PCL 开发所获全部净收入。" TextWrapping="Wrap" />
+                    <TextBlock Margin="0,0,0,2" LineHeight="17" Text="本软件的 User Agent 中包含启动器的版本号,以统计各版本的用户数量。&#13;除此之外,本软件不会向开发者上传任何其他信息。" TextWrapping="Wrap" />
                     <TextBlock Text="其他信息" TextWrapping="Wrap" Margin="0,12,0,4" FontWeight="Bold" />
-                    <TextBlock Margin="0,0,0,2" LineHeight="17" Text="Copyright © 龙腾猫跃 2016. All Rights Reserved.&#13;计算机软件著作权登记号:2020SR0875133&#13;违法违规行为举报投诉邮箱:[email protected]" TextWrapping="Wrap" />
+                    <TextBlock Margin="0,0,0,2" LineHeight="17" Text="Copyright © 龙腾猫跃 2016. All Rights Reserved.&#13;计算机软件著作权登记号:2020SR0875133&#13;违法违规行为举报投诉邮箱:[email protected]&#13;非 MINECRAFT 官方产品。未经 MOJANG 或 MICROSOFT 批准,也不与 MOJANG 或 MICROSOFT 关联。" TextWrapping="Wrap" />
                     <StackPanel Orientation="Horizontal" Height="35" HorizontalAlignment="Left" Margin="0,12,0,0">
                         <local:MyButton Text="用户协议与免责声明" Width="170" Padding="13,0" Margin="0,0,20,0" ColorType="Highlight" EventType="打开网页" EventData="https://shimo.im/docs/rGrd8pY8xWkt6ryW" />
-                        <local:MyButton Text="查看源代码" Width="140" Padding="13,0" EventType="打开网页" EventData="https://github.com/Hex-Dragon/PCL2" />
+                        <local:MyButton Text="开源代码" Width="140" Padding="13,0" EventType="打开网页" EventData="https://github.com/Hex-Dragon/PCL2" />
                     </StackPanel>
                 </StackPanel>
             </local:MyCard>

+ 1 - 1
Plain Craft Launcher 2/Pages/PageOther/PageOtherAbout.xaml.vb

@@ -19,7 +19,7 @@
     End Sub
 
     Private Sub BtnAboutBmclapi_Click(sender As Object, e As EventArgs) Handles BtnAboutBmclapi.Click
-        OpenWebsite("https://afdian.net/a/bangbang93")
+        OpenWebsite("https://afdian.com/a/bangbang93")
     End Sub
     Private Sub BtnAboutWiki_Click(sender As Object, e As EventArgs) Handles BtnAboutWiki.Click
         OpenWebsite("https://www.mcmod.cn")

+ 1 - 0
Plain Craft Launcher 2/Pages/PageSetup/ModSetup.vb

@@ -108,6 +108,7 @@
         {"ToolDownloadKeepModpack", New SetupEntry(False, Source:=SetupSource.Registry)},
         {"ToolDownloadIgnoreQuilt", New SetupEntry(True, Source:=SetupSource.Registry)},
         {"ToolDownloadCert", New SetupEntry(True, Source:=SetupSource.Registry)},
+        {"ToolDownloadMod", New SetupEntry(1, Source:=SetupSource.Registry)},
         {"ToolUpdateAlpha", New SetupEntry(0, Source:=SetupSource.Registry, Encoded:=True)},
         {"ToolUpdateRelease", New SetupEntry(False, Source:=SetupSource.Registry)},
         {"ToolUpdateSnapshot", New SetupEntry(False, Source:=SetupSource.Registry)},

+ 2 - 2
Plain Craft Launcher 2/Pages/PageSetup/PageSetupLaunch.xaml

@@ -7,9 +7,9 @@
     PanScroll="{Binding ElementName=PanBack}">
     <local:MyScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" x:Name="PanBack">
         <StackPanel x:Name="PanMain" Margin="25,10">
-            <local:MyCard x:Name="CardSkin" Margin="0,15" Title="离线皮肤">
+            <local:MyCard x:Name="CardSkin" Margin="0,15" Title="离线皮肤" CanSwap="True" IsSwaped="True">
                 <StackPanel Margin="25,40,25,15">
-                    <local:MyHint Text="由于技术问题,皮肤预览与 Steve/Alex/自定义 选项暂时仅保证对 1.19.2 以前的版本有效!" IsWarn="False" Margin="0,0,0,10" />
+                    <local:MyHint Text="由于技术问题,此功能只保证对 1.19.2 以前的版本有效!" IsWarn="True" Margin="0,0,0,10" />
                     <Grid Margin="-1,0,0,0">
                         <Grid.ColumnDefinitions>
                             <ColumnDefinition />

+ 34 - 17
Plain Craft Launcher 2/Pages/PageSetup/PageSetupSystem.xaml

@@ -20,6 +20,8 @@
                             <RowDefinition Height="7" />
                             <RowDefinition Height="28" />
                             <RowDefinition Height="7" />
+                            <RowDefinition Height="28" />
+                            <RowDefinition Height="7" />
                             <RowDefinition Height="27" />
                             <RowDefinition Height="27" />
                             <RowDefinition Height="Auto" />
@@ -31,32 +33,38 @@
                         <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="版本列表获取" Margin="0,0,25,0" />
                         <local:MyComboBox x:Name="ComboDownloadVersion" Grid.ColumnSpan="2" Tag="ToolDownloadVersion" Grid.Column="1">
                             <local:MyComboBoxItem Content="尽量使用镜像源(加载快,但版本可能不是最新的)" IsSelected="True" />
-                            <local:MyComboBoxItem Content="在官方源加载缓慢时改用镜像源(平衡)" />
-                            <local:MyComboBoxItem Content="尽量使用官方源(保证版本为最新,但加载非常缓慢)" />
+                            <local:MyComboBoxItem Content="仅在官方源加载缓慢时改用镜像源" />
+                            <local:MyComboBoxItem Content="尽量使用官方源(保证版本最新,但加载缓慢)" />
+                        </local:MyComboBox>
+                        <TextBlock Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left" Text="Mod 信息获取" Margin="0,0,25,0" />
+                        <local:MyComboBox x:Name="ComboDownloadMod" Grid.Row="2" Grid.ColumnSpan="2" Tag="ToolDownloadMod" Grid.Column="1">
+                            <local:MyComboBoxItem Content="尽量使用镜像源" />
+                            <local:MyComboBoxItem Content="仅在官方源加载缓慢时改用镜像源" />
+                            <local:MyComboBoxItem Content="尽量使用官方源" IsSelected="True" />
                         </local:MyComboBox>
-                        <TextBlock Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left" Text="Mod 命名风格" Margin="0,0,25,0" />
-                        <local:MyComboBox Grid.Row="2" x:Name="ComboDownloadTranslate" Grid.ColumnSpan="2" Tag="ToolDownloadTranslate" Grid.Column="1" 
+                        <TextBlock Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Left" Text="Mod 命名风格" Margin="0,0,25,0" />
+                        <local:MyComboBox Grid.Row="4" x:Name="ComboDownloadTranslate" Grid.ColumnSpan="2" Tag="ToolDownloadTranslate" Grid.Column="1" 
                                           ToolTip="决定下载的 Mod 的默认文件名中,中文译名应该放在哪个位置">
                             <local:MyComboBoxItem Content="译名位于文件名开头:[遗物] relics-0.1.14" IsSelected="True" />
                             <local:MyComboBoxItem Content="译名位于文件名开头:遗物-relics-0.1.14" />
                             <local:MyComboBoxItem Content="译名位于文件名末尾:relics-0.1.14-遗物" />
                             <local:MyComboBoxItem Content="不添加中文译名:relics-0.1.14" />
                         </local:MyComboBox>
-                        <TextBlock Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Left" Text="最大线程数" Margin="0,0,25,0" />
-                        <local:MySlider x:Name="SliderDownloadThread" Grid.Row="4" Tag="ToolDownloadThread" MaxValue="255" Value="63" Grid.Column="1"
+                        <TextBlock Grid.Row="6" VerticalAlignment="Center" HorizontalAlignment="Left" Text="最大线程数" Margin="0,0,25,0" />
+                        <local:MySlider x:Name="SliderDownloadThread" Grid.Row="6" Tag="ToolDownloadThread" MaxValue="255" Value="63" Grid.Column="1"
                                         ToolTip="线程数越多,限速的文件下载越快,但过高的线程数会造成下载时非常严重的卡顿。&#xa;一般而言,64 线程已可以保证足够的下载速度。" />
-                        <TextBlock VerticalAlignment="Center" Grid.Row="5" HorizontalAlignment="Left" Text="速度限制" Margin="0,0,25,0" />
-                        <local:MySlider x:Name="SliderDownloadSpeed" Grid.Row="5" Tag="ToolDownloadSpeed" MaxValue="42" Value="42" Grid.Column="1"
+                        <TextBlock VerticalAlignment="Center" Grid.Row="7" HorizontalAlignment="Left" Text="速度限制" Margin="0,0,25,0" />
+                        <local:MySlider x:Name="SliderDownloadSpeed" Grid.Row="7" Tag="ToolDownloadSpeed" MaxValue="42" Value="42" Grid.Column="1"
                                         ToolTip="设置下载的速度上限,以避免在下载时导致其他需要联网的程序卡死" />
-                        <TextBlock VerticalAlignment="Top" Grid.Row="6" HorizontalAlignment="Left" Text="目标文件夹" Margin="0,5,25,5" />
-                        <TextBlock Margin="0,5" HorizontalAlignment="Left" Text="请在 启动 → 版本选择 → 文件夹列表 中更改下载目标文件夹。&#xa;在某个文件夹或游戏版本上右键,即可选择打开对应文件夹。" Grid.Row="6" Grid.Column="1" VerticalAlignment="Center" Opacity="0.5" />
-                        <local:MyCheckBox Margin="0,5,0,4" Text="安装整合包时保留原始压缩包" Grid.Row="7" Height="22" Grid.ColumnSpan="2"
+                        <TextBlock VerticalAlignment="Top" Grid.Row="9" HorizontalAlignment="Left" Text="目标文件夹" Margin="0,5,25,5" />
+                        <TextBlock Margin="0,5" HorizontalAlignment="Left" Text="请在 启动 → 版本选择 → 文件夹列表 中更改下载目标文件夹。&#xa;在某个文件夹或游戏版本上右键,即可选择打开对应文件夹。" Grid.Row="9" Grid.Column="1" VerticalAlignment="Center" Opacity="0.5" />
+                        <local:MyCheckBox Margin="0,5,0,4" Text="安装整合包时保留原始压缩包" Grid.Row="10" Height="22" Grid.ColumnSpan="2"
                                           x:Name="CheckDownloadKeepModpack" Tag="ToolDownloadKeepModpack" 
                                           ToolTip="安装整合包时,在版本文件夹下保留用于安装的原始整合包压缩包文件" />
-                        <local:MyCheckBox Margin="0,2,0,4" Text="简化 Mod 加载器显示" Grid.Row="8" Height="22" Grid.ColumnSpan="2"
+                        <local:MyCheckBox Margin="0,2,0,4" Text="简化 Mod 加载器显示" Grid.Row="11" Height="22" Grid.ColumnSpan="2"
                                           x:Name="CheckDownloadIgnoreQuilt" Tag="ToolDownloadIgnoreQuilt" 
                                           ToolTip="下载 Mod 时,若该 Mod 支持 Forge 和 Fabric,则显示为支持任意 Mod 加载器。&#xa;例如,开启时 JEI 显示支持全版本,关闭后 JEI 就会显示仅支持 Forge / Fabric 全版本。" />
-                        <local:MyCheckBox Margin="0,2,0,4" Text="验证 SSL 证书" Grid.Row="9" Height="22" Grid.ColumnSpan="2"
+                        <local:MyCheckBox Margin="0,2,0,4" Text="验证 SSL 证书" Grid.Row="12" Height="22" Grid.ColumnSpan="2"
                                           x:Name="CheckDownloadCert" Tag="ToolDownloadCert" 
                                           ToolTip="验证证书会提高安全性,但疑似有概率导致正版登录失败(#3018)。&#xa;如果在正版登录时因为 [根据验证过程,远程证书无效] 失败,可以尝试关闭此项。" />
                     </Grid>
@@ -93,7 +101,8 @@
                         <RowDefinition Height="28" />
                         <RowDefinition Height="9" />
                         <RowDefinition Height="28" />
-                        <RowDefinition Height="9" />
+                        <RowDefinition Height="5" />
+                        <RowDefinition Height="Auto" />
                         <RowDefinition Height="Auto" />
                     </Grid.RowDefinitions>
                     <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="启动器更新" Margin="0,0,25,0" />
@@ -116,15 +125,23 @@
                             <local:ValidateFolderPath UseMinecraftCharCheck="False" />
                         </local:MyTextBox.ValidateRules>
                     </local:MyTextBox>
-                    <Grid Height="35" Grid.Row="6" Grid.ColumnSpan="5" Margin="0,5,0,0">
+                    <Grid Height="35" Grid.Row="6" Grid.ColumnSpan="5" Margin="0,12,0,0">
                         <Grid.ColumnDefinitions>
                             <ColumnDefinition Width="Auto" SharedSizeGroup="Button" />
                             <ColumnDefinition Width="Auto" SharedSizeGroup="Button" />
                             <ColumnDefinition Width="Auto" SharedSizeGroup="Button" />
                         </Grid.ColumnDefinitions>
                         <local:MyButton Grid.Column="0" x:Name="BtnSystemUpdate" MinWidth="140" Text="检查更新" Padding="13,0" Margin="0,0,20,0" />
-                        <local:MyButton Grid.Column="1" x:Name="BtnSystemIdentify" MinWidth="140" Text="复制识别码" Padding="13,0" Margin="0,0,20,0" />
-                        <local:MyButton Grid.Column="2" x:Name="BtnSystemUnlock" MinWidth="140" Text="输入解锁码" Padding="13,0" Margin="0,0,20,0" />
+                        <local:MyButton Grid.Column="1" x:Name="BtnSystemSettingExp" MinWidth="140" Text="导出设置" Padding="13,0" Margin="0,0,20,0" />
+                        <local:MyButton Grid.Column="2" x:Name="BtnSystemSettingImp" MinWidth="140" Text="导入设置" Padding="13,0" Margin="0,0,20,0" />
+                    </Grid>
+                    <Grid Height="35" Grid.Row="7" Grid.ColumnSpan="5" Margin="0,12,0,0" x:Name="PanDonate">
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="Auto" SharedSizeGroup="Button" />
+                            <ColumnDefinition Width="Auto" SharedSizeGroup="Button" />
+                        </Grid.ColumnDefinitions>
+                        <local:MyButton Grid.Column="0" x:Name="BtnSystemIdentify" MinWidth="140" Text="复制识别码" Padding="13,0" Margin="0,0,20,0" />
+                        <local:MyButton Grid.Column="1" x:Name="BtnSystemUnlock" MinWidth="140" Text="输入解锁码" Padding="13,0" Margin="0,0,20,0" />
                     </Grid>
                 </Grid>
             </local:MyCard>

+ 18 - 2
Plain Craft Launcher 2/Pages/PageSetup/PageSetupSystem.xaml.vb

@@ -35,7 +35,10 @@
         '重复加载部分
         PanBack.ScrollToHome()
 
-#If Not BETA Then
+#If BETA Then
+        PanDonate.Visibility = Visibility.Collapsed
+#Else
+        PanDonate.Visibility = Visibility.Visible
         ItemSystemUpdateDownload.Content = "在有新版本时自动下载(更新快照版可能需要更新密钥)"
 #End If
 
@@ -56,6 +59,7 @@
         SliderDownloadSpeed.Value = Setup.Get("ToolDownloadSpeed")
         ComboDownloadVersion.SelectedIndex = Setup.Get("ToolDownloadVersion")
         ComboDownloadTranslate.SelectedIndex = Setup.Get("ToolDownloadTranslate")
+        ComboDownloadMod.SelectedIndex = Setup.Get("ToolDownloadMod")
         CheckDownloadKeepModpack.Checked = Setup.Get("ToolDownloadKeepModpack")
         CheckDownloadIgnoreQuilt.Checked = Setup.Get("ToolDownloadIgnoreQuilt")
         CheckDownloadCert.Checked = Setup.Get("ToolDownloadCert")
@@ -90,6 +94,7 @@
             Setup.Reset("ToolDownloadKeepModpack")
             Setup.Reset("ToolDownloadIgnoreQuilt")
             Setup.Reset("ToolDownloadCert")
+            Setup.Reset("ToolDownloadMod")
             Setup.Reset("ToolUpdateRelease")
             Setup.Reset("ToolUpdateSnapshot")
             Setup.Reset("ToolHelpChinese")
@@ -117,7 +122,7 @@
     Private Shared Sub SliderChange(sender As MySlider, e As Object) Handles SliderDebugAnim.Change, SliderDownloadThread.Change, SliderDownloadSpeed.Change
         If AniControlEnabled = 0 Then Setup.Set(sender.Tag, sender.Value)
     End Sub
-    Private Shared Sub ComboChange(sender As MyComboBox, e As Object) Handles ComboDownloadVersion.SelectionChanged, ComboDownloadTranslate.SelectionChanged, ComboSystemUpdate.SelectionChanged, ComboSystemActivity.SelectionChanged
+    Private Shared Sub ComboChange(sender As MyComboBox, e As Object) Handles ComboDownloadVersion.SelectionChanged, ComboDownloadTranslate.SelectionChanged, ComboSystemUpdate.SelectionChanged, ComboSystemActivity.SelectionChanged, ComboDownloadMod.SelectionChanged
         If AniControlEnabled = 0 Then Setup.Set(sender.Tag, sender.SelectedIndex)
     End Sub
     Private Shared Sub TextBoxChange(sender As MyTextBox, e As Object) Handles TextSystemCache.ValidatedTextChanged
@@ -212,4 +217,15 @@
         End Try
     End Function
 
+#Region "导出 / 导入设置"
+
+    Private Sub BtnSystemSettingExp_Click(sender As Object, e As MouseButtonEventArgs) Handles BtnSystemSettingExp.Click
+        Hint("该功能尚在开发中!")
+    End Sub
+    Private Sub BtnSystemSettingImp_Click(sender As Object, e As MouseButtonEventArgs) Handles BtnSystemSettingImp.Click
+        Hint("该功能尚在开发中!")
+    End Sub
+
+#End Region
+
 End Class

+ 2 - 2
Plain Craft Launcher 2/Pages/PageSetup/PageSetupUI.xaml.vb

@@ -451,7 +451,7 @@ Refresh:
         End If
     End Sub
     Private Sub LabLauncherTheme8Copy_MouseRightButtonUp() Handles LabLauncherTheme8Copy.MouseRightButtonUp
-        OpenWebsite("https://afdian.net/a/LTCat")
+        OpenWebsite("https://afdian.com/a/LTCat")
     End Sub
     Private Sub LabLauncherTheme9Copy_MouseRightButtonUp() Handles LabLauncherTheme9Copy.MouseRightButtonUp
         PageOtherLeft.TryFeedback()
@@ -664,7 +664,7 @@ Refresh:
 
     '公开预览版
     Private Sub BtnLauncherDonate_Click(sender As Object, e As EventArgs) Handles BtnLauncherDonate.Click
-        OpenWebsite("https://afdian.net/a/LTCat")
+        OpenWebsite("https://afdian.com/a/LTCat")
     End Sub
 
     '滑动条

+ 8 - 12
Plain Craft Launcher 2/Pages/PageSpeedLeft.xaml.vb

@@ -60,11 +60,9 @@ Public Class PageSpeedLeft
         End Try
         If FrmSpeedRight Is Nothing OrElse FrmSpeedRight.PanMain Is Nothing Then Exit Sub
         Try
-            SyncLock LoaderTaskbarLock
-                For Each Loader In LoaderTaskbar.ToList
-                    TaskRefresh(Loader)
-                Next
-            End SyncLock
+            For Each Loader In LoaderTaskbar.ToList
+                TaskRefresh(Loader)
+            Next
         Catch ex As Exception
             Log(ex, "下载管理右栏监视出错", LogLevel.Feedback)
         End Try
@@ -197,13 +195,11 @@ Public Class PageSpeedLeft
                     Sub(sender As MyIconButton, e As EventArgs)
                         AniDispose(sender, False)
                         AniDispose(Card, True, Sub() If FrmSpeedRight.PanMain.Children.Count = 0 AndAlso FrmMain.PageCurrent = FormMain.PageType.DownloadManager Then FrmMain.PageBack())
-                        RightCards.Remove(Loader.Name)
-                        SyncLock LoaderTaskbarLock
-                            LoaderTaskbar.Remove(Loader)
-                            Log($"[Taskbar] 由于下载管理卡片关闭,{Loader.Name} 已移出任务列表")
-                        End SyncLock
-                        Log($"[Watcher] 关闭下载管理卡片:{Loader.Name}")
-                        RunInThread(Sub() Loader.Abort())
+                        Dim LoaderName = If(Loader Is Nothing, "null", Loader.Name)
+                        RightCards.Remove(LoaderName)
+                        LoaderTaskbar.TryTake(Loader)
+                        Log($"[Taskbar] 关闭下载管理卡片:{LoaderName},且移出任务列表")
+                        RunInThread(Sub() Loader?.Abort())
                     End Sub
                     '如果已经失败,再刷新一次,修改成失败的控件
                     If Loader.State = LoadState.Failed Then

+ 13 - 1
Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml

@@ -7,7 +7,8 @@
     <Grid>
         <Grid x:Name="PanAllBack">
             <local:MyScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" x:Name="PanBack">
-                <StackPanel x:Name="PanMain" Margin="25,10,25,10" Grid.IsSharedSizeScope="True"> <!-- 若显示多选模块则为 92 -->
+                <StackPanel x:Name="PanMain" Margin="25,10,25,10" Grid.IsSharedSizeScope="True">
+                    <!-- 若显示多选模块则为 92 -->
                     <local:MySearchBox Margin="0,15" HintText="搜索 Mod 名称 / 描述 / 标签" x:Name="SearchBox" />
                     <local:MyCard Grid.Row="0" Margin="0,0,0,15" x:Name="PanManage">
                         <Grid Margin="15,15,0,15" Height="35">
@@ -24,6 +25,17 @@
                         </Grid>
                     </local:MyCard>
                     <local:MyCard x:Name="PanListBack" VerticalAlignment="Top" Opacity="0" Margin="0,0,0,15" Title=" " MinHeight="40">
+                        <StackPanel Margin="0,8,9,0" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Height="24">
+                            <local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="全部" x:Name="BtnTypeAll" ColorType="Highlight" Checked="True"/>
+                            <TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
+                            <local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="已启用" x:Name="BtnTypeEnabled" ColorType="Highlight"/>
+                            <TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
+                            <local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="已禁用" x:Name="BtnTypeDisabled" ColorType="Highlight"/>
+                            <TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
+                            <local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="可更新" x:Name="BtnTypeCanUpdate" ColorType="Highlight"/>
+                            <TextBlock Text="|" Foreground="{StaticResource ColorBrushGray1}" VerticalAlignment="Center"/>
+                            <local:MyRadioButton VerticalAlignment="Center" Height="24" Margin="2,0" Text="错误" x:Name="BtnTypeError" ColorType="Highlight"/>
+                        </StackPanel>
                         <StackPanel Margin="20,38,18,18" Name="PanList" VerticalAlignment="Top" />
                     </local:MyCard>
                 </StackPanel>

+ 118 - 21
Plain Craft Launcher 2/Pages/PageVersion/PageVersionMod.xaml.vb

@@ -4,6 +4,11 @@
 
     Private IsLoad As Boolean = False
     Public Sub PageOther_Loaded() Handles Me.Loaded
+        BtnTypeAll.Tag = ViewType.All
+        BtnTypeEnabled.Tag = ViewType.Enabled
+        BtnTypeDisabled.Tag = ViewType.Disabled
+        BtnTypeCanUpdate.Tag = ViewType.CanUpdate
+        BtnTypeError.Tag = ViewType.InError
 
         If FrmMain.PageLast.Page <> FormMain.PageType.CompDetail Then PanBack.ScrollToHome()
         AniControlEnabled += 1
@@ -27,6 +32,8 @@
     Public Sub RefreshList(Optional ForceReload As Boolean = False)
         If LoaderFolderRun(McModLoader, PageVersionLeft.Version.PathIndie & "mods\", If(ForceReload, LoaderFolderRunType.ForceRun, LoaderFolderRunType.RunOnUpdated)) Then
             Log("[System] 已刷新 Mod 列表")
+            ViewModType = ViewType.All
+            BtnTypeAll.Checked = True
             PanBack.ScrollToHome()
             SearchBox.Text = ""
         End If
@@ -125,33 +132,81 @@
     ''' 刷新结果显示。
     ''' </summary>
     Private Sub RefreshResult(Mods As List(Of McMod))
+        If PanList Is Nothing Then Exit Sub
+        Dim ShowMods As List(Of McMod) = New List(Of McMod)
+        Select Case ViewModType
+            Case ViewType.All
+                ShowMods = Mods
+            Case ViewType.Enabled
+                For Each Item In Mods
+                    If Item.State.Equals(McMod.McModState.Fine) Then ShowMods.Add(Item)
+                Next
+            Case ViewType.Disabled
+                For Each Item In Mods
+                    If Item.State.Equals(McMod.McModState.Disabled) Then ShowMods.Add(Item)
+                Next
+            Case ViewType.CanUpdate
+                For Each Item In Mods
+                    If Item.CanUpdate Then ShowMods.Add(Item)
+                Next
+            Case ViewType.InError
+                For Each Item In Mods
+                    If Item.State.Equals(McMod.McModState.Unavaliable) Then ShowMods.Add(Item)
+                Next
+        End Select
         PanList.Children.Clear()
-        For Each TargetMod In Mods
+        For Each TargetMod In ShowMods
             PanList.Children.Add(ModItems(TargetMod.RawFileName))
         Next
+        Dim ModEnabled As Integer = 0
+        Dim ModDisabled As Integer = 0
+        Dim ModCanUpdate As Integer = 0
+        Dim ModError As Integer = 0
+        For Each ModItem In ModItems
+            If ModItem.Value.Entry.CanUpdate Then
+                ModCanUpdate += 1
+            End If
+            If ModItem.Value.Entry.State.Equals(McMod.McModState.Fine) Then
+                ModEnabled += 1
+            End If
+            If ModItem.Value.Entry.State.Equals(McMod.McModState.Disabled) Then
+                ModDisabled += 1
+            End If
+            If ModItem.Value.Entry.State.Equals(McMod.McModState.Unavaliable) Then
+                ModError += 1
+            End If
+        Next
+        BtnTypeAll.Text = $"全部 ({ModEnabled + ModDisabled + ModError}) "
+        BtnTypeCanUpdate.Text = $"可更新 ({ModCanUpdate}) "
+        BtnTypeEnabled.Text = $"已启用 ({ModEnabled}) "
+        BtnTypeDisabled.Text = $"已禁用 ({ModDisabled}) "
+        BtnTypeError.Text = $"错误 ({ModError}) "
         RefreshTitle()
     End Sub
     ''' <summary>
     ''' 刷新卡片标题。
     ''' </summary>
     Private Sub RefreshTitle()
-        Dim Mods = PanList.Children.Cast(Of MyLocalModItem).Select(Function(i) i.Entry).ToList
-        Dim Counter = {0, 0, 0}
-        For Each ModEntity As McMod In Mods
-            Counter(ModEntity.State) += 1
-        Next
-        Dim TypeList As New List(Of String)
-        If Counter(McMod.McModState.Disabled) > 0 Then TypeList.Add("禁用 " & Counter(McMod.McModState.Disabled))
-        If Counter(McMod.McModState.Unavaliable) > 0 Then TypeList.Add("错误 " & Counter(McMod.McModState.Unavaliable))
-        If Counter(McMod.McModState.Fine) > 0 Then TypeList.Insert(0, If(TypeList.Any, "启用 ", "") & Counter(McMod.McModState.Fine))
         If Not IsSearching Then
-            PanListBack.Title = "Mod 列表 (" & Join(TypeList, ",") & ")"
-        ElseIf TypeList.Any() Then
-            PanListBack.Title = "搜索结果 (" & Join(TypeList, ",") & ")"
+            PanListBack.Title = "Mod 列表 - "
+        ElseIf PanList.Children.Count > 0 Then
+            PanListBack.Title = "搜索结果 - "
         Else
-            PanListBack.Title = "无搜索结果"
+            PanListBack.Title = "无搜索结果 - "
         End If
-        PanList.Visibility = If(Mods.Any(), Visibility.Visible, Visibility.Collapsed)
+        Select Case ViewModType
+            Case ViewType.All
+                PanListBack.Title += BtnTypeAll.Text
+            Case ViewType.Enabled
+                PanListBack.Title += BtnTypeEnabled.Text
+            Case ViewType.Disabled
+                PanListBack.Title += BtnTypeDisabled.Text
+            Case ViewType.CanUpdate
+                PanListBack.Title += BtnTypeCanUpdate.Text
+            Case ViewType.InError
+                PanListBack.Title += BtnTypeError.Text
+        End Select
+        PanList.Visibility = If(PanList.Children.Count > 0, Visibility.Visible, Visibility.Collapsed)
     End Sub
 
 #End Region
@@ -192,10 +247,14 @@
     ''' 全选。
     ''' </summary>
     Private Sub BtnManageSelectAll_Click(sender As Object, e As MouseButtonEventArgs) Handles BtnManageSelectAll.Click
-        If SelectedMods.Count < PanList.Children.Count Then
-            ChangeAllSelected(True)
+        Dim CurrentSelected As Integer = 0
+        For Each Item In PanList.Children.OfType(Of MyLocalModItem).ToList
+            If Item.Checked Then CurrentSelected += 1
+        Next
+        If CurrentSelected < PanList.Children.Count Then
+            ChangeCurrentSelected(True)
         Else
-            ChangeAllSelected(False)
+            ChangeCurrentSelected(False)
         End If
     End Sub
 
@@ -229,7 +288,7 @@
 
     '改变下边栏状态
     Private ShownCount As Integer = 0
-    Private Sub RefreshBottomBar()
+    Public Sub RefreshBottomBar()
         '计数
         Dim NewCount As Integer = SelectedMods.Count
         Dim Selected = NewCount > 0
@@ -256,6 +315,7 @@
         '更新显示状态
         If AniControlEnabled = 0 Then
             If Selected Then
+                PanListBack.Margin = New Thickness(0, 0, 0, 95)
                 '仅在数量增加时播放出现/跳跃动画
                 If ShownCount >= NewCount Then
                     ShownCount = NewCount
@@ -272,6 +332,7 @@
                     AaTranslateY(CardSelect, -1, 90, 270, Ease:=New AniEaseInoutFluent(AniEasePower.Weak))
                 }, "Mod Sidebar")
             Else
+                PanListBack.Margin = New Thickness(0, 0, 0, 15)
                 '不重复播放隐藏动画
                 If ShownCount = 0 Then Return
                 ShownCount = 0
@@ -301,7 +362,7 @@
     Private Sub ChangeAllSelected(Value As Boolean)
         AniControlEnabled += 1
         SelectedMods.Clear()
-        For Each Item As MyLocalModItem In PanList.Children
+        For Each Item As MyLocalModItem In ModItems.Values.ToList
             Item.Checked = Value
             If Value Then SelectedMods.Add(Item.Entry.RawFileName)
         Next
@@ -309,6 +370,22 @@
         '更新下边栏 UI
         RefreshBottomBar()
     End Sub
+
+    Private Sub ChangeCurrentSelected(Value As Boolean)
+        AniControlEnabled += 1
+        For Each Item As MyLocalModItem In PanList.Children
+            Item.Checked = Value
+            If Value Then
+                If Not SelectedMods.Contains(Item.Entry.RawFileName) Then SelectedMods.Add(Item.Entry.RawFileName)
+            Else
+                If SelectedMods.Contains(Item.Entry.RawFileName) Then SelectedMods.Remove(Item.Entry.RawFileName)
+            End If
+        Next
+        AniControlEnabled -= 1
+        '更新下边栏 UI
+        RefreshBottomBar()
+    End Sub
+
     Private Sub UnselectedAllWithAnimation() Handles Load.StateChanged, Me.PageExit
         Dim CacheAniControlEnabled = AniControlEnabled
         AniControlEnabled = 0
@@ -316,7 +393,26 @@
         AniControlEnabled += CacheAniControlEnabled
     End Sub
     Private Sub PageVersionMod_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
-        If My.Computer.Keyboard.CtrlKeyDown AndAlso e.Key = Key.A Then ChangeAllSelected(True)
+        If My.Computer.Keyboard.CtrlKeyDown AndAlso e.Key = Key.A Then ChangeCurrentSelected(True)
+    End Sub
+
+    Private ViewModType As ViewType = ViewType.All
+
+    Private Enum ViewType As Integer
+        All
+        Enabled
+        Disabled
+        CanUpdate
+        InError
+    End Enum
+
+    Private Sub ChangeViewType(sender As MyRadioButton, raiseByMouse As Boolean) Handles BtnTypeAll.Check, BtnTypeCanUpdate.Check, BtnTypeDisabled.Check, BtnTypeEnabled.Check, BtnTypeError.Check
+        ViewModType = sender.Tag
+        If IsSearching Then
+            SearchRun()
+        Else
+            RefreshResult(McModLoader.Output)
+        End If
     End Sub
 
 #End Region
@@ -328,6 +424,7 @@
         EDMods(McModLoader.Output.Where(Function(m) SelectedMods.Contains(m.RawFileName)),
                Not sender.Equals(BtnSelectDisable))
         ChangeAllSelected(False)
+        RefreshResult(McModLoader.Output)
     End Sub
     Private Sub EDMods(ModList As IEnumerable(Of McMod), IsEnable As Boolean)
         Dim IsSuccessful As Boolean = True

+ 5 - 8
Plain Craft Launcher 2/Pages/PageVersion/PageVersionOverall.xaml.vb

@@ -284,14 +284,11 @@
     Private Sub BtnManageCheck_Click(sender As Object, e As EventArgs) Handles BtnManageCheck.Click
         Try
             '重复任务检查
-            SyncLock LoaderTaskbarLock
-                For i = 0 To LoaderTaskbar.Count - 1
-                    If LoaderTaskbar(i).Name = PageVersionLeft.Version.Name & " 文件补全" Then
-                        Hint("正在处理中,请稍候!", HintType.Critical)
-                        Exit Sub
-                    End If
-                Next
-            End SyncLock
+            For Each OngoingLoader In LoaderTaskbar
+                If OngoingLoader.Name <> PageVersionLeft.Version.Name & " 文件补全" Then Continue For
+                Hint("正在处理中,请稍候!", HintType.Critical)
+                Exit Sub
+            Next
             '启动
             Dim Loader As New LoaderCombo(Of String)(PageVersionLeft.Version.Name & " 文件补全", DlClientFix(PageVersionLeft.Version, True, AssetsIndexExistsBehaviour.AlwaysDownload, False))
             Loader.OnStateChanged =

+ 3 - 1
Plain Craft Launcher 2/Plain Craft Launcher 2.vbproj

@@ -879,7 +879,6 @@
     <Resource Include="Images\Heads\bangbang93.png" />
   </ItemGroup>
   <ItemGroup>
-    <Resource Include="Images\Heads\DoodleHuang.png" />
     <Resource Include="Images\Heads\wiki.png" />
   </ItemGroup>
   <ItemGroup>
@@ -935,5 +934,8 @@
   <ItemGroup>
     <Resource Include="Images\Blocks\NeoForge.png" />
   </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Images\Heads\z0z0r4.png" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
 </Project>

BIN
Plain Craft Launcher 2/Resources/Help.zip


Fișier diff suprimat deoarece este prea mare
+ 131 - 131
Plain Craft Launcher 2/Resources/ModData.txt


BIN
Plain Craft Launcher 2/Resources/java-wrapper.jar


+ 2 - 2
README.md

@@ -2,7 +2,7 @@
 
 [![Stars](https://img.shields.io/github/stars/Hex-Dragon/PCL2?style=flat&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZD0iTTggLjI1YS43NS43NSAwIDAgMSAuNjczLjQxOGwxLjg4MiAzLjgxNSA0LjIxLjYxMmEuNzUuNzUgMCAwIDEgLjQxNiAxLjI3OWwtMy4wNDYgMi45Ny43MTkgNC4xOTJhLjc1MS43NTEgMCAwIDEtMS4wODguNzkxTDggMTIuMzQ3bC0zLjc2NiAxLjk4YS43NS43NSAwIDAgMS0xLjA4OC0uNzlsLjcyLTQuMTk0TC44MTggNi4zNzRhLjc1Ljc1IDAgMCAxIC40MTYtMS4yOGw0LjIxLS42MTFMNy4zMjcuNjY4QS43NS43NSAwIDAgMSA4IC4yNVoiIGZpbGw9IiNlYWM1NGYiLz48L3N2Zz4=&logoSize=auto&label=Stars&labelColor=666666&color=eac54f)](https://github.com/Hex-Dragon/PCL2/)
 [![Issues](https://img.shields.io/github/issues/Hex-Dragon/PCL2?style=flat&label=Issues&labelColor=666666&color=1a7f37)](https://github.com/Hex-Dragon/PCL2/issues)
-[![爱发电](https://img.shields.io/badge/赞助-%E7%88%B1%E5%8F%91%E7%94%B5-946ce6?style=flat&labelColor=666666&logoSize=auto)](https://afdian.net/@LTCat)
+[![爱发电](https://img.shields.io/badge/赞助-%E7%88%B1%E5%8F%91%E7%94%B5-946ce6?style=flat&labelColor=666666&logoSize=auto)](https://afdian.com/@LTCat)
 
 <br/>
 
@@ -16,7 +16,7 @@ PCL 的代码绝大多数其实都是几年前学生时代的产物了……那
 
 ## 相关内容
 - [PCL 功能投票](https://github.com/Hex-Dragon/PCL2/discussions/2):来参加投票吧,开发者会优先处理票数较高的帖子!
-- [程序下载](https://afdian.net/p/0164034c016c11ebafcb52540025c377):下载免费的正式版 PCL。
+- [程序下载](https://afdian.com/p/0164034c016c11ebafcb52540025c377):下载免费的正式版 PCL。
 - [帮助文档库](https://github.com/LTCatt/PCL2Help):PCL 帮助文档在 GitHub 上的存储库(是的,帮助库在另一个 Repo……)
 
 <br/>

BIN
最新正式版.zip


Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff