From 26ea4bed1c02c7ac0d24bc62af81632de2cd65d9 Mon Sep 17 00:00:00 2001 From: wyc-26 Date: Fri, 2 May 2025 16:44:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(ModDownload):=20=E6=84=9A=E4=BA=BA?= =?UTF-8?q?=E8=8A=82=E7=89=88=E6=9C=AC=E6=97=A0=E6=B3=95=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=20NeoForge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Minecraft/ModDownload.vb | 6 +++- .../PageDownload/PageDownloadInstall.xaml.vb | 33 ++++++++----------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb index 67bf3490b..f18398b8f 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb @@ -798,6 +798,10 @@ VersionName = ApiName.Replace("1.20.1-", "") Version = New Version("19." & VersionName) Inherit = "1.20.1" + ElseIf ApiName.StartsWith("0.") Then '0.25w14craftmine.3-beta + VersionName = ApiName + Version = New Version("0.0." & ApiName.BeforeFirst("-").AfterFirst(".").AfterFirst(".") & ".0") 'Minor 里有字母,但 Version 类的 Minor 是 Int 类型,只能这样写了 + Inherit = ApiName.BeforeFirst("-").AfterFirst(".").BeforeFirst(".") Else '20.4.30-beta VersionName = ApiName Version = New Version(ApiName.BeforeFirst("-")) @@ -868,7 +872,7 @@ Private Function GetNeoForgeEntries(LatestJson As String, LatestLegacyJson As String) As List(Of DlNeoForgeListEntry) Dim VersionNames = RegexSearch(LatestLegacyJson & LatestJson, - "(?<="")(1\.20\.1-)?\d+\.\d+\.\d+(-beta)?(?="")") '我寻思直接正则就行.jpg + "(?<="")(?:(1\.20\.1-)?\d+\.\d+\.\d+|0\.[^.]+\.\d+)(-beta)?(?="")") '我寻思直接正则就行.jpg Dim Versions = VersionNames. Where(Function(name) name <> "47.1.82"). '这个版本虽然在版本列表中,但不能下载 Select(Function(name) New DlNeoForgeListEntry(name)).ToList diff --git a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb index 9d98e0d95..bf2eeb0e8 100644 --- a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb @@ -369,25 +369,21 @@ LabForge.Foreground = ColorGray1 End If 'NeoForge - If Not SelectedMinecraftId.Contains("1.") OrElse Val(SelectedMinecraftId.Split(".")(1)) <= 19 Then - CardNeoForge.Visibility = Visibility.Collapsed + CardNeoForge.Visibility = Visibility.Visible + Dim NeoForgeError As String = LoadNeoForgeGetError() + CardNeoForge.MainSwap.Visibility = If(NeoForgeError Is Nothing, Visibility.Visible, Visibility.Collapsed) + If NeoForgeError IsNot Nothing Then CardNeoForge.IsSwaped = True + SetNeoForgeInfoShow(CardNeoForge.IsSwaped) + If SelectedNeoForge Is Nothing Then + BtnNeoForgeClear.Visibility = Visibility.Collapsed + ImgNeoForge.Visibility = Visibility.Collapsed + LabNeoForge.Text = If(NeoForgeError, "可以添加") + LabNeoForge.Foreground = ColorGray4 Else - CardNeoForge.Visibility = Visibility.Visible - Dim NeoForgeError As String = LoadNeoForgeGetError() - CardNeoForge.MainSwap.Visibility = If(NeoForgeError Is Nothing, Visibility.Visible, Visibility.Collapsed) - If NeoForgeError IsNot Nothing Then CardNeoForge.IsSwaped = True - SetNeoForgeInfoShow(CardNeoForge.IsSwaped) - If SelectedNeoForge Is Nothing Then - BtnNeoForgeClear.Visibility = Visibility.Collapsed - ImgNeoForge.Visibility = Visibility.Collapsed - LabNeoForge.Text = If(NeoForgeError, "可以添加") - LabNeoForge.Foreground = ColorGray4 - Else - BtnNeoForgeClear.Visibility = Visibility.Visible - ImgNeoForge.Visibility = Visibility.Visible - LabNeoForge.Text = SelectedNeoForge.VersionName - LabNeoForge.Foreground = ColorGray1 - End If + BtnNeoForgeClear.Visibility = Visibility.Visible + ImgNeoForge.Visibility = Visibility.Visible + LabNeoForge.Text = SelectedNeoForge.VersionName + LabNeoForge.Foreground = ColorGray1 End If 'Fabric If SelectedMinecraftId.Contains("1.") AndAlso Val(SelectedMinecraftId.Split(".")(1)) <= 13 Then @@ -918,7 +914,6 @@ ''' 获取 NeoForge 的加载异常信息。若正常则返回 Nothing。 ''' Private Function LoadNeoForgeGetError() As String - If Not SelectedMinecraftId.StartsWith("1.") Then Return "不可用" If SelectedOptiFine IsNot Nothing Then Return "与 OptiFine 不兼容" If SelectedForge IsNot Nothing Then Return "与 Forge 不兼容" If SelectedFabric IsNot Nothing Then Return "与 Fabric 不兼容" From ea9bb8f5ed07f83266b5ff10a55436073243eefc Mon Sep 17 00:00:00 2001 From: wyc-26 Date: Fri, 2 May 2025 16:47:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore(PageDownloadInstall):=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E4=B8=80=E8=A1=8C=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/PageDownload/PageDownloadInstall.xaml.vb | 1 - 1 file changed, 1 deletion(-) diff --git a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb index bf2eeb0e8..9ff834d02 100644 --- a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb @@ -369,7 +369,6 @@ LabForge.Foreground = ColorGray1 End If 'NeoForge - CardNeoForge.Visibility = Visibility.Visible Dim NeoForgeError As String = LoadNeoForgeGetError() CardNeoForge.MainSwap.Visibility = If(NeoForgeError Is Nothing, Visibility.Visible, Visibility.Collapsed) If NeoForgeError IsNot Nothing Then CardNeoForge.IsSwaped = True