diff --git a/Plain Craft Launcher 2/Modules/Base/ModBase.vb b/Plain Craft Launcher 2/Modules/Base/ModBase.vb
index 646cac0a..ca5aab48 100644
--- a/Plain Craft Launcher 2/Modules/Base/ModBase.vb
+++ b/Plain Craft Launcher 2/Modules/Base/ModBase.vb
@@ -178,6 +178,10 @@ Public Module ModBase
'''
''' 图标,音符,1x
'''
+ Public Const IconButtonServer As String = "M640 725.333333a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m-256 0H256a42.666667 42.666667 0 0 0 0 85.333334h128a42.666667 42.666667 0 1 0 0-85.333334z m384 0a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m-128-256a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m-256 0H256a42.666667 42.666667 0 1 0 0 85.333334h128a42.666667 42.666667 0 1 0 0-85.333334z m384-256a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m0 256a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m170.666667-256a128 128 0 0 0-128-128H213.333333a128 128 0 0 0-128 128v85.333334a128 128 0 0 0 33.28 85.333333A128 128 0 0 0 85.333333 469.333333v85.333334a128 128 0 0 0 33.28 85.333333A128 128 0 0 0 85.333333 725.333333v85.333334a128 128 0 0 0 128 128h597.333334a128 128 0 0 0 128-128v-85.333334a128 128 0 0 0-33.28-85.333333 128 128 0 0 0 33.28-85.333333v-85.333334a128 128 0 0 0-33.28-85.333333A128 128 0 0 0 938.666667 298.666667V213.333333z m-85.333334 597.333334a42.666667 42.666667 0 0 1-42.666666 42.666666H213.333333a42.666667 42.666667 0 0 1-42.666666-42.666666v-85.333334a42.666667 42.666667 0 0 1 42.666666-42.666666h597.333334a42.666667 42.666667 0 0 1 42.666666 42.666666v85.333334z m0-256a42.666667 42.666667 0 0 1-42.666666 42.666666H213.333333a42.666667 42.666667 0 0 1-42.666666-42.666666v-85.333334a42.666667 42.666667 0 0 1 42.666666-42.666666h597.333334a42.666667 42.666667 0 0 1 42.666666 42.666666v85.333334z m0-256a42.666667 42.666667 0 0 1-42.666666 42.666666H213.333333a42.666667 42.666667 0 0 1-42.666666-42.666666V213.333333a42.666667 42.666667 0 0 1 42.666666-42.666666h597.333334a42.666667 42.666667 0 0 1 42.666666 42.666666v85.333334z m-213.333333-85.333334a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334zM384 213.333333H256a42.666667 42.666667 0 1 0 0 85.333334h128a42.666667 42.666667 0 1 0 0-85.333334z"
+ '''
+ ''' 图标,音符,1x
+ '''
Public Const IconMusic As String = "M348.293565 716.53287V254.797913c0-41.672348 28.004174-78.358261 68.919652-90.37913L815.994435 40.826435c62.775652-18.610087 125.907478 26.579478 125.907478 89.933913v539.158261c8.013913 42.25113-8.94887 89.177043-47.014956 127.109565a232.848696 232.848696 0 0 1-170.785392 65.758609c-61.885217-2.938435-111.081739-33.435826-129.113043-80.050087-18.031304-46.614261-2.137043-102.177391 41.672348-145.853218a232.848696 232.848696 0 0 1 170.785391-65.80313c21.014261 1.024 40.514783 5.164522 57.878261 12.065391V233.338435c0-12.109913-10.551652-20.034783-20.569044-20.034783a24.620522 24.620522 0 0 0-5.787826 0.934957L439.785739 338.18713a19.545043 19.545043 0 0 0-14.825739 19.144348v438.984348H423.846957c11.53113 43.987478-5.164522 94.208-45.412174 134.322087a232.848696 232.848696 0 0 1-170.785392 65.758609c-61.885217-2.938435-111.081739-33.435826-129.113043-80.050087-18.031304-46.614261-2.137043-102.177391 41.672348-145.853218a232.848696 232.848696 0 0 1 170.785391-65.80313c20.791652 1.024 40.069565 5.075478 57.299478 11.842783z"
'''
''' 图标,播放,0.8x
diff --git a/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb b/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb
index 2f6019fa..02a4a0b8 100644
--- a/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb
+++ b/Plain Craft Launcher 2/Pages/PageDownload/ModDownloadLib.vb
@@ -207,9 +207,19 @@ Public Module ModDownloadLib
ToolTipService.SetVerticalOffset(BtnInfo, 30)
ToolTipService.SetHorizontalOffset(BtnInfo, 2)
AddHandler BtnInfo.Click, AddressOf McDownloadMenuLog
- sender.Buttons = {BtnInfo}
+ Dim BtnServer As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonServer, .ToolTip = "下载服务端"}
+ ToolTipService.SetPlacement(BtnServer, Primitives.PlacementMode.Center)
+ ToolTipService.SetVerticalOffset(BtnServer, 30)
+ ToolTipService.SetHorizontalOffset(BtnServer, 2)
+ AddHandler BtnServer.Click, AddressOf McDownloadMenuServer
+ sender.Buttons = {BtnServer, BtnInfo}
End Sub
Private Sub McDownloadMenuBuild(sender As Object, e As EventArgs)
+ Dim BtnServer As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonServer, .ToolTip = "下载服务端"}
+ ToolTipService.SetPlacement(BtnServer, Primitives.PlacementMode.Center)
+ ToolTipService.SetVerticalOffset(BtnServer, 30)
+ ToolTipService.SetHorizontalOffset(BtnServer, 2)
+ AddHandler BtnServer.Click, AddressOf McDownloadMenuServer
Dim BtnSave As New MyIconButton With {.Logo = Logo.IconButtonSave, .ToolTip = "另存为"}
ToolTipService.SetPlacement(BtnSave, Primitives.PlacementMode.Center)
ToolTipService.SetVerticalOffset(BtnSave, 30)
@@ -220,7 +230,7 @@ Public Module ModDownloadLib
ToolTipService.SetVerticalOffset(BtnInfo, 30)
ToolTipService.SetHorizontalOffset(BtnInfo, 2)
AddHandler BtnInfo.Click, AddressOf McDownloadMenuLog
- sender.Buttons = {BtnSave, BtnInfo}
+ sender.Buttons = {BtnServer, BtnSave, BtnInfo}
End Sub
Private Sub McDownloadMenuLog(sender As Object, e As RoutedEventArgs)
Dim Version As JToken
@@ -233,6 +243,61 @@ Public Module ModDownloadLib
End If
McUpdateLogShow(Version)
End Sub
+ Private Sub McDownloadMenuServer(sender As Object, e As RoutedEventArgs)
+ Dim Version As JToken
+ If sender.Tag IsNot Nothing Then
+ Version = sender.Tag
+ ElseIf sender.Parent.Tag IsNot Nothing Then
+ Version = sender.Parent.Tag
+ Else
+ Version = sender.Parent.Parent.Tag
+ End If
+ RunInThread(Sub()
+ Dim Json As JObject
+ Try
+ Json = NetGetCodeByRequestRetry(Version("url"), IsJson:=True)
+ Catch ex As Exception
+ Log(ex, "未找能获取到服务端文件,文件可能不存在")
+ End Try
+ If Json?("downloads")?("server") Is Nothing Then
+ Hint("此版本暂未有服务端文件提供下载")
+ Else
+ RunInUi(Sub()
+ Try
+ Dim Url As String = Json("downloads")("server")("url").ToString()
+ Dim FileName As String = Version("id").ToString() & "-server.jar"
+ Dim VersionID As String = Version("id").ToString()
+ Dim Target As String = SelectAs("选择保存位置", FileName, "原版服务端 (*.jar)|*.jar")
+ If Not Target.Contains("\") Then Exit Sub
+
+ '重复任务检查
+ For Each OngoingLoader In LoaderTaskbar
+ If OngoingLoader.Name <> $"{VersionID} 服务端下载" Then Continue For
+ Hint("该服务端文件正在下载中!", HintType.Critical)
+ Exit Sub
+ Next
+
+ '构造步骤加载器
+ Dim Loaders As New List(Of LoaderBase)
+ '下载
+ Dim Address As New List(Of String)
+ Address.Add(Url)
+ Loaders.Add(New LoaderDownload("下载服务端文件", New List(Of NetFile) From {New NetFile(Address.ToArray, Target, New FileChecker(MinSize:=1024 * 64))}) With {.ProgressWeight = 15})
+ '启动
+ Dim Loader As New LoaderCombo(Of JObject)($"{VersionID} 服务端下载", Loaders) With {.OnStateChanged = AddressOf DownloadStateSave}
+ Loader.Start(Json("downloads")("server"))
+ LoaderTaskbarAdd(Loader)
+ FrmMain.BtnExtraDownload.ShowRefresh()
+ FrmMain.BtnExtraDownload.Ribble()
+
+ Catch ex As Exception
+ Log(ex, "开始服务端文件下载失败", LogLevel.Feedback)
+ End Try
+ End Sub)
+ End If
+ End Sub
+ )
+ End Sub
Public Sub McDownloadMenuSave(sender As Object, e As RoutedEventArgs)
Dim Version As MyListItem
If TypeOf sender Is MyListItem Then
@@ -1446,9 +1511,9 @@ Sub(Task As LoaderTask(Of List(Of NetFile), Boolean))
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
+ Log(ex, "非新版方式安装 Forge 清理文件时出错")
+ End Try
+ End Try
End Sub) With {.ProgressWeight = 1})
End If