From 8d9dc4712bc3f54a089d99e221348ea7dbe21555 Mon Sep 17 00:00:00 2001 From: Pigeon0v0 Date: Sat, 15 Jun 2024 23:12:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20NeoForge=20=E7=89=88=E6=9C=AC=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=8E=92=E5=BA=8F=EF=BC=8C=E4=BD=86=E6=98=AF=E6=8A=BD?= =?UTF-8?q?=E8=B1=A1=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Minecraft/ModDownload.vb | 14 ++++++++++---- .../Pages/PageDownload/ModDownloadLib.vb | 3 +-- .../Pages/PageDownload/PageDownloadInstall.xaml.vb | 4 +++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb index 78907b57..b6db08cf 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb @@ -752,6 +752,10 @@ ''' 是否是 Beta 版。若未提供则默认为 False。 ''' Public IsBeta As Boolean = False + ''' + ''' 标准的版本号 + ''' + Public StdVersion As String Public Structure DlNeoForgeListResult ''' ''' 数据来源名称,如“Official”,“BMCLAPI”。 @@ -897,17 +901,19 @@ Dim Versions As New List(Of DlNeoForgeVersionEntry) Try For Each Token As JObject In Json - Dim Name As String + Dim Name As String '存储 rawVersion,貌似变化更加频繁 + Dim StdVersion As String '存储 version,相对规则 Dim IsBeta As Boolean If Token("version").Contains("-beta") Then - Name = Token("version").ToString() - "-beta" + StdVersion = Token("version").ToString() - "-beta" IsBeta = True Else - Name = Token("version") + StdVersion = Token("version").ToString() IsBeta = False End If + Name = Token("rawVersion") Dim Inherit As String = Token("mcversion") - Dim Entry = New DlNeoForgeVersionEntry With {.Version = Name, .Inherit = Inherit, .IsBeta = IsBeta} + Dim Entry = New DlNeoForgeVersionEntry With {.Version = Name, .Inherit = Inherit, .IsBeta = IsBeta, .StdVersion = StdVersion} Versions.Add(Entry) Next 'For Each Token As JObject In Json diff --git a/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb b/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb index 97a63446..9a58b325 100644 --- a/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb +++ b/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb @@ -2241,11 +2241,10 @@ Retry: '获取最新版本 Dim FreshVersion As DlNeoForgeVersionEntry = Nothing If Entrys.Any Then - FreshVersion = Entrys(0) + FreshVersion = Entrys.Last() Else Log("[System] 未找到可用的 NeoForge 版本", LogLevel.Debug) End If - Dim RecommendedVersion As DlNeoForgeVersionEntry = Nothing '显示各个版本 If FreshVersion IsNot Nothing Then Dim Fresh = NeoForgeDownloadListItem(FreshVersion, OnClick, IsSaveOnly) diff --git a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb index e93e7789..8d3808d9 100644 --- a/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageDownload/PageDownloadInstall.xaml.vb @@ -974,9 +974,11 @@ If Not Loader.Output.Any() Then Exit Sub PanNeoForge.Children.Clear() + Dim VersionsArray As Array = Versions.ToArray() + VersionsArray.Reverse(VersionsArray) 'Versions = Sort(Versions, Function(a, b) New Version(a.Version) > New Version(b.Version)).ToList NeoForgeDownloadListItemPreload(PanNeoForge, Versions, AddressOf NeoForge_Selected, False) - For Each Version In Versions + For Each Version In VersionsArray PanNeoForge.Children.Add(NeoForgeDownloadListItem(Version, AddressOf NeoForge_Selected, False)) Next Catch ex As Exception