2.13.0.0
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Public Module ModDownloadLib
|
||||
Public Module ModDownloadLib
|
||||
|
||||
#Region "Minecraft 下载"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
End Sub) With {.ProgressWeight = 2, .Show = False})
|
||||
End If
|
||||
Loaders.Add(New LoaderDownload(McDownloadClientJsonName, New List(Of NetFile) From {
|
||||
New NetFile(DlSourceLauncherOrMetaGet(If(JsonUrl, "")), VersionFolder & InstanceName & ".json", New FileChecker(CanUseExistsFile:=False, IsJson:=True))
|
||||
New NetFile(DlSourceLauncherOrMetaGet(If(JsonUrl, "")), VersionFolder & InstanceName & ".json", New FileChecker With {.IsJson = True})
|
||||
}) With {.ProgressWeight = 3})
|
||||
|
||||
'下载支持库文件
|
||||
@@ -47,7 +47,7 @@
|
||||
End Try
|
||||
'顺手添加 Json 项目
|
||||
Try
|
||||
Dim InstanceJson As JObject = GetJson(FileUtils.ReadAsString(VersionFolder & InstanceName & ".json"))
|
||||
Dim InstanceJson As JObject = FileUtils.ReadAsJson(VersionFolder & InstanceName & ".json")
|
||||
InstanceJson.Add("clientVersion", Id)
|
||||
FileUtils.Write($"{VersionFolder}{InstanceName}.json", InstanceJson.ToString)
|
||||
Catch ex As Exception
|
||||
@@ -106,32 +106,17 @@
|
||||
End Function
|
||||
Private Sub McDownloadSaveMenuBuild(sender As Object, e As EventArgs)
|
||||
Dim BtnInfo As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonInfo, .ToolTip = "更新日志"}
|
||||
ToolTipService.SetPlacement(BtnInfo, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnInfo, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnInfo, 2)
|
||||
AddHandler BtnInfo.Click, AddressOf McDownloadMenuLog
|
||||
Dim BtnServer As New MyIconButton With {.LogoScale = 1, .Logo = Logo.IconButtonServer, .ToolTip = "下载服务端"}
|
||||
ToolTipService.SetPlacement(BtnServer, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnServer, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnServer, 2)
|
||||
AddHandler BtnServer.Click, AddressOf McDownloadMenuSaveServer
|
||||
sender.Buttons = {BtnServer, BtnInfo}
|
||||
End Sub
|
||||
Private Sub McDownloadMenuBuild(sender As Object, e As EventArgs)
|
||||
Dim BtnSave As New MyIconButton With {.Logo = Logo.IconButtonSave, .ToolTip = "另存为"}
|
||||
ToolTipService.SetPlacement(BtnSave, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnSave, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnSave, 2)
|
||||
AddHandler BtnSave.Click, AddressOf McDownloadMenuSave
|
||||
Dim BtnInfo As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonInfo, .ToolTip = "更新日志"}
|
||||
ToolTipService.SetPlacement(BtnInfo, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnInfo, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnInfo, 2)
|
||||
AddHandler BtnInfo.Click, AddressOf McDownloadMenuLog
|
||||
Dim BtnServer As New MyIconButton With {.LogoScale = 1, .Logo = Logo.IconButtonServer, .ToolTip = "下载服务端"}
|
||||
ToolTipService.SetPlacement(BtnServer, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnServer, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnServer, 2)
|
||||
AddHandler BtnServer.Click, AddressOf McDownloadMenuSaveServer
|
||||
sender.Buttons = {BtnSave, BtnInfo, BtnServer}
|
||||
End Sub
|
||||
@@ -172,7 +157,7 @@
|
||||
Dim Loaders As New List(Of LoaderBase)
|
||||
'下载版本 JSON 文件
|
||||
Loaders.Add(New LoaderDownload("下载版本 JSON 文件", New List(Of NetFile) From {
|
||||
New NetFile(DlSourceLauncherOrMetaGet(JsonUrl), VersionFolder & Id & ".json", New FileChecker(CanUseExistsFile:=False, IsJson:=True))
|
||||
New NetFile(DlSourceLauncherOrMetaGet(JsonUrl), VersionFolder & Id & ".json", New FileChecker With {.IsJson = True})
|
||||
}) With {.ProgressWeight = 2})
|
||||
'构建服务端
|
||||
Loaders.Add(New LoaderTask(Of String, List(Of NetFile))("构建服务端",
|
||||
@@ -185,11 +170,11 @@
|
||||
Task.Output = New List(Of NetFile)
|
||||
Hint($"Mojang 没有给 Minecraft {Id} 提供官方服务端下载,没法下,撤退!", HintType.Red)
|
||||
Thread.Sleep(2000) '等玩家把上一个提示看完
|
||||
Task.Interrupt()
|
||||
Task.Cancel()
|
||||
Return
|
||||
End If
|
||||
Dim JarUrl As String = Instance.JsonObject("downloads")("server")("url")
|
||||
Dim Checker As New FileChecker(MinSize:=1024, ActualSize:=If(Instance.JsonObject("downloads")("server")("size"), -1), Hash:=Instance.JsonObject("downloads")("server")("sha1"))
|
||||
Dim Checker As New FileChecker With {.MinSize = 1024, .ActualSize = If(Instance.JsonObject("downloads")("server")("size"), -1), .Hash = Instance.JsonObject("downloads")("server")("sha1")}
|
||||
Task.Output = New List(Of NetFile) From {New NetFile(DlSourceLauncherOrMetaGet(JarUrl), VersionFolder & Id & "-server.jar", Checker)}
|
||||
'添加启动脚本
|
||||
Dim Bat As String =
|
||||
@@ -205,7 +190,7 @@ echo ----------------------
|
||||
echo 服务端已停止。
|
||||
pause"
|
||||
FileUtils.Write(VersionFolder & "Launch Server.bat", Bat,
|
||||
Encoding:=If(Encoding.Default.Equals(Encoding.UTF8), Encoding.UTF8, Encoding.GetEncoding("GB18030")))
|
||||
encoding:=If(Encoding.Default.Equals(Encoding.UTF8), Encoding.UTF8, Encoding.GetEncoding("GB18030")))
|
||||
'删除版本 JSON
|
||||
FileUtils.Delete(VersionFolder & Id & ".json")
|
||||
End Sub) With {.ProgressWeight = 0.5, .Show = False})
|
||||
@@ -248,7 +233,7 @@ pause"
|
||||
Dim Loaders As New List(Of LoaderBase)
|
||||
'下载版本 JSON 文件
|
||||
Loaders.Add(New LoaderDownload("下载版本 JSON 文件", New List(Of NetFile) From {
|
||||
New NetFile(DlSourceLauncherOrMetaGet(JsonUrl), VersionFolder & Id & ".json", New FileChecker(CanUseExistsFile:=False, IsJson:=True))
|
||||
New NetFile(DlSourceLauncherOrMetaGet(JsonUrl), VersionFolder & Id & ".json", New FileChecker With {.IsJson = True})
|
||||
}) With {.ProgressWeight = 2})
|
||||
'获取支持库文件地址
|
||||
Loaders.Add(New LoaderTask(Of String, List(Of NetFile))("分析核心 JAR 文件下载地址",
|
||||
@@ -357,27 +342,29 @@ pause"
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub McDownloadOptiFineInstall(BaseMcFolderHome As String, Target As String, Task As LoaderTask(Of List(Of NetFile), Boolean), UseJavaWrapper As Boolean)
|
||||
Dim JavaRange = ValueRange(Of Version).AtLeast(New Version(21, 0)) '默认值
|
||||
Try
|
||||
Using Installer = FileUtils.OpenZip(Target)
|
||||
Dim InstallerClass = Installer.GetEntry("optifine/Installer.class")
|
||||
If InstallerClass Is Nothing Then Throw New FileNotFoundException("未找到 optifine/Installer.class")
|
||||
Using Stream = InstallerClass.Open(), Reader As New BinaryReader(Stream)
|
||||
Dim Header = Reader.ReadBytes(8)
|
||||
If Header.Length < 8 Then Throw New IOException("Installer.class 长度不足")
|
||||
If Header(0) <> &HCA OrElse Header(1) <> &HFE OrElse Header(2) <> &HBA OrElse Header(3) <> &HBE Then Throw New InvalidDataException("Installer.class 文件头无效")
|
||||
Dim ClassVersion = Header(6) * &H100 + Header(7)
|
||||
If ClassVersion < 49 Then Throw New InvalidDataException("Installer.class 版本过低")
|
||||
If ClassVersion > 100 Then Throw New InvalidDataException("Installer.class 版本过高")
|
||||
JavaRange = ValueRange(Of Version).AtLeast(New Version(ClassVersion - 44, 0))
|
||||
Logger.Info($"OptiFine 安装器 class 版本:{ClassVersion},需要 Java {JavaRange}")
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
Logger.Warn(ex, "读取 OptiFine 安装器 Java 版本失败")
|
||||
End Try
|
||||
'选择 Java
|
||||
Dim Java As JavaEntry
|
||||
SyncLock JavaLock
|
||||
Java = JavaSelect("已取消安装。", New Version(1, 8, 0, 0))
|
||||
If Java Is Nothing Then
|
||||
'开始自动下载
|
||||
Dim JavaLoader = GetJavaDownloadLoader()
|
||||
Try
|
||||
JavaLoader.Start(17, IsForceRestart:=True)
|
||||
Do While JavaLoader.State = LoadState.Loading AndAlso Not Task.IsInterrupted
|
||||
Thread.Sleep(10)
|
||||
Loop
|
||||
Finally
|
||||
JavaLoader.Interrupt() '确保取消时中止 Java 下载
|
||||
End Try
|
||||
'检查下载结果
|
||||
Java = JavaSelect("已取消安装。", New Version(1, 8, 0, 0))
|
||||
If Task.IsInterrupted Then Return
|
||||
If Java Is Nothing Then Throw New Exception("由于未找到 Java,已取消安装。")
|
||||
End If
|
||||
End SyncLock
|
||||
Dim Java As Java = SelectOrDownloadJava(JavaRange, True, Task.CreateCancellationToken, Task.CreateSyncProgressProvider(0, 0.2))
|
||||
If Task.IsCanceled Then Return
|
||||
If Java Is Nothing Then Throw New OperationCanceledException
|
||||
'添加 Java Wrapper 作为主 Jar
|
||||
Dim Arguments As String
|
||||
If UseJavaWrapper AndAlso Not Settings.Get(Of Boolean)("LaunchAdvanceDisableJLW") Then
|
||||
@@ -385,11 +372,11 @@ pause"
|
||||
Else
|
||||
Arguments = $"-Duser.home=""{BaseMcFolderHome.TrimEnd("\")}"" -cp ""{Target}"" optifine.Installer"
|
||||
End If
|
||||
If Java.MajorVersion >= 9 Then Arguments = "--add-exports cpw.mods.bootstraplauncher/cpw.mods.bootstraplauncher=ALL-UNNAMED " & Arguments
|
||||
If Java.Version.Major >= 9 Then Arguments = "--add-exports cpw.mods.bootstraplauncher/cpw.mods.bootstraplauncher=ALL-UNNAMED " & Arguments
|
||||
'开始启动
|
||||
SyncLock InstallSyncLock
|
||||
Dim Info = New ProcessStartInfo With {
|
||||
.FileName = Java.PathJava,
|
||||
.FileName = Java.JavaExePath,
|
||||
.Arguments = Arguments,
|
||||
.UseShellExecute = False,
|
||||
.CreateNoWindow = True,
|
||||
@@ -417,14 +404,14 @@ pause"
|
||||
LastResult = e.Data
|
||||
Logger.Trace(LastResult)
|
||||
TotalLength += 1
|
||||
Task.Progress += 0.9 / 7000
|
||||
Task.Progress += 0.7 / 7000
|
||||
End If
|
||||
Catch ex As ObjectDisposedException
|
||||
Catch ex As Exception
|
||||
Logger.Warn(ex, "读取 OptiFine 安装器信息失败")
|
||||
End Try
|
||||
Try
|
||||
If Task.State = LoadState.Interrupted AndAlso Not process.HasExited Then
|
||||
If Task.State = LoadState.Canceled AndAlso Not process.HasExited Then
|
||||
Logger.Info("由于任务取消,已中止 OptiFine 安装")
|
||||
process.Kill()
|
||||
End If
|
||||
@@ -441,14 +428,14 @@ pause"
|
||||
LastResult = e.Data
|
||||
Logger.Trace(LastResult)
|
||||
TotalLength += 1
|
||||
Task.Progress += 0.9 / 7000
|
||||
Task.Progress += 0.7 / 7000
|
||||
End If
|
||||
Catch ex As ObjectDisposedException
|
||||
Catch ex As Exception
|
||||
Logger.Warn(ex, "读取 OptiFine 安装器错误信息失败")
|
||||
End Try
|
||||
Try
|
||||
If Task.State = LoadState.Interrupted AndAlso Not process.HasExited Then
|
||||
If Task.State = LoadState.Canceled AndAlso Not process.HasExited Then
|
||||
Logger.Info("由于任务取消,已中止 OptiFine 安装")
|
||||
process.Kill()
|
||||
End If
|
||||
@@ -513,7 +500,7 @@ pause"
|
||||
Logger.Warn(ex, $"获取 OptiFine {DownloadInfo.DisplayName} 官方下载地址失败")
|
||||
End Try
|
||||
'构造文件请求
|
||||
Task.Output = New List(Of NetFile) From {New NetFile(Sources.ToArray, Target, New FileChecker(MinSize:=300 * 1024))}
|
||||
Task.Output = New List(Of NetFile) From {New NetFile(Sources.ToArray, Target, New FileChecker With {.MinSize = 300 * 1024})}
|
||||
End Sub) With {.ProgressWeight = 8})
|
||||
Loaders.Add(New LoaderDownload("下载 OptiFine 主文件", New List(Of NetFile)) With {.ProgressWeight = 8})
|
||||
Loaders.Add(New LoaderTask(Of List(Of NetFile), Boolean)("等待原版下载",
|
||||
@@ -523,11 +510,11 @@ pause"
|
||||
ClientDownloadLoader.GetLoaderList.Where(Function(l) l.Name = McDownloadClientLibName OrElse l.Name = McDownloadClientJsonName).
|
||||
Where(Function(l) l.State <> LoadState.Finished).ToList
|
||||
If TargetLoaders.Any Then Logger.Info("OptiFine 安装正在等待原版文件下载完成")
|
||||
Do While TargetLoaders.Any AndAlso Not Task.IsInterrupted
|
||||
Do While TargetLoaders.Any AndAlso Not Task.IsCanceled
|
||||
TargetLoaders = TargetLoaders.Where(Function(l) l.State <> LoadState.Finished).ToList
|
||||
Thread.Sleep(50)
|
||||
Loop
|
||||
If Task.IsInterrupted Then Return
|
||||
If Task.IsCanceled Then Return
|
||||
'复制原版文件
|
||||
If Not IsCustomFolder Then Return
|
||||
SyncLock VanillaSyncLock
|
||||
@@ -666,7 +653,7 @@ Retry:
|
||||
End Try
|
||||
Task.Progress = 0.9
|
||||
'构造文件请求
|
||||
Task.Output = New List(Of NetFile) From {New NetFile(Sources.ToArray, TargetFolder, New FileChecker(MinSize:=64 * 1024))}
|
||||
Task.Output = New List(Of NetFile) From {New NetFile(Sources.ToArray, TargetFolder, New FileChecker With {.MinSize = 64 * 1024})}
|
||||
End Sub) With {.ProgressWeight = 6})
|
||||
'下载
|
||||
Loaders.Add(New LoaderDownload("下载 OptiFine 主文件", New List(Of NetFile)) With {.ProgressWeight = 10, .Block = True})
|
||||
@@ -700,22 +687,13 @@ Retry:
|
||||
End Function
|
||||
Private Sub OptiFineSaveContMenuBuild(sender As Object, e As EventArgs)
|
||||
Dim BtnInfo As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonInfo, .ToolTip = "更新日志"}
|
||||
ToolTipService.SetPlacement(BtnInfo, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnInfo, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnInfo, 2)
|
||||
AddHandler BtnInfo.Click, AddressOf OptiFineLog_Click
|
||||
sender.Buttons = {BtnInfo}
|
||||
End Sub
|
||||
Private Sub OptiFineContMenuBuild(sender As Object, e As EventArgs)
|
||||
Dim BtnSave As New MyIconButton With {.Logo = Logo.IconButtonSave, .ToolTip = "另存为"}
|
||||
ToolTipService.SetPlacement(BtnSave, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnSave, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnSave, 2)
|
||||
AddHandler BtnSave.Click, AddressOf OptiFineSave_Click
|
||||
Dim BtnInfo As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonInfo, .ToolTip = "更新日志"}
|
||||
ToolTipService.SetPlacement(BtnInfo, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnInfo, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnInfo, 2)
|
||||
AddHandler BtnInfo.Click, AddressOf OptiFineLog_Click
|
||||
sender.Buttons = {BtnSave, BtnInfo}
|
||||
End Sub
|
||||
@@ -783,7 +761,7 @@ Retry:
|
||||
'官方源
|
||||
Address.Add("http://jenkins.liteloader.com/job/LiteLoaderInstaller%20" & DownloadInfo.Inherit & "/lastSuccessfulBuild/artifact/" & If(DownloadInfo.Inherit = "1.8", "ant/dist/", "build/libs/") & DownloadInfo.FileName)
|
||||
End If
|
||||
Loaders.Add(New LoaderDownload("下载主文件", New List(Of NetFile) From {New NetFile(Address.ToArray, Target, New FileChecker(MinSize:=1024 * 1024))}) With {.ProgressWeight = 15})
|
||||
Loaders.Add(New LoaderDownload("下载主文件", New List(Of NetFile) From {New NetFile(Address.ToArray, Target, New FileChecker With {.MinSize = 1024 * 1024})}) With {.ProgressWeight = 15})
|
||||
'启动
|
||||
Dim Loader As New LoaderCombo(Of DlLiteLoaderListEntry)("LiteLoader " & Id & " 安装器下载", Loaders) With {.OnStateChanged = AddressOf LoaderStateChangedHintOnly}
|
||||
Loader.Start(DownloadInfo)
|
||||
@@ -820,9 +798,9 @@ Retry:
|
||||
VersionJson.Add("time", Date.ParseExact(DownloadInfo.ReleaseTime, "yyyy/MM/dd HH:mm", Globalization.CultureInfo.InvariantCulture))
|
||||
VersionJson.Add("releaseTime", Date.ParseExact(DownloadInfo.ReleaseTime, "yyyy/MM/dd HH:mm", Globalization.CultureInfo.InvariantCulture))
|
||||
VersionJson.Add("type", "release")
|
||||
VersionJson.Add("arguments", GetJson("{""game"":[""--tweakClass"",""" & DownloadInfo.JsonToken("tweakClass").ToString & """]}"))
|
||||
VersionJson.Add("arguments", ("{""game"":[""--tweakClass"",""" & DownloadInfo.JsonToken("tweakClass").ToString & """]}").DeserializeJson())
|
||||
VersionJson.Add("libraries", DownloadInfo.JsonToken("libraries"))
|
||||
CType(VersionJson("libraries"), JContainer).Add(GetJson("{""name"": ""com.mumfrey:liteloader:" & DownloadInfo.JsonToken("version").ToString & """,""url"": ""https://dl.liteloader.com/versions/""}"))
|
||||
CType(VersionJson("libraries"), JContainer).Add(("{""name"": ""com.mumfrey:liteloader:" & DownloadInfo.JsonToken("version").ToString & """,""url"": ""https://dl.liteloader.com/versions/""}").DeserializeJson())
|
||||
VersionJson.Add("mainClass", "net.minecraft.launchwrapper.Launch")
|
||||
VersionJson.Add("minimumLauncherVersion", 18)
|
||||
VersionJson.Add("inheritsFrom", DownloadInfo.Inherit)
|
||||
@@ -866,26 +844,17 @@ Retry:
|
||||
sender.Buttons = {}
|
||||
Else
|
||||
Dim BtnList As New MyIconButton With {.Logo = Logo.IconButtonList, .ToolTip = "查看全部版本", .Tag = sender}
|
||||
ToolTipService.SetPlacement(BtnList, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnList, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnList, 2)
|
||||
AddHandler BtnList.Click, AddressOf LiteLoaderAll_Click
|
||||
sender.Buttons = {BtnList}
|
||||
End If
|
||||
End Sub
|
||||
Private Sub LiteLoaderContMenuBuild(sender As MyListItem, e As EventArgs)
|
||||
Dim BtnSave As New MyIconButton With {.Logo = Logo.IconButtonSave, .ToolTip = "保存安装器", .Tag = sender}
|
||||
ToolTipService.SetPlacement(BtnSave, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnSave, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnSave, 2)
|
||||
AddHandler BtnSave.Click, AddressOf LiteLoaderSave_Click
|
||||
If sender.Tag.IsLegacy Then
|
||||
sender.Buttons = {BtnSave}
|
||||
Else
|
||||
Dim BtnList As New MyIconButton With {.Logo = Logo.IconButtonList, .ToolTip = "查看全部版本", .Tag = sender}
|
||||
ToolTipService.SetPlacement(BtnList, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnList, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnList, 2)
|
||||
AddHandler BtnList.Click, AddressOf LiteLoaderAll_Click
|
||||
sender.Buttons = {BtnSave, BtnList}
|
||||
End If
|
||||
@@ -936,14 +905,14 @@ Retry:
|
||||
Dim Url As String = NeoForge.UrlBase & "-installer.jar"
|
||||
Files.Add(New NetFile({
|
||||
Url.Replace("maven.neoforged.net/releases", "bmclapi2.bangbang93.com/maven"), Url
|
||||
}, Target, New FileChecker(MinSize:=64 * 1024)))
|
||||
}, Target, New FileChecker With {.MinSize = 64 * 1024}))
|
||||
Else
|
||||
'Forge
|
||||
Dim Forge As DlForgeVersionEntry = Info
|
||||
Files.Add(New NetFile({
|
||||
$"https://bmclapi2.bangbang93.com/maven/net/minecraftforge/forge/{Forge.Inherit}-{Forge.FileVersion}/forge-{Forge.Inherit}-{Forge.FileVersion}-{Forge.Category}.{Forge.FileExtension}",
|
||||
$"https://files.minecraftforge.net/maven/net/minecraftforge/forge/{Forge.Inherit}-{Forge.FileVersion}/forge-{Forge.Inherit}-{Forge.FileVersion}-{Forge.Category}.{Forge.FileExtension}"
|
||||
}, Target, New FileChecker(MinSize:=64 * 1024, Hash:=Forge.Hash)))
|
||||
}, Target, New FileChecker With {.MinSize = 64 * 1024, .Hash = Forge.Hash}))
|
||||
End If
|
||||
|
||||
'构造加载器
|
||||
@@ -964,26 +933,9 @@ Retry:
|
||||
|
||||
Private Sub ForgelikeInjector(Target As String, Task As LoaderTask(Of Boolean, Boolean), McFolder As String, UseJavaWrapper As Boolean, IsNeoForge As Boolean)
|
||||
'选择 Java
|
||||
Dim Java As JavaEntry
|
||||
SyncLock JavaLock
|
||||
Java = JavaSelect("已取消安装。", New Version(1, 8, 0, 60))
|
||||
If Java Is Nothing Then
|
||||
'开始自动下载
|
||||
Dim JavaLoader = GetJavaDownloadLoader()
|
||||
Try
|
||||
JavaLoader.Start(17, IsForceRestart:=True)
|
||||
Do While JavaLoader.State = LoadState.Loading AndAlso Not Task.IsInterrupted
|
||||
Thread.Sleep(10)
|
||||
Loop
|
||||
Finally
|
||||
JavaLoader.Interrupt() '确保取消时中止 Java 下载
|
||||
End Try
|
||||
'检查下载结果
|
||||
Java = JavaSelect("已取消安装。", New Version(1, 8, 0, 60))
|
||||
If Task.IsInterrupted Then Return
|
||||
If Java Is Nothing Then Throw New Exception("由于未找到 Java,已取消安装。")
|
||||
End If
|
||||
End SyncLock
|
||||
Dim Java As Java = SelectOrDownloadJava(ValueRange(Of Version).AtLeast(New Version(8, 0, 60)), True, Task.CreateCancellationToken, Task.CreateSyncProgressProvider(0, 0.2))
|
||||
If Task.IsCanceled Then Return
|
||||
If Java Is Nothing Then Throw New OperationCanceledException
|
||||
'添加 Java Wrapper 作为主 Jar
|
||||
Dim Arguments As String
|
||||
If UseJavaWrapper AndAlso Not Settings.Get(Of Boolean)("LaunchAdvanceDisableJLW") Then
|
||||
@@ -991,11 +943,11 @@ Retry:
|
||||
Else
|
||||
Arguments = $"-cp ""{PathTemp}Cache\forge_installer.jar;{Target}"" com.bangbang93.ForgeInstaller ""{McFolder}"
|
||||
End If
|
||||
If Java.MajorVersion >= 9 Then Arguments = "--add-exports cpw.mods.bootstraplauncher/cpw.mods.bootstraplauncher=ALL-UNNAMED " & Arguments
|
||||
If Java.Version.Major >= 9 Then Arguments = "--add-exports cpw.mods.bootstraplauncher/cpw.mods.bootstraplauncher=ALL-UNNAMED " & Arguments
|
||||
'开始启动
|
||||
SyncLock InstallSyncLock
|
||||
Dim Info = New ProcessStartInfo With {
|
||||
.FileName = Java.PathJava,
|
||||
.FileName = Java.JavaExePath,
|
||||
.Arguments = Arguments,
|
||||
.UseShellExecute = False,
|
||||
.CreateNoWindow = True,
|
||||
@@ -1023,7 +975,7 @@ Retry:
|
||||
Logger.Warn(ex, $"读取 {LoaderName} 安装器信息失败")
|
||||
End Try
|
||||
Try
|
||||
If Task.State = LoadState.Interrupted AndAlso Not process.HasExited Then
|
||||
If Task.State = LoadState.Canceled AndAlso Not process.HasExited Then
|
||||
Logger.Info($"由于任务取消,已中止 {LoaderName} 安装")
|
||||
process.Kill()
|
||||
End If
|
||||
@@ -1046,7 +998,7 @@ Retry:
|
||||
Logger.Warn(ex, $"读取 {LoaderName} 安装器错误信息失败")
|
||||
End Try
|
||||
Try
|
||||
If Task.State = LoadState.Interrupted AndAlso Not process.HasExited Then
|
||||
If Task.State = LoadState.Canceled AndAlso Not process.HasExited Then
|
||||
Logger.Info($"由于任务取消,已中止 {LoaderName} 安装")
|
||||
process.Kill()
|
||||
End If
|
||||
@@ -1080,35 +1032,35 @@ Retry:
|
||||
Private Sub ForgelikeInjectorLine(Content As String, Task As LoaderTask(Of Boolean, Boolean))
|
||||
Select Case Content
|
||||
Case "Extracting json"
|
||||
Task.Progress = 0.07
|
||||
Task.Progress = 0.27
|
||||
Case "Downloading libraries"
|
||||
Task.Progress = 0.08
|
||||
Task.Progress = 0.28
|
||||
Case " File exists: Checksum validated."
|
||||
Task.Progress += 0.003
|
||||
Case "Building Processors"
|
||||
Task.Progress = 0.18
|
||||
Task.Progress = 0.38
|
||||
Case "Task: DOWNLOAD_MOJMAPS" 'B
|
||||
Task.Progress = 0.2
|
||||
Case "Task: MERGE_MAPPING" 'B
|
||||
Task.Progress = 0.3
|
||||
Case "Splitting: "
|
||||
Task.Progress = 0.35
|
||||
Case "Parameter Annotations" 'B
|
||||
Task.Progress = 0.4
|
||||
Case "Task: MERGE_MAPPING" 'B
|
||||
Task.Progress = 0.5
|
||||
Case "Splitting: "
|
||||
Task.Progress = 0.55
|
||||
Case "Parameter Annotations" 'B
|
||||
Task.Progress = 0.6
|
||||
Case "Processing Complete" 'B
|
||||
Task.Progress = 0.5
|
||||
Task.Progress = 0.67
|
||||
Case "log: null" 'new
|
||||
Task.Progress = 0.5
|
||||
Task.Progress = 0.67
|
||||
Case "Sorting" 'new
|
||||
Task.Progress = 0.65
|
||||
Task.Progress = 0.8
|
||||
Case "Remapping final jar" 'A
|
||||
Task.Progress = 0.72
|
||||
Task.Progress = 0.85
|
||||
Case "Remapping jar... 50%" 'A
|
||||
Task.Progress = 0.76
|
||||
Task.Progress = 0.9
|
||||
Case "Remapping jar... 100%" 'A
|
||||
Task.Progress = 0.81
|
||||
Task.Progress = 0.95
|
||||
Case "Injecting profile"
|
||||
Task.Progress = 0.91
|
||||
Task.Progress = 0.98
|
||||
Case Else
|
||||
Logger.Trace(Content)
|
||||
Return
|
||||
@@ -1173,7 +1125,7 @@ Retry:
|
||||
Dim Url As String = Neo.UrlBase & "-installer.jar"
|
||||
Files.Add(New NetFile({
|
||||
Url.Replace("maven.neoforged.net/releases", "bmclapi2.bangbang93.com/maven"), Url
|
||||
}, InstallerAddress, New FileChecker(MinSize:=64 * 1024)))
|
||||
}, InstallerAddress, New FileChecker With {.MinSize = 64 * 1024}))
|
||||
Else
|
||||
'Forge
|
||||
Dim Forge As DlForgeVersionEntry = Info
|
||||
@@ -1182,7 +1134,7 @@ Retry:
|
||||
Files.Add(New NetFile({
|
||||
$"https://bmclapi2.bangbang93.com/maven/net/minecraftforge/forge/{FileName}",
|
||||
$"https://files.minecraftforge.net/maven/net/minecraftforge/forge/{FileName}"
|
||||
}, InstallerAddress, New FileChecker(MinSize:=64 * 1024, Hash:=Forge.Hash)))
|
||||
}, InstallerAddress, New FileChecker With {.MinSize = 64 * 1024, .Hash = Forge.Hash}))
|
||||
End If
|
||||
Task.Output = Files
|
||||
End Sub) With {.ProgressWeight = 0.5, .Show = False})
|
||||
@@ -1200,8 +1152,8 @@ Retry:
|
||||
'解压并获取、合并两个 Json 的信息
|
||||
Installer = FileUtils.OpenZip(InstallerAddress)
|
||||
Task.Progress = 0.2
|
||||
Dim Json As JObject = GetJson(Installer.GetEntry("install_profile.json").Open().ReadString)
|
||||
Dim Json2 As JObject = GetJson(Installer.GetEntry("version.json").Open().ReadString)
|
||||
Dim Json As JObject = Installer.GetEntry("install_profile.json").Open().ReadString().DeserializeJson()
|
||||
Dim Json2 As JObject = Installer.GetEntry("version.json").Open().ReadString().DeserializeJson()
|
||||
Json.Merge(Json2)
|
||||
'获取 Lib 下载信息
|
||||
Libs = McLibListGetWithJson(Json, True)
|
||||
@@ -1209,7 +1161,7 @@ Retry:
|
||||
If Json("data") IsNot Nothing AndAlso Json("data")("MOJMAPS") IsNot Nothing Then
|
||||
'下载原版 Json 文件
|
||||
Task.Progress = 0.4
|
||||
Dim RawJson As JObject = GetJson(NetRequestByLoader(DlSourceLauncherOrMetaGet(DlClientListGet(Inherit)), IsJson:=True))
|
||||
Dim RawJson As JObject = NetRequestByLoader(DlSourceLauncherOrMetaGet(DlClientListGet(Inherit)), IsJson:=True).DeserializeJson()
|
||||
'[net.minecraft:client:1.17.1-20210706.113038:mappings@txt] 或 @tsrg]
|
||||
Dim OriginalName As String = Json("data")("MOJMAPS")("client").ToString.Trim("[]".ToCharArray()).BeforeFirst("@")
|
||||
Dim Address = McLibGet(OriginalName).Replace(".jar", "." & Json("data")("MOJMAPS")("client").ToString.Trim("[]".ToCharArray()).Split("@")(1))
|
||||
@@ -1254,11 +1206,11 @@ Retry:
|
||||
ClientDownloadLoader.GetLoaderList.Where(Function(l) l.Name = McDownloadClientLibName OrElse l.Name = McDownloadClientJsonName).
|
||||
Where(Function(l) l.State <> LoadState.Finished).ToList()
|
||||
If TargetLoaders.Any Then Logger.Info($"{LoaderName} 安装正在等待原版文件下载完成")
|
||||
Do While TargetLoaders.Any AndAlso Not Task.IsInterrupted
|
||||
Do While TargetLoaders.Any AndAlso Not Task.IsCanceled
|
||||
TargetLoaders = TargetLoaders.Where(Function(l) l.State <> LoadState.Finished).ToList
|
||||
Thread.Sleep(50)
|
||||
Loop
|
||||
If Task.IsInterrupted Then Return
|
||||
If Task.IsCanceled Then Return
|
||||
'复制原版文件
|
||||
If Not IsCustomFolder Then Return
|
||||
SyncLock VanillaSyncLock
|
||||
@@ -1279,10 +1231,10 @@ Retry:
|
||||
Try
|
||||
Logger.Info($"开始进行 Forgelike 安装:{InstallerAddress}")
|
||||
'记录当前文件夹列表(在新建目标文件夹之前)
|
||||
Dim OldList = DirectoryUtils.GetDirectories(McFolder & "versions\", True).ToList()
|
||||
Dim OldList = DirectoryUtils.EnumerateDirectories(McFolder & "versions\").ToList()
|
||||
'解压并获取信息
|
||||
Installer = FileUtils.OpenZip(InstallerAddress)
|
||||
Dim Json As JObject = GetJson(Installer.GetEntry("install_profile.json").Open().ReadString)
|
||||
Dim Json As JObject = Installer.GetEntry("install_profile.json").Open().ReadString().DeserializeJson()
|
||||
'新建目标版本文件夹
|
||||
DirectoryUtils.Create(VersionFolder)
|
||||
Task.Progress = 0.04
|
||||
@@ -1309,7 +1261,7 @@ Retry:
|
||||
End If
|
||||
End Try
|
||||
'复制新增的版本 Json
|
||||
Dim DeltaList = DirectoryUtils.GetDirectories(McFolder & "versions\", True).
|
||||
Dim DeltaList = DirectoryUtils.EnumerateDirectories(McFolder & "versions\").
|
||||
SkipWhile(Function(i) OldList.Contains(i)).Select(Function(f) DirectoryUtils.GetInfo(f)).ToList()
|
||||
If DeltaList.Count > 1 Then
|
||||
'它可能和 OptiFine 安装同时运行,导致增加的文件不止一个(这导致了 #151)
|
||||
@@ -1350,7 +1302,7 @@ Retry:
|
||||
'解压并获取信息
|
||||
Installer = FileUtils.OpenZip(InstallerAddress)
|
||||
Task.Progress = 0.2
|
||||
Dim Json As JObject = GetJson(Installer.GetEntry("install_profile.json").Open().ReadString)
|
||||
Dim Json As JObject = Installer.GetEntry("install_profile.json").Open().ReadString().DeserializeJson()
|
||||
Task.Progress = 0.4
|
||||
'新建版本文件夹
|
||||
DirectoryUtils.Create(VersionFolder)
|
||||
@@ -1359,7 +1311,7 @@ Retry:
|
||||
'中版:Legacy 方式 1
|
||||
Logger.Info($"开始进行 Forge 安装,Legacy 方式 1:{InstallerAddress}")
|
||||
'建立 Json 文件
|
||||
Dim JsonVersion As JObject = GetJson(Installer.GetEntry(Json("json").ToString.TrimStart("/")).Open().ReadString)
|
||||
Dim JsonVersion As JObject = Installer.GetEntry(Json("json").ToString.TrimStart("/")).Open().ReadString().DeserializeJson()
|
||||
JsonVersion("id") = NewInstanceName
|
||||
FileUtils.Write(VersionFolder & NewInstanceName & ".json", JsonVersion.ToString)
|
||||
Task.Progress = 0.6
|
||||
@@ -1455,22 +1407,13 @@ Retry:
|
||||
End Function
|
||||
Private Sub ForgeContMenuBuild(sender As MyListItem, e As EventArgs)
|
||||
Dim BtnSave As New MyIconButton With {.Logo = Logo.IconButtonSave, .ToolTip = "另存为"}
|
||||
ToolTipService.SetPlacement(BtnSave, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnSave, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnSave, 2)
|
||||
AddHandler BtnSave.Click, AddressOf ForgeSave_Click
|
||||
Dim BtnInfo As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonInfo, .ToolTip = "更新日志"}
|
||||
ToolTipService.SetPlacement(BtnInfo, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnInfo, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnInfo, 2)
|
||||
AddHandler BtnInfo.Click, AddressOf ForgeLog_Click
|
||||
sender.Buttons = {BtnSave, BtnInfo}
|
||||
End Sub
|
||||
Private Sub ForgeSaveContMenuBuild(sender As MyListItem, e As EventArgs)
|
||||
Dim BtnInfo As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonInfo, .ToolTip = "更新日志"}
|
||||
ToolTipService.SetPlacement(BtnInfo, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnInfo, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnInfo, 2)
|
||||
AddHandler BtnInfo.Click, AddressOf ForgeLog_Click
|
||||
sender.Buttons = {BtnInfo}
|
||||
End Sub
|
||||
@@ -1513,7 +1456,7 @@ Retry:
|
||||
Logger.Info("刷新 Forge 推荐版本缓存开始")
|
||||
Dim Result As String = NetRequestByClientRetry("https://bmclapi2.bangbang93.com/forge/promos", RequireJson:=True)
|
||||
If Result.Length < 1000 Then Throw New Exception("获取的结果过短(" & Result & ")")
|
||||
Dim ResultJson As JContainer = GetJson(Result)
|
||||
Dim ResultJson As JContainer = Result.DeserializeJson()
|
||||
'获取所有推荐版本列表
|
||||
Dim RecommendedList As New List(Of String)
|
||||
For Each Version As JObject In ResultJson
|
||||
@@ -1546,7 +1489,7 @@ Retry:
|
||||
Logger.Info("没有 Forge 推荐版本缓存文件")
|
||||
Return Nothing
|
||||
End If
|
||||
Dim Json As JObject = GetJson(List)
|
||||
Dim Json As JObject = List.DeserializeJson()
|
||||
If Json Is Nothing OrElse (Not If(McVersion, "").Contains(".")) OrElse Not Json.ContainsKey(McVersion) Then Return Nothing
|
||||
Return If(Json(McVersion), "").ToString
|
||||
Catch ex As Exception
|
||||
@@ -1613,22 +1556,13 @@ Retry:
|
||||
End Function
|
||||
Private Sub NeoForgeContMenuBuild(sender As MyListItem, e As EventArgs)
|
||||
Dim BtnSave As New MyIconButton With {.Logo = Logo.IconButtonSave, .ToolTip = "另存为"}
|
||||
ToolTipService.SetPlacement(BtnSave, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnSave, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnSave, 2)
|
||||
AddHandler BtnSave.Click, AddressOf NeoForgeSave_Click
|
||||
Dim BtnInfo As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonInfo, .ToolTip = "更新日志"}
|
||||
ToolTipService.SetPlacement(BtnInfo, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnInfo, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnInfo, 2)
|
||||
AddHandler BtnInfo.Click, AddressOf NeoForgeLog_Click
|
||||
sender.Buttons = {BtnSave, BtnInfo}
|
||||
End Sub
|
||||
Private Sub NeoForgeSaveContMenuBuild(sender As MyListItem, e As EventArgs)
|
||||
Dim BtnInfo As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonInfo, .ToolTip = "更新日志"}
|
||||
ToolTipService.SetPlacement(BtnInfo, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnInfo, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnInfo, 2)
|
||||
AddHandler BtnInfo.Click, AddressOf NeoForgeLog_Click
|
||||
sender.Buttons = {BtnInfo}
|
||||
End Sub
|
||||
@@ -1680,7 +1614,7 @@ Retry:
|
||||
'BMCLAPI 不支持 Fabric Installer 下载
|
||||
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})
|
||||
Loaders.Add(New LoaderDownload("下载主文件", New List(Of NetFile) From {New NetFile(Address.ToArray, Target, New FileChecker With {.MinSize = 1024 * 64})}) With {.ProgressWeight = 15})
|
||||
'启动
|
||||
Dim Loader As New LoaderCombo(Of JObject)("Fabric " & Version & " 安装器下载", Loaders) With {.OnStateChanged = AddressOf LoaderStateChangedHintOnly}
|
||||
Loader.Start(DownloadInfo)
|
||||
@@ -1712,7 +1646,7 @@ Retry:
|
||||
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))} '构造文件请求
|
||||
}, VersionFolder & Id & ".json", New FileChecker With {.IsJson = True})} '构造文件请求
|
||||
End Sub) With {.ProgressWeight = 0.5})
|
||||
Loaders.Add(New LoaderDownload("下载 Fabric 主文件", New List(Of NetFile)) With {.ProgressWeight = 2.5})
|
||||
|
||||
@@ -1849,7 +1783,7 @@ Retry:
|
||||
Hint(Loader.Name & "成功!", HintType.Green)
|
||||
Case LoadState.Failed
|
||||
Hint(Loader.Name & "失败:" & Loader.Error.GetDisplay(False), HintType.Red)
|
||||
Case LoadState.Interrupted
|
||||
Case LoadState.Canceled
|
||||
Hint(Loader.Name & "已取消!", HintType.Blue)
|
||||
End Select
|
||||
End Sub
|
||||
@@ -1864,7 +1798,7 @@ Retry:
|
||||
'TODO: 自动选择安装成功的版本
|
||||
Case LoadState.Failed
|
||||
MyMsgBox(Loader.Error.GetDisplay(True), Loader.Name & "失败", IsWarn:=True)
|
||||
Case LoadState.Interrupted
|
||||
Case LoadState.Canceled
|
||||
Hint(Loader.Name & "已取消!", HintType.Blue)
|
||||
Case LoadState.Loading
|
||||
Return '不重新加载版本列表
|
||||
@@ -1875,7 +1809,7 @@ Retry:
|
||||
Public Sub McInstallFailedClearFolder(Loader)
|
||||
Try
|
||||
Thread.Sleep(1000) '防止存在尚未完全释放的文件,导致清理失败(例如整合包安装)
|
||||
If Loader.State = LoadState.Failed OrElse Loader.State = LoadState.Interrupted Then
|
||||
If Loader.State = LoadState.Failed OrElse Loader.State = LoadState.Canceled Then
|
||||
'删除版本文件夹
|
||||
If DirectoryUtils.Exists(Loader.Input & "saves\") OrElse DirectoryUtils.Exists(Loader.Input & "versions\") Then
|
||||
Logger.Warn($"由于版本已被独立启动,不清理版本文件夹:{Loader.Input}")
|
||||
@@ -1905,8 +1839,6 @@ Retry:
|
||||
FrmMain.BtnExtraDownload.Ribble()
|
||||
Return True
|
||||
|
||||
Catch ex As CancelledException
|
||||
Return False
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, "开始合并安装失败")
|
||||
Return False
|
||||
@@ -1915,7 +1847,6 @@ Retry:
|
||||
''' <summary>
|
||||
''' 获取合并安装加载器列表,并进行前期的缓存清理与 Java 检查工作。
|
||||
''' </summary>
|
||||
''' <exception cref="CancelledException" />
|
||||
Public Function McInstallLoader(Request As McInstallRequest) As List(Of LoaderBase)
|
||||
'获取缓存目录(安装 Mod 加载器的文件夹不能包含空格)
|
||||
Dim TempMcFolder As String = RequestTaskTempFolder(Request.OptiFineEntry IsNot Nothing OrElse Request.ForgeEntry IsNot Nothing OrElse Request.NeoForgeEntry IsNot Nothing)
|
||||
@@ -1971,7 +1902,7 @@ Retry:
|
||||
'重复版本检查
|
||||
If FileUtils.Exists($"{VersionFolder}{Request.NewInstanceName}.json") Then
|
||||
Hint("版本 " & Request.NewInstanceName & " 已经存在!", HintType.Red)
|
||||
Throw New CancelledException
|
||||
Throw New OperationCanceledException
|
||||
End If
|
||||
|
||||
Dim LoaderList As New List(Of LoaderBase)
|
||||
@@ -2115,36 +2046,36 @@ Retry:
|
||||
#Region "读取文件并检查文件是否合规"
|
||||
Dim MinecraftJsonText As String = If(FileUtils.TryReadAsString(MinecraftJsonPath), "")
|
||||
If Not MinecraftJsonText.StartsWithF("{") Then Throw New Exception("Minecraft json 有误,地址:" & MinecraftJsonPath & ",前段内容:" & MinecraftJsonText.Substring(0, Math.Min(MinecraftJsonText.Length, 1000)))
|
||||
MinecraftJson = GetJson(MinecraftJsonText)
|
||||
MinecraftJson = MinecraftJsonText.DeserializeJson()
|
||||
|
||||
If HasOptiFine Then
|
||||
Dim OptiFineJsonText As String = If(FileUtils.TryReadAsString(OptiFineJsonPath), "")
|
||||
If Not OptiFineJsonText.StartsWithF("{") Then Throw New Exception("OptiFine json 有误,地址:" & OptiFineJsonPath & ",前段内容:" & OptiFineJsonText.Substring(0, Math.Min(OptiFineJsonText.Length, 1000)))
|
||||
OptiFineJson = GetJson(OptiFineJsonText)
|
||||
OptiFineJson = OptiFineJsonText.DeserializeJson()
|
||||
End If
|
||||
|
||||
If HasForge Then
|
||||
Dim ForgeJsonText As String = If(FileUtils.TryReadAsString(ForgeJsonPath), "")
|
||||
If Not ForgeJsonText.StartsWithF("{") Then Throw New Exception("Forge json 有误,地址:" & ForgeJsonPath & ",前段内容:" & ForgeJsonText.Substring(0, Math.Min(ForgeJsonText.Length, 1000)))
|
||||
ForgeJson = GetJson(ForgeJsonText)
|
||||
ForgeJson = ForgeJsonText.DeserializeJson()
|
||||
End If
|
||||
|
||||
If HasNeoForge Then
|
||||
Dim NeoForgeJsonText As String = If(FileUtils.TryReadAsString(NeoForgeJsonPath), "")
|
||||
If Not NeoForgeJsonText.StartsWithF("{") Then Throw New Exception("NeoForge json 有误,地址:" & NeoForgeJsonPath & ",前段内容:" & NeoForgeJsonText.Substring(0, Math.Min(NeoForgeJsonText.Length, 1000)))
|
||||
NeoForgeJson = GetJson(NeoForgeJsonText)
|
||||
NeoForgeJson = NeoForgeJsonText.DeserializeJson()
|
||||
End If
|
||||
|
||||
If HasLiteLoader Then
|
||||
Dim LiteLoaderJsonText As String = If(FileUtils.TryReadAsString(LiteLoaderJsonPath), "")
|
||||
If Not LiteLoaderJsonText.StartsWithF("{") Then Throw New Exception("LiteLoader json 有误,地址:" & LiteLoaderJsonPath & ",前段内容:" & LiteLoaderJsonText.Substring(0, Math.Min(LiteLoaderJsonText.Length, 1000)))
|
||||
LiteLoaderJson = GetJson(LiteLoaderJsonText)
|
||||
LiteLoaderJson = LiteLoaderJsonText.DeserializeJson()
|
||||
End If
|
||||
|
||||
If HasFabric Then
|
||||
Dim FabricJsonText As String = If(FileUtils.TryReadAsString(FabricJsonPath), "")
|
||||
If Not FabricJsonText.StartsWithF("{") Then Throw New Exception("Fabric json 有误,地址:" & FabricJsonPath & ",前段内容:" & FabricJsonText.Substring(0, Math.Min(FabricJsonText.Length, 1000)))
|
||||
FabricJson = GetJson(FabricJsonText)
|
||||
FabricJson = FabricJsonText.DeserializeJson()
|
||||
End If
|
||||
#End Region
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageDownloadInstall
|
||||
Public Class PageDownloadInstall
|
||||
|
||||
Private Sub LoaderInit() Handles Me.Initialized
|
||||
DisabledPageAnimControls.Add(BtnStart)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageLeft x:Class="PageDownloadLeft"
|
||||
<local:MyPageLeft x:Class="PageDownloadLeft"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" AnimatedControl="PanItem">
|
||||
@@ -9,7 +9,7 @@
|
||||
Logo="m351.9,801.7c-8.6,0-17-3-23.7-8.4L18.9,614.7c-12.5-7.2-19.7-20.5-18.8-34.9V221c-.7-15,6.6-28.8,19.2-36L325.2,8.3c6.6-5.3,15.1-8.3,24-8.3s17.3,2.9,23.9,8.2l308.3,178c.2.1.5.3.8.5h0c12,6.7,19.4,19.8,19.4,34.1,0,13.9-7.1,26-18.7,32.5l-290.1,167.5v276l234-135.1v-168.9c0-20.8,17-37.8,37.8-37.8s37.8,17,37.8,37.8v191.7c0,16.4-10.9,31.2-26.5,36.1l-299.4,172.8c-6.7,5.4-15.1,8.3-23.7,8.3h-.9Zm-34.8-101.9v-276l-241.4-139.4v276l241.4,139.4Zm35.3-342.8l236.8-136.7-240-138.6L112.4,218.3l240,138.6Z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="0" ToolTip="刷新" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" LogoScale="0.85" Click="Refresh" Logo="M875.52 148.48C783.36 56.32 655.36 0 512 0 291.84 0 107.52 138.24 30.72 332.8l122.88 46.08C204.8 230.4 348.16 128 512 128c107.52 0 199.68 40.96 271.36 112.64L640 384h384V0L875.52 148.48zM512 896c-107.52 0-199.68-40.96-271.36-112.64L384 640H0v384l148.48-148.48C240.64 967.68 368.64 1024 512 1024c220.16 0 404.48-138.24 481.28-332.8L870.4 645.12C819.2 793.6 675.84 896 512 896z" />
|
||||
<local:MyIconButton Tag="0" ToolTip="刷新" LogoScale="0.85" Click="Refresh_Click" Logo="M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
@@ -18,7 +18,7 @@
|
||||
LogoScale="0.97" Logo="M789.504 912.896h-195.072a35.328 35.328 0 0 1-34.816-35.328v-77.312a39.936 39.936 0 0 0-40.448-39.936H481.28a40.448 40.448 0 0 0-40.448 39.936v77.312a34.816 34.816 0 0 1-34.816 35.328H204.8a41.984 41.984 0 0 1-40.448-42.496v-200.192a35.328 35.328 0 0 1 35.328-35.328h72.704a39.936 39.936 0 0 0 39.936-39.936v-37.888a39.936 39.936 0 0 0-39.936-40.448H199.68a35.328 35.328 0 0 1-35.328-35.328V287.744A41.984 41.984 0 0 1 204.8 245.76h176.64v-32.768a102.4 102.4 0 0 1 102.4-102.4h33.792a102.4 102.4 0 0 1 102.4 102.4v32.768h170.496a41.984 41.984 0 0 1 41.984 41.984V460.8h28.672a102.4 102.4 0 0 1 102.4 102.4v33.792a102.4 102.4 0 0 1-102.4 102.4h-28.672V870.4a41.984 41.984 0 0 1-43.008 42.496z m-159.744-70.144h131.584V665.6a34.304 34.304 0 0 1 34.816-34.816h64a31.744 31.744 0 0 0 31.744-31.744V563.2a31.744 31.744 0 0 0-31.744-31.744h-64a34.816 34.816 0 0 1-34.816-35.328V316.416h-177.152a35.328 35.328 0 0 1-35.328-35.328V212.992a31.744 31.744 0 0 0-31.744-31.744h-33.792a31.744 31.744 0 0 0-31.744 31.744v68.096a35.328 35.328 0 0 1-34.816 35.328H234.496v130.048h37.888a110.592 110.592 0 0 1 110.08 110.592v37.888a110.592 110.592 0 0 1-110.08 110.592h-37.888v137.216h136.192v-42.496a110.592 110.592 0 0 1 110.592-110.08h37.888a110.592 110.592 0 0 1 110.592 110.08z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="2" ToolTip="刷新" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" LogoScale="0.85" Click="Refresh" Logo="M875.52 148.48C783.36 56.32 655.36 0 512 0 291.84 0 107.52 138.24 30.72 332.8l122.88 46.08C204.8 230.4 348.16 128 512 128c107.52 0 199.68 40.96 271.36 112.64L640 384h384V0L875.52 148.48zM512 896c-107.52 0-199.68-40.96-271.36-112.64L384 640H0v384l148.48-148.48C240.64 967.68 368.64 1024 512 1024c220.16 0 404.48-138.24 481.28-332.8L870.4 645.12C819.2 793.6 675.84 896 512 896z" />
|
||||
<local:MyIconButton Tag="2" ToolTip="刷新" LogoScale="0.85" Click="Refresh_Click" Logo="M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
@@ -26,7 +26,7 @@
|
||||
LogoScale="0.98" Logo="M511 995a128 128 0 0 1-57-13L70 791a126 126 0 0 1-70-113V311a126 126 0 0 1 15-60V248c1-2 3-5 5-8a127 127 0 0 1 49-42L454 13a128 128 0 0 1 112 0l383 190a126 126 0 0 1 72 113v360a126 126 0 0 1-70 115L568 984c-17 7-37 11-57 11z m42-470v370l360-178c14-7 23-21 23-38v-335L554 524zM85 330v347a42 42 0 0 0 23 38l360 178V523L85 330zM135 260l375 189 137-65L286 188 135 260z m245-118l363 197 150-71-365-180a42 42 0 0 0-37 0l-111 53z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="3" ToolTip="刷新" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" LogoScale="0.85" Click="Refresh" Logo="M875.52 148.48C783.36 56.32 655.36 0 512 0 291.84 0 107.52 138.24 30.72 332.8l122.88 46.08C204.8 230.4 348.16 128 512 128c107.52 0 199.68 40.96 271.36 112.64L640 384h384V0L875.52 148.48zM512 896c-107.52 0-199.68-40.96-271.36-112.64L384 640H0v384l148.48-148.48C240.64 967.68 368.64 1024 512 1024c220.16 0 404.48-138.24 481.28-332.8L870.4 645.12C819.2 793.6 675.84 896 512 896z" />
|
||||
<local:MyIconButton Tag="3" ToolTip="刷新" LogoScale="0.85" Click="Refresh_Click" Logo="M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
@@ -34,7 +34,7 @@
|
||||
LogoScale="0.96" Logo="M445 545c18 0 33 14 33 33v149a182 182 0 1 1-182-182z m282 0a182 182 0 1 1-182 182v-149c0-18 14-33 33-33zM412 611H296a116 116 0 1 0 116 116V611z m315 0H611v116a116 116 0 1 0 116-116zM296 113a182 182 0 0 1 182 182v149a33 33 0 0 1-33 33H296a182 182 0 0 1 0-365z m431 0a182 182 0 0 1 0 365h-149a33 33 0 0 1-33-33V296A182 182 0 0 1 727 113zM296 180a116 116 0 0 0 0 232H412V296c0-62-48-112-109-115z m431 0a116 116 0 0 0-116 116V412h116c62 0 112-48 115-109l0-6a116 116 0 0 0-116-116z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="4" ToolTip="刷新" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" LogoScale="0.85" Click="Refresh" Logo="M875.52 148.48C783.36 56.32 655.36 0 512 0 291.84 0 107.52 138.24 30.72 332.8l122.88 46.08C204.8 230.4 348.16 128 512 128c107.52 0 199.68 40.96 271.36 112.64L640 384h384V0L875.52 148.48zM512 896c-107.52 0-199.68-40.96-271.36-112.64L384 640H0v384l148.48-148.48C240.64 967.68 368.64 1024 512 1024c220.16 0 404.48-138.24 481.28-332.8L870.4 645.12C819.2 793.6 675.84 896 512 896z" />
|
||||
<local:MyIconButton Tag="4" ToolTip="刷新" LogoScale="0.85" Click="Refresh_Click" Logo="M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
@@ -42,7 +42,7 @@
|
||||
LogoScale="0.81" Logo="M884.4 130.6H140.6c-41.9 0-76 34.1-76 76v613.3c0 41.9 34.1 76 76 76h743.8c41.9 0 76-34.1 76-76V206.6c0-41.9-34.1-76-76-76z m-743.8 72h743.8c2.2 0 4 1.8 4 4v371.3L796 461.7c-21.7-27.3-54.1-43.7-88.8-45-34.7-1.3-68.1 12.7-91.7 38.3L454 630c-2.8 3-7.2 3.5-10.5 1.3l-103-70.3c-31.5-21.5-72.8-22.5-105.3-2.7l-98.6 60.1V206.6c0-2.2 1.8-4 4-4z m743.8 621.3H140.6c-2.2 0-4-1.8-4-4V702.7l136.1-83c8.4-5.1 19.1-4.8 27.2 0.7l103 70.3c15.9 10.8 35.1 15.6 54.2 13.4 19-2.2 36.7-11.2 49.8-25.3l161.6-175c9.5-10.3 22.3-15.7 36.2-15.1 13.9 0.5 26.3 6.8 35.1 17.8l148.7 187v126.3c-0.1 2.3-1.9 4.1-4.1 4.1z M231.8 400.6a69.6 69.6 0 1 0 98.4-98.4 69.6 69.6 0 1 0-98.4 98.4Z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="5" ToolTip="刷新" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" LogoScale="0.85" Click="Refresh" Logo="M875.52 148.48C783.36 56.32 655.36 0 512 0 291.84 0 107.52 138.24 30.72 332.8l122.88 46.08C204.8 230.4 348.16 128 512 128c107.52 0 199.68 40.96 271.36 112.64L640 384h384V0L875.52 148.48zM512 896c-107.52 0-199.68-40.96-271.36-112.64L384 640H0v384l148.48-148.48C240.64 967.68 368.64 1024 512 1024c220.16 0 404.48-138.24 481.28-332.8L870.4 645.12C819.2 793.6 675.84 896 512 896z" />
|
||||
<local:MyIconButton Tag="5" ToolTip="刷新" LogoScale="0.85" Click="Refresh_Click" Logo="M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
@@ -50,7 +50,7 @@
|
||||
LogoScale="1.04" Logo="M512 0c25 0 42 17 42 42v85c0 25-17 42-42 42s-42-17-42-42V42c0-25 17-42 42-42zM512 853c25 0 42 17 42 42v85c0 25-17 42-42 42s-42-17-42-42v-85c0-25 17-42 42-42zM209 149c-17-17-42-17-59 0-17 17-17 42 0 59l59 59c17 17 42 17 59 0 17-17 17-42 0-59L209 149zM755 755c17-17 42-17 59 0l59 59c17 17 17 42 0 59s-42 17-59 0l-59-59c-17-17-17-46 0-59zM42 469c-25 0-42 17-42 42s17 42 42 42h85c25 0 42-17 42-42s-17-42-42-42H42zM853 512c0-25 17-42 42-42h85c25 0 42 17 42 42s-17 42-42 42h-85c-25 0-42-17-42-42zM149 814c-17 17-17 42 0 59 17 17 42 17 59 0l59-59c17-17 17-42 0-59-17-17-42-17-59 0l-59 59zM755 268c-17-17-17-42 0-59l59-59c17-17 42-17 59 0s17 42 0 59l-59 59c-17 17-46 17-59 0z M512 213c-166 0-298 132-298 298s132 298 298 298 298-132 298-298-132-298-298-298z m0 512c-119 0-213-93-213-213s93-213 213-213 213 93 213 213-93 213-213 213z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="6" ToolTip="刷新" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" LogoScale="0.85" Click="Refresh" Logo="M875.52 148.48C783.36 56.32 655.36 0 512 0 291.84 0 107.52 138.24 30.72 332.8l122.88 46.08C204.8 230.4 348.16 128 512 128c107.52 0 199.68 40.96 271.36 112.64L640 384h384V0L875.52 148.48zM512 896c-107.52 0-199.68-40.96-271.36-112.64L384 640H0v384l148.48-148.48C240.64 967.68 368.64 1024 512 1024c220.16 0 404.48-138.24 481.28-332.8L870.4 645.12C819.2 793.6 675.84 896 512 896z" />
|
||||
<local:MyIconButton Tag="6" ToolTip="刷新" LogoScale="0.85" Click="Refresh_Click" Logo="M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageDownloadLeft
|
||||
Public Class PageDownloadLeft
|
||||
Implements IRefreshable
|
||||
|
||||
#Region "页面切换"
|
||||
@@ -82,7 +82,7 @@
|
||||
#End Region
|
||||
|
||||
'强制刷新
|
||||
Public Sub Refresh(sender As Object, e As EventArgs) '由边栏按钮匿名调用
|
||||
Public Sub Refresh_Click(sender As Object, e As EventArgs) '由边栏按钮匿名调用
|
||||
Refresh(Val(sender.Tag))
|
||||
End Sub
|
||||
Public Sub Refresh() Implements IRefreshable.Refresh
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Grid x:Class="MyResourceItem"
|
||||
<Grid x:Class="MyResourceItem"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL"
|
||||
@@ -41,10 +41,9 @@
|
||||
<TextBlock x:Name="LabInfo" Grid.Row="2" Grid.Column="4" VerticalAlignment="Bottom" Margin="0,0,3,0.5"
|
||||
TextTrimming="CharacterEllipsis" FontSize="12" Foreground="{StaticResource ColorBrushGray3}"
|
||||
IsHitTestVisible="True" SnapsToDevicePixels="False" UseLayoutRounding="False"
|
||||
ToolTipService.InitialShowDelay="100" ToolTipService.BetweenShowDelay="100"
|
||||
ToolTipService.Placement="Relative" ToolTipService.PlacementRectangle="-16,-10,500,10000">
|
||||
ToolTipService.InitialShowDelay="100">
|
||||
<TextBlock.ToolTip>
|
||||
<ToolTip x:Name="ToolTipInfo" Style="{StaticResource ExtendTextToolTip}" />
|
||||
<ToolTip x:Name="ToolTipInfo" />
|
||||
</TextBlock.ToolTip>
|
||||
</TextBlock>
|
||||
<!-- 下边栏 -->
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class MyResourceItem
|
||||
Public Class MyResourceItem
|
||||
|
||||
#Region "基础属性"
|
||||
Public Uuid As Integer = GetUuid()
|
||||
@@ -38,19 +38,9 @@
|
||||
End Property
|
||||
'指向时扩展描述
|
||||
Private Sub LabInfo_MouseEnter(sender As Object, e As MouseEventArgs) Handles LabInfo.MouseEnter
|
||||
If IsTextTrimmed(LabInfo) Then
|
||||
ToolTipInfo.Content = LabInfo.Text
|
||||
ToolTipInfo.Width = LabInfo.ActualWidth + 25
|
||||
LabInfo.ToolTip = ToolTipInfo
|
||||
Else
|
||||
LabInfo.ToolTip = Nothing
|
||||
End If
|
||||
ToolTipInfo.Content = LabInfo.Text
|
||||
LabInfo.ToolTip = If(IsTextTrimmed(LabInfo), ToolTipInfo, Nothing)
|
||||
End Sub
|
||||
Private Function IsTextTrimmed(textBlock As TextBlock) As Boolean
|
||||
Dim typeface As New Typeface(textBlock.FontFamily, textBlock.FontStyle, textBlock.FontWeight, textBlock.FontStretch)
|
||||
Dim formattedText As New FormattedText(textBlock.Text, Thread.CurrentThread.CurrentCulture, textBlock.FlowDirection, typeface, textBlock.FontSize, textBlock.Foreground, DPI)
|
||||
Return formattedText.Width > textBlock.ActualWidth
|
||||
End Function
|
||||
|
||||
'Tag
|
||||
Public WriteOnly Property Tags As List(Of String)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
Public Class PageDownloadResourceDetail
|
||||
Imports System.Collections.ObjectModel
|
||||
|
||||
Public Class PageDownloadResourceDetail
|
||||
Private ResourceItem As MyResourceItem = Nothing
|
||||
|
||||
''' <summary>
|
||||
@@ -24,7 +26,7 @@
|
||||
Sub(Task)
|
||||
LoadPageArguments()
|
||||
Dim Result = ResourceVersion.FromProjectId(Project.Id, Project.Platform)
|
||||
If Task.IsInterrupted Then Return
|
||||
If Task.IsCanceled Then Return
|
||||
Task.Output = Result
|
||||
End Sub)
|
||||
|
||||
@@ -157,7 +159,7 @@ GroupDone:
|
||||
Dim Results = GetResults()
|
||||
|
||||
Dim TargetCardName As String = If(TargetVersion <> "" OrElse TargetLoaders <> ModLoaders.None,
|
||||
$"{If(TargetLoaders <> ModLoaders.None, TargetLoaders.ToString & " ", "")}{TargetVersion}(所选版本)", "")
|
||||
$"{If(TargetLoaders <> ModLoaders.None, TargetLoaders.ToString + " ", "")}{TargetVersion}(所选版本)", "")
|
||||
'归类到卡片下
|
||||
Dim Dict As New SortedDictionary(Of String, List(Of ResourceVersion))(New CardSorter(TargetCardName))
|
||||
Dict.Add("其他", New List(Of ResourceVersion))
|
||||
@@ -298,7 +300,7 @@ GroupDone:
|
||||
Dim PackName As String = Project.TranslatedName.Replace(".zip", "").Replace(".rar", "").Replace(".mrpack", "").Replace("\", "\").Replace("/", "/").Replace("|", "|").Replace(":", ":").Replace("<", "<").Replace(">", ">").Replace("*", "*").Replace("?", "?").Replace("""", "").Replace(": ", ":")
|
||||
Dim Validate As New ValidateFolderName(McFolderSelected & "versions")
|
||||
If Validate.Validate(PackName) <> "" Then PackName = ""
|
||||
Dim InstanceName As String = MyMsgBoxInput("输入版本名称", "", PackName, New ObjectModel.Collection(Of Validate) From {Validate})
|
||||
Dim InstanceName As String = MyMsgBoxInput("输入版本名称", "", PackName, New Collection(Of Validate) From {Validate})
|
||||
If String.IsNullOrEmpty(InstanceName) Then Return
|
||||
|
||||
'构造步骤加载器
|
||||
@@ -317,7 +319,7 @@ GroupDone:
|
||||
Select Case MyLoader.State
|
||||
Case LoadState.Failed
|
||||
Hint(MyLoader.Name & "失败:" & MyLoader.Error.GetDisplay(False), HintType.Red)
|
||||
Case LoadState.Interrupted
|
||||
Case LoadState.Canceled
|
||||
Hint(MyLoader.Name & "已取消!", HintType.Blue)
|
||||
Case LoadState.Loading
|
||||
Return '不重新加载版本列表
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Public Class PageDownloadDataPack
|
||||
Public Class PageDownloadDataPack
|
||||
End Class
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Public Class PageDownloadMod
|
||||
Public Class PageDownloadMod
|
||||
End Class
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -20,7 +20,7 @@
|
||||
<local:MyComboBoxItem Tag="4474/" Content="科幻" />
|
||||
<local:MyComboBoxItem Tag="4736/" Content="空岛" />
|
||||
<local:MyComboBoxItem Tag="5128/" Content="原版改良" />
|
||||
<local:MyComboBoxItem Tag="4487/" Content="FTB" ToolTip="由 FTB 官方发布" ToolTipService.HorizontalOffset="70" />
|
||||
<local:MyComboBoxItem Tag="4487/" Content="FTB" ToolTip="由 FTB 官方发布" />
|
||||
<local:MyComboBoxItem Tag="4480/" Content="基于地图" />
|
||||
<local:MyComboBoxItem Tag="4481/lightweight" Content="轻量整合" />
|
||||
<local:MyComboBoxItem Tag="4482/" Content="大型整合" />
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Public Class PageDownloadPack
|
||||
Public Class PageDownloadPack
|
||||
End Class
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Public Class PageDownloadResourcePack
|
||||
Public Class PageDownloadResourcePack
|
||||
End Class
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -27,7 +27,7 @@
|
||||
<local:MyComboBoxItem Margin="15,0,0,0" Content="高" Tag="/high" />
|
||||
|
||||
<local:MyComboBoxItem Content="加载器" IsEnabled="False" />
|
||||
<local:MyComboBoxItem Margin="15,0,0,0" Content="原版可用" Tag="/vanilla" ToolTip="作为资源包加载,可以直接在原版游戏里使用。" ToolTipService.HorizontalOffset="70" />
|
||||
<local:MyComboBoxItem Margin="15,0,0,0" Content="原版可用" Tag="/vanilla" ToolTip="作为资源包加载,可以直接在原版游戏里使用。" />
|
||||
<local:MyComboBoxItem Margin="15,0,0,0" Content="Iris" Tag="/iris" />
|
||||
<local:MyComboBoxItem Margin="15,0,0,0" Content="OptiFine" Tag="/optifine" />
|
||||
</local:PageResource>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Public Class PageDownloadShader
|
||||
Public Class PageDownloadShader
|
||||
End Class
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyScrollViewer x:Class="PageResource"
|
||||
<local:MyScrollViewer x:Class="PageResource"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -32,7 +32,7 @@
|
||||
<local:MyComboBoxItem Content="Modrinth" Tag="2" />
|
||||
</local:MyComboBox>
|
||||
<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">
|
||||
<local:MyComboBox x:Name="TextSearchVersion" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" IsEditable="True" IsTextSearchEnabled="False">
|
||||
<local:MyComboBoxItem Content="全部 (也可自行输入)" IsSelected="True" />
|
||||
<local:MyComboBoxItem Content="26.1" />
|
||||
<local:MyComboBoxItem Content="1.21.11" />
|
||||
@@ -66,7 +66,7 @@
|
||||
<local:MyButton x:Name="BtnSearchRun" Text="搜索" MinWidth="140" Padding="13,0" Margin="0,0,20,0" ColorType="Highlight" />
|
||||
<local:MyButton x:Name="BtnSearchReset" Text="重置条件" MinWidth="140" Padding="13,0" Margin="0,0,20,0" Grid.Column="1" />
|
||||
<local:MyButton x:Name="BtnSearchInstallModPack" Text="安装已有整合包" MinWidth="140" Padding="13,0" Margin="0,0,20,0" Grid.Column="2"
|
||||
ToolTip="在当前选择的 Minecraft 文件夹下安装整合包" ToolTipService.HorizontalOffset="-55" ToolTipService.VerticalOffset="5" />
|
||||
ToolTip="在当前选择的 Minecraft 文件夹下安装整合包" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</local:MyCard>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Imports System.Windows.Markup
|
||||
Imports System.Windows.Markup
|
||||
|
||||
<ContentProperty("SearchTags")>
|
||||
Public Class PageResource
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Grid x:Class="MyLocalModItem"
|
||||
<Grid x:Class="MyLocalModItem"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL;assembly="
|
||||
@@ -41,8 +41,7 @@
|
||||
Foreground="{StaticResource ColorBrushGray1}" Opacity="0.4" VerticalAlignment="Bottom" Visibility="Collapsed" />
|
||||
<!-- 更新按钮 -->
|
||||
<local:MyIconButton Grid.Column="2"
|
||||
Width="21" Height="21" Margin="-2,-1.6,0,0" x:Name="BtnUpdate" Theme="Black" Opacity="0.4" Visibility="Collapsed"
|
||||
ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="100" ToolTipService.VerticalOffset="-9"
|
||||
Width="21" Height="21" Margin="-2,-1.6,0,0" x:Name="BtnUpdate" Theme="Black" Opacity="0.4" Visibility="Collapsed" ToolTipService.InitialShowDelay="100"
|
||||
Logo="M640 768H384l-32-32V509H213L190 454l298-298h45l298 298L810 509h-138v226z m-224-64h192V477l32-32h93L512 223 290 445H384l32 32zM352 831h320v64h-320z" />
|
||||
</Grid>
|
||||
<!-- Tag 与 详情 -->
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Windows.Forms
|
||||
|
||||
Public Class MyLocalModItem
|
||||
|
||||
@@ -312,7 +312,7 @@ Public Class MyLocalModItem
|
||||
NewestName = NewestSegs.Join("-")
|
||||
Entry._Version = CurrentName '使用网络信息作为显示的版本号
|
||||
End If
|
||||
Return $"当前版本:{CurrentName}({GetTimeSpanString(Entry.ProjectVersion.ReleaseDate - Date.Now, False)}){vbCrLf}最新版本:{NewestName}({GetTimeSpanString(Entry.UpdateFile.ReleaseDate - Date.Now, False)})"
|
||||
Return $"当前版本:{CurrentName}({StringUtils.FormatTimeSpan(Entry.ProjectVersion.ReleaseDate - Date.Now, False)}){vbCrLf}最新版本:{NewestName}({StringUtils.FormatTimeSpan(Entry.UpdateFile.ReleaseDate - Date.Now, False)})"
|
||||
End Function
|
||||
|
||||
'懒加载
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -14,6 +14,7 @@
|
||||
<local:MyScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" x:Name="PanBack">
|
||||
<StackPanel Margin="25,10,25,65">
|
||||
<local:MyHint Margin="0,15,0,0" Text="受 Modrinth 整合包规范限制,导出的整合包中不会包含 OptiFine。" Theme="Yellow" x:Name="HintOptiFine" />
|
||||
<local:MyHint Margin="0,15,0,0" Theme="Yellow" x:Name="HintJava" />
|
||||
<local:MyCard Margin="0,15">
|
||||
<Grid Margin="22,15,25,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -239,6 +240,13 @@
|
||||
DefaultChecked="False" />
|
||||
</local:MyCheckBox.Tag>
|
||||
</local:MyCheckBox>
|
||||
<local:MyCheckBox x:Name="CheckOptionsJava">
|
||||
<local:MyCheckBox.Tag>
|
||||
<local:ExportOption
|
||||
Title="版本文件夹中的 Java"
|
||||
DefaultChecked="True" />
|
||||
</local:MyCheckBox.Tag>
|
||||
</local:MyCheckBox>
|
||||
<local:MyCheckBox x:Name="CheckOptionsPcl">
|
||||
<local:MyCheckBox.Tag>
|
||||
<local:ExportOption
|
||||
@@ -268,6 +276,8 @@
|
||||
ToolTip="将 Mod、资源包、光影包的文件直接放入整合包中,这样在导入时就无需联网下载它们。
建议仅在无法稳定连接 CurseForge 或 Modrinth 时才考虑勾选。" />
|
||||
<local:MyCheckBox Text="仅从 Modrinth 下载资源文件" x:Name="CheckAdvancedModrinth"
|
||||
ToolTip="若资源未在 Modrinth 上托管,则将其原始文件直接放入整合包中。
如果你想将整合包上传到 Modrinth,这能帮助你分辨哪些文件未在 Modrinth 上托管。" />
|
||||
<local:MyHint Theme="Yellow" x:Name="HintModrinthFormat" Margin="26,2,0,2"
|
||||
Text="若不勾选 “PCL 启动器程序”,导出时才能在 “保存类型” 中选择 .mrpack 格式!" />
|
||||
<local:MyHint Theme="Blue" RelativeSetup="HintExportConfig" CanClose="True" Margin="0,20,0,2"
|
||||
Text="配置文件中含有更多高级选项,例如精准控制导出的文件、设置整合包存放位置等。
要修改这些选项,请先点击 “保存配置”,在编辑配置文件后再导入。" />
|
||||
<Grid Height="35" Margin="0,12,0,0">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class ExportOption
|
||||
Public Class ExportOption
|
||||
Public Property Title As String
|
||||
Public Property Description As String
|
||||
Public Property Rules As String
|
||||
@@ -17,6 +17,9 @@ Public Class PageInstanceExport
|
||||
Implements IRefreshable
|
||||
|
||||
Private CurrentInstance As String = ""
|
||||
Private Sub PageInstanceExport_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
AddHandler PageInstanceLeft.CurrentJavaWorker.Stopped, Sub() RunInUi(AddressOf RefreshJavaInfo)
|
||||
End Sub
|
||||
Private Sub PageInstanceExport_Loaded() Handles Me.Loaded
|
||||
AniControlEnabled += 1
|
||||
If CurrentInstance <> PageInstanceLeft.Instance.PathVersion Then RefreshAll() '切换到了另一个版本,重置页面
|
||||
@@ -25,7 +28,7 @@ Public Class PageInstanceExport
|
||||
AniControlEnabled -= 1
|
||||
End Sub
|
||||
Public Sub RefreshAll() Implements IRefreshable.Refresh
|
||||
Logger.Info($"刷新导出页面")
|
||||
Logger.Info("刷新导出页面")
|
||||
HintOptiFine.Visibility = If(PageInstanceLeft.Instance.Version.HasOptiFine, Visibility.Visible, Visibility.Collapsed)
|
||||
CurrentInstance = PageInstanceLeft.Instance.PathVersion
|
||||
TextExportName.Text = ""
|
||||
@@ -38,11 +41,12 @@ Public Class PageInstanceExport
|
||||
ResetConfigOverrides()
|
||||
ReloadAllSubOptions()
|
||||
RefreshAllOptionsUI()
|
||||
RefreshJavaInfo()
|
||||
PanBack.ScrollToHome()
|
||||
End Sub
|
||||
|
||||
#Region "子选项"
|
||||
Private SubOptionBlackList As String() = {"Quark Programmer Art.zip", "+ EuphoriaPatches_"}
|
||||
Private SubOptionBlackList As String() = {"Quark Programmer Art.zip", "+ EuphoriaPatches_", "PCL2 Skin.zip"}
|
||||
|
||||
''' <summary>
|
||||
''' 动态生成子文件夹下的选项,例如资源包、存档等。
|
||||
@@ -63,7 +67,7 @@ Public Class PageInstanceExport
|
||||
For Each File In TargetFolder.EnumerateFiles("*.zip").Concat(TargetFolder.EnumerateFiles("*.rar"))
|
||||
If SubOptionBlackList.Any(Function(b) File.Name.Contains(b)) Then Continue For
|
||||
Panel.Children.Add(New MyCheckBox With {. _
|
||||
Tag = New ExportOption With {.Title = File.Name, .DefaultChecked = True, .Rules = EscapeUtils.LikePatternEscape($"{Folder}/{File.Name}")}})
|
||||
Tag = New ExportOption With {.Title = File.Name, .DefaultChecked = True, .Rules = StringUtils.LikePatternEscape($"{Folder}/{File.Name}")}})
|
||||
Next
|
||||
End If
|
||||
If AcceptFolder Then
|
||||
@@ -71,7 +75,7 @@ Public Class PageInstanceExport
|
||||
If SubOptionBlackList.Any(Function(b) SubFolder.Name.Contains(b)) Then Continue For
|
||||
If Not SubFolder.EnumerateFileSystemInfos().Any() Then Continue For
|
||||
Dim NewCheckBox As New MyCheckBox With {. _
|
||||
Tag = New ExportOption With {.Title = SubFolder.Name, .DefaultChecked = True, .Rules = EscapeUtils.LikePatternEscape($"{Folder}/{SubFolder.Name}/")}}
|
||||
Tag = New ExportOption With {.Title = SubFolder.Name, .DefaultChecked = True, .Rules = StringUtils.LikePatternEscape($"{Folder}/{SubFolder.Name}/")}}
|
||||
If Panel Is PanOptionsSaves Then GetExportOption(NewCheckBox).Description = SubFolder.LastWriteTime.ToString("yyyy'/'MM'/'dd HH':'mm")
|
||||
Panel.Children.Add(NewCheckBox)
|
||||
Next
|
||||
@@ -140,12 +144,6 @@ Public Class PageInstanceExport
|
||||
'逐个检查选项
|
||||
For Each CheckBox In GetAllOptions(True)
|
||||
Dim TargetOption = GetExportOption(CheckBox)
|
||||
'名称与简介
|
||||
CheckBox.Inlines.Clear()
|
||||
CheckBox.Inlines.Add(New Run(TargetOption.Title))
|
||||
If Not String.IsNullOrEmpty(TargetOption.Description) Then
|
||||
CheckBox.Inlines.Add(New Run(" " & TargetOption.Description) With {.Foreground = ColorGray5})
|
||||
End If
|
||||
'可见性、默认勾选
|
||||
If String.IsNullOrEmpty(TargetOption.Rules) AndAlso String.IsNullOrEmpty(TargetOption.ShowRules) Then
|
||||
CheckBox.Visibility = Visibility.Visible
|
||||
@@ -155,6 +153,13 @@ Public Class PageInstanceExport
|
||||
CheckBox.Visibility = If(Pass, Visibility.Visible, Visibility.Collapsed)
|
||||
CheckBox.Checked = TargetOption.DefaultChecked AndAlso Pass
|
||||
End If
|
||||
'名称与简介
|
||||
CheckBox.Inlines.Clear()
|
||||
If CheckBox.Visibility <> Visibility.Visible Then Continue For
|
||||
CheckBox.Inlines.Add(New Run(TargetOption.Title))
|
||||
If Not String.IsNullOrEmpty(TargetOption.Description) Then
|
||||
CheckBox.Inlines.Add(New Run(" " & TargetOption.Description) With {.Foreground = ColorGray5})
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
@@ -311,6 +316,9 @@ Public Class PageInstanceExport
|
||||
ConfigLines.Add("Name:" & TextExportName.Text)
|
||||
ConfigLines.Add("Version:" & TextExportVersion.Text)
|
||||
ConfigLines.Add("")
|
||||
ConfigLines.Add($"# 当版本设置中选择了 {vbLQ}使用版本文件夹中的 Java{vbRQ} 时,是否打包版本文件夹中的 Java。")
|
||||
ConfigLines.Add("IncludeJava:" & CheckOptionsJava.Checked)
|
||||
ConfigLines.Add("")
|
||||
ConfigLines.Add("# 是否打包正式版 PCL,以便没有启动器的玩家安装整合包。")
|
||||
ConfigLines.Add("IncludeLauncher:" & CheckOptionsPcl.Checked)
|
||||
ConfigLines.Add("")
|
||||
@@ -363,6 +371,7 @@ Public Class PageInstanceExport
|
||||
Next
|
||||
TextExportName.Text = Ini.GetOrDefault("Name", "")
|
||||
TextExportVersion.Text = Ini.GetOrDefault("Version", "")
|
||||
CheckOptionsJava.Checked = Ini.GetOrDefault("IncludeJava", True)
|
||||
CheckOptionsPcl.Checked = Ini.GetOrDefault("IncludeLauncher", True)
|
||||
CheckOptionsPclCustom.Checked = Ini.GetOrDefault("IncludeLauncherCustom", True)
|
||||
CheckAdvancedInclude.Checked = Ini.GetOrDefault("DontCheckHostedAssets", False)
|
||||
@@ -422,8 +431,9 @@ Public Class PageInstanceExport
|
||||
End If
|
||||
If PackPath Is Nothing Then
|
||||
Dim Extensions As New List(Of (Extension As String, Display As String))
|
||||
If Not CheckOptionsPcl.Checked AndAlso CheckAdvancedModrinth.Checked Then Extensions.Add(("mrpack", "Modrinth 整合包文件"))
|
||||
Extensions.Add(("zip", "压缩文件"))
|
||||
If Not CheckOptionsPcl.Checked Then Extensions.Add(("mrpack", "Modrinth 整合包文件"))
|
||||
If Not CheckOptionsPcl.Checked AndAlso Not CheckAdvancedModrinth.Checked Then Extensions.Add(("mrpack", "Modrinth 整合包文件"))
|
||||
PackPath = Dialogs.SaveFile("选择导出位置",
|
||||
PackName & If(String.IsNullOrEmpty(TextExportVersion.Text), "", " " & TextExportVersion.Text), filter:=Extensions)
|
||||
Logger.Info($"手动指定的导出路径:{PackPath}")
|
||||
@@ -434,6 +444,9 @@ Public Class PageInstanceExport
|
||||
Dim CacheFolder = RequestTaskTempFolder()
|
||||
Dim OverridesFolder = CacheFolder & "modpack\overrides\"
|
||||
Dim McVersion = PageInstanceLeft.Instance
|
||||
Dim IncludeJava As Boolean =
|
||||
(RulesOverrides Is Nothing AndAlso CheckOptionsJava.Visibility = Visibility.Visible AndAlso CheckOptionsJava.Checked) OrElse
|
||||
(RulesOverrides IsNot Nothing AndAlso CheckOptionsJava.Checked AndAlso Settings.Get(Of Integer)("VersionArgumentJavaV2", McVersion) = 2)
|
||||
Dim PathIndie As String = McVersion.PathIndie
|
||||
Dim CheckHostedAssets As Boolean = Not CheckAdvancedInclude.Checked
|
||||
Dim ModrinthUploadMode As Boolean = CheckAdvancedModrinth.Checked
|
||||
@@ -499,13 +512,23 @@ Public Class PageInstanceExport
|
||||
'更新进度(进度并不准确,主要突出一个我还没似)
|
||||
Progress += 1
|
||||
If Progress = 25 Then
|
||||
Loader.Progress += (0.94 - Loader.Progress) * 0.012
|
||||
Loader.Progress += (0.84 - Loader.Progress) * 0.012
|
||||
Progress = 0
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
SearchFolder(DirectoryUtils.GetInfo(PathIndie))
|
||||
Logger.Info($"复制 overrides 文件完成,有 {Loader.Output.Count} 个文件需要联网检查")
|
||||
Loader.Progress = 0.85
|
||||
'复制 Java
|
||||
If IncludeJava Then
|
||||
Dim JavaToExport = SelectOrDownloadJava(McVersion, False, Loader.CreateCancellationToken, Loader.CreateSyncProgressProvider(0.85, 0.93))
|
||||
If JavaToExport Is Nothing Then Throw New FileNotFoundException("版本文件夹中没有找到可导出的 Java。")
|
||||
Dim JavaFolder = PathUtils.RemoveLastPart(JavaToExport.Folder)
|
||||
Dim DestFolder As String = Path.Combine(OverridesFolder, JavaFolder.AfterFirst(McVersion.PathVersion, True))
|
||||
DirectoryUtils.Copy(JavaFolder, DestFolder)
|
||||
Logger.Info($"已复制版本文件夹中的 Java:{JavaFolder} → {DestFolder}")
|
||||
End If
|
||||
Loader.Progress = 0.95
|
||||
'复制追加内容到根目录
|
||||
Dim BaseFolder As String = If(IncludePCL, CacheFolder, CacheFolder & "modpack\")
|
||||
@@ -532,13 +555,13 @@ Public Class PageInstanceExport
|
||||
If BuildType = BuildTypes.Release AndAlso IncludePCL Then FileUtils.Copy(PathExe, CacheFolder & "Plain Craft Launcher.exe")
|
||||
'复制 PCL 个性化内容
|
||||
If IncludePCLCustom Then
|
||||
If DirectoryUtils.Exists(PathExeFolder & "PCL\Pictures\") Then DirectoryUtils.Copy(PathExeFolder & "PCL\Pictures\", CacheFolder & "PCL\Pictures\")
|
||||
If DirectoryUtils.Exists(PathExeFolder & "PCL\Musics\") Then DirectoryUtils.Copy(PathExeFolder & "PCL\Musics\", CacheFolder & "PCL\Musics\")
|
||||
If DirectoryUtils.Exists(PathExeFolder & "PCL\Help\") Then DirectoryUtils.Copy(PathExeFolder & "PCL\Help\", CacheFolder & "PCL\Help\")
|
||||
If FileUtils.Exists(PathExeFolder & "PCL\Custom.xaml") Then FileUtils.Copy(PathExeFolder & "PCL\Custom.xaml", CacheFolder & "PCL\Custom.xaml")
|
||||
If FileUtils.Exists(PathExeFolder & "PCL\Setup.ini") Then FileUtils.Copy(PathExeFolder & "PCL\Setup.ini", CacheFolder & "PCL\Setup.ini")
|
||||
If FileUtils.Exists(PathExeFolder & "PCL\hints.txt") Then FileUtils.Copy(PathExeFolder & "PCL\hints.txt", CacheFolder & "PCL\hints.txt")
|
||||
If FileUtils.Exists(PathExeFolder & "PCL\Logo.png") Then FileUtils.Copy(PathExeFolder & "PCL\Logo.png", CacheFolder & "PCL\Logo.png")
|
||||
If DirectoryUtils.Exists(Paths.Base & "PCL\Pictures\") Then DirectoryUtils.Copy(Paths.Base & "PCL\Pictures\", CacheFolder & "PCL\Pictures\")
|
||||
If DirectoryUtils.Exists(Paths.Base & "PCL\Musics\") Then DirectoryUtils.Copy(Paths.Base & "PCL\Musics\", CacheFolder & "PCL\Musics\")
|
||||
If DirectoryUtils.Exists(Paths.Base & "PCL\Help\") Then DirectoryUtils.Copy(Paths.Base & "PCL\Help\", CacheFolder & "PCL\Help\")
|
||||
If FileUtils.Exists(Paths.Base & "PCL\Custom.xaml") Then FileUtils.Copy(Paths.Base & "PCL\Custom.xaml", CacheFolder & "PCL\Custom.xaml")
|
||||
If FileUtils.Exists(Paths.Base & "PCL\Setup.ini") Then FileUtils.Copy(Paths.Base & "PCL\Setup.ini", CacheFolder & "PCL\Setup.ini")
|
||||
If FileUtils.Exists(Paths.Base & "PCL\hints.txt") Then FileUtils.Copy(Paths.Base & "PCL\hints.txt", CacheFolder & "PCL\hints.txt")
|
||||
If FileUtils.Exists(Paths.Base & "PCL\Logo.png") Then FileUtils.Copy(Paths.Base & "PCL\Logo.png", CacheFolder & "PCL\Logo.png")
|
||||
End If
|
||||
End Sub) With {.ProgressWeight = 5})
|
||||
|
||||
@@ -611,7 +634,7 @@ Public Class PageInstanceExport
|
||||
|
||||
'等待线程结束
|
||||
Do Until EndedThreadCount = 2
|
||||
If Loader.IsInterrupted Then Return
|
||||
If Loader.IsCanceled Then Return
|
||||
Thread.Sleep(10)
|
||||
Loop
|
||||
|
||||
@@ -694,6 +717,39 @@ Public Class PageInstanceExport
|
||||
|
||||
#End Region
|
||||
|
||||
Private Sub RefreshJavaInfo() Handles Me.Loaded
|
||||
Dim JavaType As Integer = Settings.Get(Of Integer)("VersionArgumentJavaV2", PageInstanceLeft.Instance)
|
||||
Dim JavaWorker = PageInstanceLeft.CurrentJavaWorker
|
||||
'导出选项
|
||||
Dim JavaToExport = If(JavaType = 2 AndAlso JavaWorker.LastSucceeded AndAlso Not JavaWorker.Running, JavaWorker.LastResult, Nothing)
|
||||
If JavaToExport Is Nothing Then
|
||||
CheckOptionsJava.Visibility = Visibility.Collapsed
|
||||
Else
|
||||
CheckOptionsJava.Visibility = Visibility.Visible
|
||||
CheckOptionsJava.Inlines.Clear()
|
||||
CheckOptionsJava.Inlines.Add(New Run(
|
||||
GetExportOption(CheckOptionsJava).Title))
|
||||
CheckOptionsJava.Inlines.Add(New Run(" " &
|
||||
$"Java {JavaToExport.Version.Major} ({JavaToExport.Version}):{ _
|
||||
PathUtils.AddSlashSuffix(PathUtils.RemoveLastPart(JavaToExport.Folder.Replace(PathUtils.RemoveLastPart(PathUtils.RemoveLastPart(PageInstanceLeft.Instance.PathVersion)), ""))).TrimStart("\")}") With {.Foreground = ColorGray5})
|
||||
End If
|
||||
'警告条
|
||||
If JavaType = 3 Then
|
||||
BtnExport.IsEnabled = True
|
||||
HintJava.Visibility = Visibility.Visible
|
||||
HintJava.Theme = MyHint.Themes.Yellow
|
||||
HintJava.Text = $"该版本设置要求 {vbLQ}使用指定的 Java{vbRQ},这在导出后很可能会失效。建议修改为 {vbLQ}使用版本文件夹中的 Java{vbRQ}。"
|
||||
ElseIf JavaType = 2 AndAlso JavaWorker.HasSucceeded AndAlso JavaWorker.LastResult Is Nothing Then
|
||||
BtnExport.IsEnabled = False
|
||||
HintJava.Visibility = Visibility.Visible
|
||||
HintJava.Theme = MyHint.Themes.Red
|
||||
HintJava.Text = $"该版本设置要求 {vbLQ}使用版本文件夹中的 Java{vbRQ},但版本文件夹中没能找到任何 Java。"
|
||||
Else
|
||||
BtnExport.IsEnabled = True
|
||||
HintJava.Visibility = Visibility.Collapsed
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'自动填写整合包名称
|
||||
Private Sub TextExportName_GotFocus() Handles TextExportName.GotFocus
|
||||
If TextExportName.Text = "" Then
|
||||
@@ -702,10 +758,13 @@ Public Class PageInstanceExport
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'勾选打包资源文件时,禁止开启 Modrinth 上传模式
|
||||
Private Sub CheckAdvancedInclude_Change(sender As Object, user As Boolean) Handles CheckAdvancedInclude.Change
|
||||
'勾选打包资源文件时,禁止开启仅 Modrinth 资源模式
|
||||
If CheckAdvancedInclude.Checked Then CheckAdvancedModrinth.Checked = False
|
||||
CheckAdvancedModrinth.IsEnabled = Not CheckAdvancedInclude.Checked
|
||||
End Sub
|
||||
Private Sub CheckAdvancedModrinth_Change(sender As Object, user As Boolean) Handles CheckAdvancedModrinth.Change, CheckOptionsPcl.Change
|
||||
HintModrinthFormat.Visibility = (CheckAdvancedModrinth.Checked AndAlso CheckOptionsPcl.Checked).ToVisibility
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageLeft x:Class="PageInstanceLeft"
|
||||
<local:MyPageLeft x:Class="PageInstanceLeft"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" AnimatedControl="PanItem">
|
||||
@@ -9,7 +9,7 @@
|
||||
Logo="M1000 241c-2-5-4-11-6-17-0-6-4-12-8-17-7-9-18-15-31-15-6 0-13 1-19 5l-15 15-17 17-21 21L749 381c-14 14-38 14-52 0l-54-54c-14-14-14-38 0-52l132-132 14-14 20-20 16-16c3-5 5-11 5-19 0-12-5-24-16-32-5-4-11-6-18-7-5-2-10-4-16-5-36-12-76-19-117-19-7 0-14 0-22 0-188 11-337 168-337 360 0 16 0 32 3 48L56 663c-73 74-73 193 0 267l33 33c73 73 193 73 267 0l240-241c21 4 42 5 64 5 190 0 346-146 360-333 0-8 0-17 0-27 0-44-6-86-21-125zM658 639c-28 0-54-4-79-11-4 7-10 14-16 21l-258 258c-43 43-115 43-158 0l-29-29c-43-44-43-115 0-158l212-212 46-46c5-5 12-11 19-15-8-26-12-54-12-83v-1c0-152 123-275 276-275 18 0 37 1 55 5L597 207c-52 52-52 137 0 189l29 29c52 52 137 52 189 0L930 312c2 16 4 33 4 50 0 152-123 276-276 276z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="1" ToolTip="初始化" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
<local:MyIconButton Tag="1" ToolTip="初始化" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
@@ -17,7 +17,7 @@
|
||||
Logo="M789.504 912.896h-195.072a35.328 35.328 0 0 1-34.816-35.328v-77.312a39.936 39.936 0 0 0-40.448-39.936H481.28a40.448 40.448 0 0 0-40.448 39.936v77.312a34.816 34.816 0 0 1-34.816 35.328H204.8a41.984 41.984 0 0 1-40.448-42.496v-200.192a35.328 35.328 0 0 1 35.328-35.328h72.704a39.936 39.936 0 0 0 39.936-39.936v-37.888a39.936 39.936 0 0 0-39.936-40.448H199.68a35.328 35.328 0 0 1-35.328-35.328V287.744A41.984 41.984 0 0 1 204.8 245.76h176.64v-32.768a102.4 102.4 0 0 1 102.4-102.4h33.792a102.4 102.4 0 0 1 102.4 102.4v32.768h170.496a41.984 41.984 0 0 1 41.984 41.984V460.8h28.672a102.4 102.4 0 0 1 102.4 102.4v33.792a102.4 102.4 0 0 1-102.4 102.4h-28.672V870.4a41.984 41.984 0 0 1-43.008 42.496z m-159.744-70.144h131.584V665.6a34.304 34.304 0 0 1 34.816-34.816h64a31.744 31.744 0 0 0 31.744-31.744V563.2a31.744 31.744 0 0 0-31.744-31.744h-64a34.816 34.816 0 0 1-34.816-35.328V316.416h-177.152a35.328 35.328 0 0 1-35.328-35.328V212.992a31.744 31.744 0 0 0-31.744-31.744h-33.792a31.744 31.744 0 0 0-31.744 31.744v68.096a35.328 35.328 0 0 1-34.816 35.328H234.496v130.048h37.888a110.592 110.592 0 0 1 110.08 110.592v37.888a110.592 110.592 0 0 1-110.08 110.592h-37.888v137.216h136.192v-42.496a110.592 110.592 0 0 1 110.592-110.08h37.888a110.592 110.592 0 0 1 110.592 110.08z" >
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="2" ToolTip="刷新" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" Click="Refresh" LogoScale="0.85" Logo="M875.52 148.48C783.36 56.32 655.36 0 512 0 291.84 0 107.52 138.24 30.72 332.8l122.88 46.08C204.8 230.4 348.16 128 512 128c107.52 0 199.68 40.96 271.36 112.64L640 384h384V0L875.52 148.48zM512 896c-107.52 0-199.68-40.96-271.36-112.64L384 640H0v384l148.48-148.48C240.64 967.68 368.64 1024 512 1024c220.16 0 404.48-138.24 481.28-332.8L870.4 645.12C819.2 793.6 675.84 896 512 896z" />
|
||||
<local:MyIconButton Tag="2" ToolTip="刷新" Click="Refresh_Click" LogoScale="0.85" Logo="M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
@@ -27,7 +27,7 @@
|
||||
Logo="M511 995a128 128 0 0 1-57-13L70 791a126 126 0 0 1-70-113V311a126 126 0 0 1 15-60V248c1-2 3-5 5-8a127 127 0 0 1 49-42L454 13a128 128 0 0 1 112 0l383 190a126 126 0 0 1 72 113v360a126 126 0 0 1-70 115L568 984c-17 7-37 11-57 11z m42-470v370l360-178c14-7 23-21 23-38v-335L554 524zM85 330v347a42 42 0 0 0 23 38l360 178V523L85 330zM135 260l375 189 137-65L286 188 135 260z m245-118l363 197 150-71-365-180a42 42 0 0 0-37 0l-111 53z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="4" ToolTip="刷新" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" Click="Refresh" LogoScale="0.85" Logo="M875.52 148.48C783.36 56.32 655.36 0 512 0 291.84 0 107.52 138.24 30.72 332.8l122.88 46.08C204.8 230.4 348.16 128 512 128c107.52 0 199.68 40.96 271.36 112.64L640 384h384V0L875.52 148.48zM512 896c-107.52 0-199.68-40.96-271.36-112.64L384 640H0v384l148.48-148.48C240.64 967.68 368.64 1024 512 1024c220.16 0 404.48-138.24 481.28-332.8L870.4 645.12C819.2 793.6 675.84 896 512 896z" />
|
||||
<local:MyIconButton Tag="4" ToolTip="刷新" Click="Refresh_Click" LogoScale="0.85" Logo="M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageInstanceLeft
|
||||
Public Class PageInstanceLeft
|
||||
Implements IRefreshable
|
||||
|
||||
''' <summary>
|
||||
@@ -91,7 +91,7 @@
|
||||
|
||||
#End Region
|
||||
|
||||
Public Sub Refresh(sender As Object, e As EventArgs) '由边栏按钮匿名调用
|
||||
Public Sub Refresh_Click(sender As Object, e As EventArgs) '由边栏按钮匿名调用
|
||||
Refresh(Val(sender.Tag))
|
||||
End Sub
|
||||
Public Sub Refresh() Implements IRefreshable.Refresh
|
||||
@@ -116,4 +116,12 @@
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'加载当前版本将要选择的 Java
|
||||
Public Shared CurrentJavaWorker As New RedoableWorker(Of Java)(Function(c, p) SelectOrDownloadJava(PageInstanceLeft.Instance, False, c, p))
|
||||
Public Shared Sub ReloadCurrentJava() Handles Me.Loaded
|
||||
If AniControlEnabled <> 0 Then Return
|
||||
If PageInstanceLeft.Instance Is Nothing Then Return
|
||||
CurrentJavaWorker.Start()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageInstanceMod
|
||||
Public Class PageInstanceMod
|
||||
Implements IRefreshable
|
||||
|
||||
#Region "初始化"
|
||||
@@ -112,28 +112,16 @@
|
||||
'图标按钮
|
||||
Dim BtnOpen As New MyIconButton With {.LogoScale = 1.05, .Logo = Logo.IconButtonOpen, .Tag = sender}
|
||||
BtnOpen.ToolTip = "打开文件位置"
|
||||
ToolTipService.SetPlacement(BtnOpen, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnOpen, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnOpen, 2)
|
||||
AddHandler BtnOpen.Click, AddressOf Open_Click
|
||||
Dim BtnCont As New MyIconButton With {.LogoScale = 1, .Logo = Logo.IconButtonInfo, .Tag = sender}
|
||||
BtnCont.ToolTip = "详情"
|
||||
ToolTipService.SetPlacement(BtnCont, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnCont, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnCont, 2)
|
||||
AddHandler BtnCont.Click, AddressOf Info_Click
|
||||
AddHandler sender.MouseRightButtonUp, AddressOf Info_Click
|
||||
Dim BtnDelete As New MyIconButton With {.LogoScale = 1, .Logo = Logo.IconButtonDelete, .Tag = sender}
|
||||
BtnDelete.ToolTip = "删除"
|
||||
ToolTipService.SetPlacement(BtnDelete, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnDelete, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnDelete, 2)
|
||||
AddHandler BtnDelete.Click, AddressOf Delete_Click
|
||||
Dim BtnED As New MyIconButton With {.LogoScale = 1, .Logo = If(sender.Entry.IsEnabled, Logo.IconButtonStop, Logo.IconButtonCheck), .Tag = sender}
|
||||
BtnED.ToolTip = If(sender.Entry.IsEnabled, "禁用", "启用")
|
||||
ToolTipService.SetPlacement(BtnED, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnED, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnED, 2)
|
||||
AddHandler BtnED.Click, AddressOf ED_Click
|
||||
sender.Buttons = {BtnCont, BtnOpen, BtnED, BtnDelete}
|
||||
End Sub
|
||||
@@ -493,7 +481,6 @@ Install:
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
FileUtils.Delete(NewPath)
|
||||
FileUtils.Move(ModEntity.File.FullName, NewPath)
|
||||
Catch ex As FileNotFoundException
|
||||
Logger.Error(ex, $"未找到需要重命名的 Mod({If(ModEntity.File.FullName, "null")})")
|
||||
@@ -607,10 +594,6 @@ Install:
|
||||
End If
|
||||
Next
|
||||
For Each Entry As KeyValuePair(Of String, String) In FileCopyList
|
||||
If FileUtils.Exists(Entry.Value) Then
|
||||
Logger.Warn($"更新后的 Mod 文件已存在,将会把它放入回收站:{Entry.Value}")
|
||||
FileUtils.Delete(Entry.Value, True)
|
||||
End If
|
||||
If DirectoryUtils.Exists(PathUtils.RemoveLastPart(Entry.Value)) Then
|
||||
FileUtils.Move(Entry.Key, Entry.Value)
|
||||
FinishedFileNames.Add(PathUtils.GetLastPart(Entry.Value))
|
||||
@@ -640,7 +623,7 @@ Install:
|
||||
End Select
|
||||
Case LoadState.Failed
|
||||
Hint("Mod 更新失败:" & Loader.Error.GetDisplay(False), HintType.Red)
|
||||
Case LoadState.Interrupted
|
||||
Case LoadState.Canceled
|
||||
Hint("Mod 更新已中止!", HintType.Blue)
|
||||
Case Else
|
||||
Return
|
||||
@@ -660,7 +643,7 @@ Install:
|
||||
End Sub, "Clean Mod Update Cache", ThreadPriority.BelowNormal)
|
||||
End Sub
|
||||
'启动加载器
|
||||
Logger.Info($"开始更新 {ModList.Count} 个 Mod:{PathMods}")
|
||||
Logger.Info($"开始更新 {ModList.Count} 个 Mod:{ModList.Select(Function(m) m.File.Name).Join(",")}")
|
||||
UpdatingInstanceModFolders.Add(PathMods)
|
||||
Loader.Start()
|
||||
LoaderTaskbarAdd(Loader)
|
||||
@@ -761,7 +744,7 @@ Install:
|
||||
'获取信息
|
||||
Dim ContentLines As New List(Of String)
|
||||
If ModEntry.Description IsNot Nothing Then ContentLines.Add(ModEntry.Description & vbCrLf)
|
||||
ContentLines.Add("文件:" & ModEntry.File.Name & "(" & FormatFileSize(ModEntry.File.Length) & ")")
|
||||
ContentLines.Add("文件:" & ModEntry.File.Name & "(" & StringUtils.FormatByteSize(ModEntry.File.Length) & ")")
|
||||
If ModEntry.Version IsNot Nothing Then ContentLines.Add("版本:" & ModEntry.Version)
|
||||
Dim DebugInfo As New List(Of String)
|
||||
If DebugInfo.Any Then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight x:Class="PageInstanceModDisabled"
|
||||
<local:MyPageRight x:Class="PageInstanceModDisabled"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Class PageInstanceModDisabled
|
||||
Public Class PageInstanceModDisabled
|
||||
|
||||
Private Sub BtnDownload_Click(sender As Object, e As EventArgs) Handles BtnDownload.Click
|
||||
FrmMain.PageChange(FormMain.PageType.Download, FormMain.PageSubType.DownloadInstall)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageInstanceOverall
|
||||
Public Class PageInstanceOverall
|
||||
|
||||
Private IsLoad As Boolean = False
|
||||
Private Sub PageSetupLaunch_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
@@ -116,15 +116,15 @@
|
||||
Dim JsonObject As JObject
|
||||
Dim OldJsonPath As String = PageInstanceLeft.Instance.GetJsonPath()
|
||||
Try
|
||||
JsonObject = GetJson(FileUtils.ReadAsString(OldJsonPath))
|
||||
JsonObject = FileUtils.ReadAsJson(OldJsonPath)
|
||||
Catch ex As Exception
|
||||
Logger.Warn(ex, "在重命名读取 json 时失败")
|
||||
Logger.Warn(ex, "在重命名读取 JSON 时失败")
|
||||
JsonObject = PageInstanceLeft.Instance.JsonObject
|
||||
End Try
|
||||
'重命名主文件夹
|
||||
DirectoryUtils.Move(OldPath, NewPath)
|
||||
'清理 ini 缓存
|
||||
PageInstanceLeft.Instance.ResetIniCache()
|
||||
PageInstanceLeft.Instance.ResetSettingsCache()
|
||||
'重命名 jar 文件与 natives 文件夹
|
||||
'不能进行遍历重命名,否则在版本名很短的时候容易误伤其他文件(#6443)
|
||||
If DirectoryUtils.Exists($"{NewPath}{OldName}-natives") Then DirectoryUtils.Move($"{NewPath}{OldName}-natives", $"{NewPath}{NewName}-natives")
|
||||
@@ -271,7 +271,7 @@
|
||||
Return
|
||||
Next
|
||||
'启动
|
||||
Dim Loader As New LoaderCombo(Of String)(PageInstanceLeft.Instance.Name & " 文件补全", DlClientFix(PageInstanceLeft.Instance, True, AssetsIndexExistsBehaviour.AlwaysDownload))
|
||||
Dim Loader As New LoaderCombo(Of String)(PageInstanceLeft.Instance.Name & " 文件补全", DlClientFix(PageInstanceLeft.Instance, True, False))
|
||||
Loader.OnStateChanged =
|
||||
Sub()
|
||||
Select Case Loader.State
|
||||
@@ -279,7 +279,7 @@
|
||||
Hint(Loader.Name & "成功!", HintType.Green)
|
||||
Case LoadState.Failed
|
||||
Hint(Loader.Name & "失败:" & Loader.Error.GetDisplay(False), HintType.Red)
|
||||
Case LoadState.Interrupted
|
||||
Case LoadState.Canceled
|
||||
Hint(Loader.Name & "已取消!", HintType.Blue)
|
||||
End Select
|
||||
End Sub
|
||||
@@ -302,7 +302,7 @@
|
||||
If(IsHintIndie, vbCrLf & "由于该版本开启了版本隔离,删除版本时该版本对应的存档、资源包、Mod 等文件也将被一并删除!", ""),
|
||||
"版本删除确认", , "取消",, IsHintIndie OrElse IsShiftPressed)
|
||||
Case 1
|
||||
PageInstanceLeft.Instance.ResetIniCache()
|
||||
PageInstanceLeft.Instance.ResetSettingsCache()
|
||||
DirectoryUtils.Delete(PageInstanceLeft.Instance.PathVersion, Not IsShiftPressed)
|
||||
Hint("已删除版本 " & PageInstanceLeft.Instance.Name & "!", HintType.Green)
|
||||
Case 2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -25,13 +25,14 @@
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="9" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left" Text="版本隔离" Margin="0,0,25,0" />
|
||||
<local:MyComboBox x:Name="ComboArgumentIndieV2" Grid.Row="0" Grid.ColumnSpan="2" Grid.Column="1">
|
||||
<local:MyComboBoxItem Content="开启" ToolTipService.InitialShowDelay="0" ToolTipService.BetweenShowDelay="0"
|
||||
ToolTip="与其他版本的存档、Mod 等文件相互独立,互不干涉。
这会使你无法跨版本共享存档,但可以规避 Mod 冲突问题。" ToolTipService.HorizontalOffset="100"/>
|
||||
<local:MyComboBoxItem Content="关闭" ToolTipService.InitialShowDelay="0" ToolTipService.BetweenShowDelay="0"
|
||||
ToolTip="与其余关闭隔离的版本共享存档、Mod 等文件。
若存在多个安装了 Mod 的版本,可能会由于 Mod 冲突而导致崩溃。" ToolTipService.HorizontalOffset="100"/>
|
||||
<local:MyComboBoxItem Content="开启" ToolTipService.InitialShowDelay="0"
|
||||
ToolTip="与其他版本的存档、Mod 等文件相互独立,互不干涉。
这会使你无法跨版本共享存档,但可以规避 Mod 冲突问题。"/>
|
||||
<local:MyComboBoxItem Content="关闭" ToolTipService.InitialShowDelay="0"
|
||||
ToolTip="与其余关闭隔离的版本共享存档、Mod 等文件。
若存在多个安装了 Mod 的版本,可能会由于 Mod 冲突而导致崩溃。"/>
|
||||
</local:MyComboBox>
|
||||
<TextBlock Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left" Text="游戏窗口标题" Margin="0,0,25,0" />
|
||||
<local:MyTextBox x:Name="TextArgumentTitle" Grid.Row="2" Grid.ColumnSpan="2" local:SettingService.Key="VersionArgumentTitle" Grid.Column="1" ToolTip="自定义游戏窗口的标题,若留空则跟随全局设置的值。
你可以用替换标记来动态改变其内容,在 更多 → 帮助 中搜索 “替换标记” 以了解用法。" HintText="跟随全局设置" MaxLength="100" />
|
||||
@@ -47,18 +48,43 @@
|
||||
</local:ValidateExcept>
|
||||
</local:MyTextBox.ValidateRules>
|
||||
</local:MyTextBox>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Row="6" HorizontalAlignment="Left" Text="游戏 Java" Margin="0,0,25,0" />
|
||||
<local:MyComboBox x:Name="ComboArgumentJava" Grid.ColumnSpan="2" Grid.Row="6" Grid.Column="1"
|
||||
ToolTip="若将 Java 放在游戏文件夹或 PCL 文件夹,在进行自动选择时 PCL 会尽量优先选择它">
|
||||
<ComboBoxItem Content="加载中……" IsSelected="True" />
|
||||
<!--<local:MyComboBoxItem Content="Java 8 (1.8.0_171),64 位:C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe" ToolTipService.Placement="Right" ToolTipService.HorizontalOffset="5" IsSelected="True" ToolTip="C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe" />-->
|
||||
</local:MyComboBox>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Row="6" HorizontalAlignment="Left" Text="Java" Margin="0,0,25,0" />
|
||||
<Grid Grid.ColumnSpan="2" Grid.Row="6" Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<local:MyComboBox x:Name="ComboArgumentJava" local:SettingService.Key="VersionArgumentJavaV2">
|
||||
<local:MyComboBoxItem Content="自动选择"
|
||||
ToolTip="由 PCL 自动分析需要的 Java 版本,如果没有合适的 Java 则自动下载。" />
|
||||
<local:MyComboBoxItem Content="自动选择指定版本的 Java"
|
||||
ToolTip="手动输入一个 Java 版本范围,PCL 将选择符合该范围的 Java,如果没有合适的 Java 则自动下载。
适合部分 Mod 需要特定 Java 版本才能启动的情况。" />
|
||||
<local:MyComboBoxItem Content="使用版本文件夹中的 Java"
|
||||
ToolTip="手动在当前版本的文件夹中放置 Java 后,PCL 将自动搜索并使用该 Java。
适合整合包自带 Java 的情况。" />
|
||||
<local:MyComboBoxItem Content="使用指定的 Java"
|
||||
ToolTip="手动指定所使用的 Java 的绝对路径。
若将该版本打包到其他电脑,此设置可能会失效。" />
|
||||
</local:MyComboBox>
|
||||
<local:MyTextBox x:Name="TextArgumentJavaRange" local:SettingService.Key="VersionArgumentJavaRange"
|
||||
Grid.Column="1" Margin="7,0,0,0" Width="200"
|
||||
ToolTip="输入允许的 Java 版本区间,例如 [17.0.1, 25.0)。
方括号代表包含,圆括号代表不包含。不写其中一侧代表不限制。

例如:
[21.0, ) 代表至少需要 Java 21。
(, 18.0) 代表允许 Java 17-,但不允许 Java 18+(圆括号代表不包含)。
[8.0.81, 8.0.141] 则代表仅允许 Java 8u81 ~ 8u141。

你可以在左侧选择 “使用指定的 Java” 来查看你电脑中已有的 Java 的版本号。" HintText="版本区间…" MaxLength="100" />
|
||||
</Grid>
|
||||
<local:MyHint Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="2" x:Name="HintArgumentJava" Margin="0,8,0,0" Visibility="Collapsed" />
|
||||
<Grid x:Name="PanArgumentJavaSelect" Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" Visibility="Collapsed"
|
||||
Height="28" Margin="0,9,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<local:MyComboBox x:Name="ComboArgumentJavaSelect" Grid.Column="0" />
|
||||
<TextBlock x:Name="LabArgumentJava" Grid.Column="0" Margin="8.5,0,21.5,0" IsHitTestVisible="False" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
<local:MyIconButton Margin="5,2,0,2" Grid.Column="1" x:Name="BtnArgumentJavaSearch"
|
||||
Logo="M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</local:MyCard>
|
||||
<local:MyCard Margin="0,0,0,15" Title="内存分配">
|
||||
<StackPanel Margin="25,40,25,15">
|
||||
<local:MyHint x:Name="LabRamWarn" Text="32 位 Java 只能分配最多 1 GB 的内存。强烈建议换用 64 位的 Java!" Theme="Yellow" Margin="0,0,0,12" />
|
||||
<Grid Margin="0,0,0,3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -72,7 +98,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
<local:MyRadioBox Text="跟随全局设置" Width="110" Checked="True" x:Name="RadioRamType2" local:SettingService.Key="VersionRamType" local:SettingService.Value="2" Margin="0,0,20,9" />
|
||||
<local:MyRadioBox Grid.Row="1" Text="自动配置" Width="110" x:Name="RadioRamType0" local:SettingService.Key="VersionRamType" local:SettingService.Value="0" Margin="0,0,20,0"
|
||||
ToolTip="根据安装的 Mod 量与电脑剩余内存动态调整为游戏分配的内存" ToolTipService.Placement="Right" ToolTipService.HorizontalOffset="-10" ToolTipService.VerticalOffset="-3" />
|
||||
ToolTip="根据安装的 Mod 量与电脑剩余内存动态调整为游戏分配的内存" />
|
||||
<local:MyRadioBox Grid.Row="3" Text="自定义" x:Name="RadioRamType1" local:SettingService.Key="VersionRamType" local:SettingService.Value="1" Margin="0,0,20,0" />
|
||||
<local:MySlider Grid.Row="3" Grid.Column="1" IsEnabled="False" x:Name="SliderRamCustom" local:SettingService.Key="VersionRamCustom" MaxValue="49" Value="13" />
|
||||
<!--<local:MyTextBox Grid.Row="2" Grid.Column="3" Width="100" VerticalAlignment="Center" Margin="30,0,0,0" Text="2048 MB" />-->
|
||||
@@ -219,16 +245,11 @@
|
||||
<TextBlock VerticalAlignment="Center" Grid.Row="4" HorizontalAlignment="Left" Text="内存管理" Margin="0,0,25,0" />
|
||||
<local:MyComboBox local:SettingService.Key="VersionAdvanceGC" Grid.Row="4" Grid.ColumnSpan="2" Grid.Column="1">
|
||||
<local:MyComboBoxItem Content="跟随全局设置" />
|
||||
<local:MyComboBoxItem Content="尽量使用 ZGC"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="在 Java 21+ 使用分代 ZGC,20~15 使用非分代的 ZGC,14- 使用 G1GC。
ZGC 的内存占用比 G1GC 更高,不过在回收内存时不会导致卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="尽量使用分代 ZGC"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="在 Java 21+ 使用分代 ZGC,20- 使用 G1GC。
ZGC 的内存占用比 G1GC 更高,不过在回收内存时不会导致卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="标准 G1GC"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="总是使用 G1GC,附带 Mojang 官方的优化参数。
G1GC 的内存占用比 ZGC 更低,但在回收内存时会导致突然的卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="调优 G1GC" local:SettingService.Value="5"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="总是使用 G1GC,附带 PCL 调优过的优化参数。
G1GC 的内存占用比 ZGC 更低,但在回收内存时会导致突然的卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="不指定(可自定义)" local:SettingService.Value="4"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="不自动添加 GC 参数。
仅当选择此项时,你可以在 “Java 虚拟机参数” 设置中手动添加 GC 参数。" />
|
||||
<local:MyComboBoxItem Content="尽量使用 ZGC" ToolTip="在 Java 21+ 使用分代 ZGC,20~15 使用非分代的 ZGC,14- 使用 G1GC。
ZGC 的内存占用比 G1GC 更高,不过在回收内存时不会导致卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="尽量使用分代 ZGC" ToolTip="在 Java 21+ 使用分代 ZGC,20- 使用 G1GC。
ZGC 的内存占用比 G1GC 更高,不过在回收内存时不会导致卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="标准 G1GC" ToolTip="总是使用 G1GC,附带 Mojang 官方的优化参数。
G1GC 的内存占用比 ZGC 更低,但在回收内存时会导致突然的卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="调优 G1GC" local:SettingService.Value="5" ToolTip="总是使用 G1GC,附带 PCL 调优过的优化参数。
G1GC 的内存占用比 ZGC 更低,但在回收内存时会导致突然的卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="不指定(可自定义)" local:SettingService.Value="4" ToolTip="不自动添加 GC 参数。
仅当选择此项时,你可以在 “Java 虚拟机参数” 设置中手动添加 GC 参数。" />
|
||||
</local:MyComboBox>
|
||||
<TextBlock Grid.Row="6" VerticalAlignment="Center" HorizontalAlignment="Left" Text="启动前执行命令" Margin="0,0,25,3" />
|
||||
<local:MyTextBox x:Name="TextAdvanceRun" Grid.Row="6" Grid.ColumnSpan="2" local:SettingService.Key="VersionAdvanceRun" Grid.Column="1" HintText="" Margin="0,0,0,3"
|
||||
@@ -237,19 +258,12 @@
|
||||
Text="等待命令执行完成后再继续启动" Margin="0,5,0,0" />
|
||||
<StackPanel Margin="0,12,0,4" Grid.Row="8" Grid.ColumnSpan="2" HorizontalAlignment="Left">
|
||||
<local:MyCheckBox Height="28" Text="禁止更新 Mod" x:Name="CheckAdvanceDisableModUpdate" local:SettingService.Key="VersionAdvanceDisableModUpdate"
|
||||
ToolTip="禁止为此版本更新 Mod,以防止整合包玩家误操作"
|
||||
ToolTipService.Placement="Right" />
|
||||
<local:MyCheckBox Height="28" Text="忽略 Java 兼容性警告" x:Name="CheckAdvanceJava" local:SettingService.Key="VersionAdvanceJava"
|
||||
ToolTipService.Placement="Right"
|
||||
ToolTip="如果手动选择了与当前版本不兼容的 Java,则自动跳过兼容性警告弹窗,强制使用手动选择的 Java。" />
|
||||
ToolTip="禁止为此版本更新 Mod,以防止整合包玩家误操作" />
|
||||
<local:MyCheckBox Height="28" Text="关闭文件校验" x:Name="CheckAdvanceAssetsV2" local:SettingService.Key="VersionAdvanceAssetsV2"
|
||||
ToolTipService.Placement="Right"
|
||||
ToolTip="完全不更改 assets;不校验 libraries、第三方登录库与版本主 jar 文件是否被修改。
如果你没有修改相关文件,请勿勾选此项。" />
|
||||
<local:MyCheckBox Height="28" Text="禁用 Java Launch Wrapper" x:Name="CheckAdvanceDisableJLW" local:SettingService.Key="VersionAdvanceDisableJLW"
|
||||
ToolTipService.Placement="Right"
|
||||
ToolTip="是否使用 Java Launch Wrapper 修复 Java 18- 在中文路径下可能无法正常启动的问题。
详见:https://github.com/00ll00/java_launch_wrapper" />
|
||||
<local:MyCheckBox Height="28" Text="禁用 LWJGL Unsafe Agent" local:SettingService.Key="VersionAdvanceDisableLUA"
|
||||
ToolTipService.Placement="Right"
|
||||
ToolTip="是否使用 LWJGL Unsafe Agent 修复 LWJGL 3.4.1 的一个性能问题。
详见:https://github.com/HMCL-dev/lwjgl-unsafe-agent" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
Public Class PageInstanceSetup
|
||||
|
||||
Private Shadows IsLoaded As Boolean = False
|
||||
Public Class PageInstanceSetup
|
||||
|
||||
Private LoadedFirst As Boolean = False
|
||||
Private Sub PageSetupSystem_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
|
||||
'重复加载部分
|
||||
@@ -14,8 +13,30 @@
|
||||
AniControlEnabled -= 1
|
||||
|
||||
'非重复加载部分
|
||||
If IsLoaded Then Return
|
||||
IsLoaded = True
|
||||
If LoadedFirst Then Return
|
||||
LoadedFirst = True
|
||||
|
||||
'Java 加载器同步
|
||||
AddHandler PageInstanceLeft.CurrentJavaWorker.Started, AddressOf UpdateJavaRelatedUi
|
||||
AddHandler PageInstanceLeft.CurrentJavaWorker.Stopped, AddressOf UpdateJavaRelatedUi
|
||||
|
||||
'版本范围校验
|
||||
TextArgumentJavaRange.ValidateRules = New ObjectModel.Collection(Of Validate) From {New ValidateFunc(
|
||||
Function(Str As String)
|
||||
Try
|
||||
If String.IsNullOrWhiteSpace(Str) Then Return "不能为空"
|
||||
Dim Range = ValueRange(Of Version).FromString(Str, Function(s) StringUtils.ParseVersionWithDefaults(s))
|
||||
If Range.IsEmpty Then Return "范围下限的版本号比上限更高,导致该范围无法匹配到任何版本"
|
||||
If Range.HasLower AndAlso Range.Lower.Major <= 1 AndAlso (Range.Lower.Minor > 0 OrElse Range.Lower.Build > 0 OrElse Range.Lower.Revision > 0) Then Return "不应使用 1.x 格式进行匹配(例如,若想匹配 Java 17,应填写 17 而非 1.17)"
|
||||
If Range.HasUpper AndAlso Range.Upper.Major <= 1 AndAlso (Range.Upper.Minor > 0 OrElse Range.Upper.Build > 0 OrElse Range.Upper.Revision > 0) Then Return "不应使用 1.x 格式进行匹配(例如,若想匹配 Java 17,应填写 17 而非 1.17)"
|
||||
If Range.HasUpper AndAlso Range.Upper.Major <= 4 Then Return "该范围所要求的 Java 版本过低"
|
||||
If Range.HasUpper AndAlso Range.IsUpperInclusive AndAlso Range.Upper.Minor <= 0 AndAlso Range.Upper.Build <= 0 Then Return $"右侧闭区间的意图并不明确。如果不想允许 Java {Range.Upper.Major},请改为 {vbLQ}{Range.Upper.Major}){vbRQ}。如果想允许 Java {Range.Upper.Major},请改为 {vbLQ}{Range.Upper.Major + 1}){vbRQ}。"
|
||||
If Range.Intersect(ValueRange(Of Version).OpenClosed(New Version(5, 0), New Version(99, 0))).IsEmpty() Then Return "该范围无法匹配到任何常见的 Java"
|
||||
Return ""
|
||||
Catch ex As Exception
|
||||
Return ex.Message
|
||||
End Try
|
||||
End Function)}
|
||||
|
||||
'内存自动刷新
|
||||
Dim timer As New Threading.DispatcherTimer With {.Interval = New TimeSpan(0, 0, 0, 1)}
|
||||
@@ -29,7 +50,7 @@
|
||||
'启动参数
|
||||
Dim _unused = PageInstanceLeft.Instance.PathIndie '触发自动判定
|
||||
ComboArgumentIndieV2.SelectedIndex = If(Settings.Get(Of Boolean)("VersionArgumentIndieV2", Instance:=PageInstanceLeft.Instance), 0, 1)
|
||||
RefreshJavaComboBox()
|
||||
UpdateJavaList()
|
||||
|
||||
'服务器
|
||||
ComboServerLogin.SelectedIndex = Settings.Get(Of Integer)("VersionServerLogin", Instance:=PageInstanceLeft.Instance)
|
||||
@@ -62,8 +83,8 @@
|
||||
Settings.Reset("VersionServerLogin", Instance:=PageInstanceLeft.Instance)
|
||||
Settings.Reset("VersionArgumentIndieV2", Instance:=PageInstanceLeft.Instance)
|
||||
Settings.Reset("VersionAdvanceAssets", Instance:=PageInstanceLeft.Instance)
|
||||
Settings.Reset("VersionArgumentJavaSelect", Instance:=PageInstanceLeft.Instance)
|
||||
JavaSearchLoader.Start(IsForceRestart:=True)
|
||||
Configs.InstanceForcedJava.Reset(PageInstanceLeft.Instance.Config)
|
||||
JavaListRefreshWorker.Start()
|
||||
|
||||
Logger.Info("已初始化版本独立设置")
|
||||
Hint("已初始化版本独立设置!", HintType.Green, False)
|
||||
@@ -113,7 +134,6 @@
|
||||
If(RamGame <> RamGameActual, " (可用 " & If(RamGameActual = Math.Floor(RamGameActual), RamGameActual & ".0", RamGameActual) & " GB)", "")
|
||||
LabRamUsed.Text = If(RamUsed = Math.Floor(RamUsed), RamUsed & ".0", RamUsed) & " GB"
|
||||
LabRamTotal.Text = " / " & If(RamTotal = Math.Floor(RamTotal), RamTotal & ".0", RamTotal) & " GB"
|
||||
LabRamWarn.Visibility = If(RamGame = 1 AndAlso Not JavaIs64Bit(PageInstanceLeft.Instance) AndAlso Not Is32BitSystem AndAlso JavaList.Any, Visibility.Visible, Visibility.Collapsed)
|
||||
If ShowAnim Then
|
||||
'宽度动画
|
||||
AniStart({
|
||||
@@ -217,10 +237,10 @@
|
||||
''' <summary>
|
||||
''' 获取当前设置的 RAM 值。单位为 GB。
|
||||
''' </summary>
|
||||
Public Shared Function GetRam(Instance As McInstance, Optional Is32BitJava As Boolean? = Nothing) As Double
|
||||
Public Shared Function GetRam(Instance As McInstance) As Double
|
||||
'跟随全局设置
|
||||
If Settings.Get(Of Integer)("VersionRamType", Instance:=Instance) = 2 Then
|
||||
Return PageSetupLaunch.GetRam(Instance, True, Is32BitJava)
|
||||
Return PageSetupLaunch.GetRam(Instance, True)
|
||||
End If
|
||||
|
||||
'------------------------------------------
|
||||
@@ -296,8 +316,6 @@ PreFin:
|
||||
RamGive = (Value - 33) * 2 + 16
|
||||
End If
|
||||
End If
|
||||
'若使用 32 位 Java,则限制为 1G
|
||||
If If(Is32BitJava, Not JavaIs64Bit(PageInstanceLeft.Instance)) Then RamGive = Math.Min(1, RamGive)
|
||||
Return RamGive
|
||||
End Function
|
||||
|
||||
@@ -366,81 +384,154 @@ PreFin:
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Java 选择"
|
||||
#Region "Java 主类别和预览"
|
||||
|
||||
'刷新 Java 下拉框显示
|
||||
Public Sub RefreshJavaComboBox()
|
||||
If ComboArgumentJava Is Nothing Then Return
|
||||
'初始化列表
|
||||
ComboArgumentJava.Items.Clear()
|
||||
ComboArgumentJava.Items.Add(New MyComboBoxItem With {.Content = "跟随全局设置", .Tag = "使用全局设置"})
|
||||
ComboArgumentJava.Items.Add(New MyComboBoxItem With {.Content = "自动选择(推荐)", .Tag = "自动选择"})
|
||||
'更新列表
|
||||
Dim SelectedItem As MyComboBoxItem = Nothing
|
||||
Dim SelectedBySetup As String = Settings.Get(Of String)("VersionArgumentJavaSelect", Instance:=PageInstanceLeft.Instance)
|
||||
Try
|
||||
For Each Java In JavaList.ToList().OrderByDescending(Function(v) v.MajorVersion)
|
||||
Dim ListItem = New MyComboBoxItem With {.Content = Java.ToString, .ToolTip = Java.PathFolder, .Tag = Java}
|
||||
ToolTipService.SetHorizontalOffset(ListItem, 400)
|
||||
ComboArgumentJava.Items.Add(ListItem)
|
||||
'判断人为选中
|
||||
If SelectedBySetup = "" OrElse SelectedBySetup = "使用全局设置" Then Continue For
|
||||
If JavaEntry.FromJson(GetJson(SelectedBySetup)).PathFolder = Java.PathFolder Then SelectedItem = ListItem
|
||||
Next
|
||||
Catch ex As Exception
|
||||
Settings.Set("VersionArgumentJavaSelect", "使用全局设置", Instance:=PageInstanceLeft.Instance)
|
||||
Logger.Error(ex, "更新版本设置 Java 下拉框失败")
|
||||
End Try
|
||||
'更新选择项
|
||||
If SelectedItem Is Nothing AndAlso JavaList.Any Then
|
||||
If SelectedBySetup = "" Then
|
||||
SelectedItem = ComboArgumentJava.Items(1) '选中 “自动选择”
|
||||
Else
|
||||
SelectedItem = ComboArgumentJava.Items(0) '选中 “跟随全局设置”
|
||||
End If
|
||||
End If
|
||||
ComboArgumentJava.SelectedItem = SelectedItem
|
||||
'结束处理
|
||||
If SelectedItem Is Nothing Then
|
||||
ComboArgumentJava.Items.Clear()
|
||||
ComboArgumentJava.Items.Add(New ComboBoxItem With {.Content = "未找到可用的 Java", .IsSelected = True})
|
||||
End If
|
||||
RefreshRam(True)
|
||||
End Sub
|
||||
'阻止在特定情况下展开下拉框
|
||||
Private Sub ComboArgumentJava_DropDownOpened(sender As Object, e As EventArgs) Handles ComboArgumentJava.DropDownOpened
|
||||
If ComboArgumentJava.SelectedItem Is Nothing OrElse ComboArgumentJava.Items(0).Content = "未找到可用的 Java" OrElse ComboArgumentJava.Items(0).Content = "加载中……" Then
|
||||
ComboArgumentJava.IsDropDownOpen = False
|
||||
End If
|
||||
Private Sub ReloadCurrentJava() Handles ComboArgumentJava.SelectionChanged, TextArgumentJavaRange.ValidatedTextChanged
|
||||
PageInstanceLeft.ReloadCurrentJava()
|
||||
End Sub
|
||||
|
||||
'下拉框选择更改
|
||||
Private Sub JavaSelectionUpdate() Handles ComboArgumentJava.SelectionChanged
|
||||
If AniControlEnabled <> 0 Then Return
|
||||
'Java 不可用时也不清空,会导致刷新时找不到对象
|
||||
If ComboArgumentJava.SelectedItem Is Nothing OrElse ComboArgumentJava.SelectedItem.Tag Is Nothing Then Return
|
||||
'设置新的 Java
|
||||
Dim SelectedJava = ComboArgumentJava.SelectedItem.Tag
|
||||
If "使用全局设置".Equals(SelectedJava) Then
|
||||
'选择 “自动”
|
||||
Settings.Set("VersionArgumentJavaSelect", "使用全局设置", Instance:=PageInstanceLeft.Instance)
|
||||
Logger.Info("修改版本 Java 选择设置:跟随全局设置")
|
||||
ElseIf "自动选择".Equals(SelectedJava) Then
|
||||
'选择 “自动”
|
||||
Settings.Set("VersionArgumentJavaSelect", "", Instance:=PageInstanceLeft.Instance)
|
||||
Logger.Info("修改版本 Java 选择设置:自动选择")
|
||||
Else
|
||||
'选择指定项
|
||||
Settings.Set("VersionArgumentJavaSelect", CType(SelectedJava.ToJson(), JObject).ToString(Newtonsoft.Json.Formatting.None), Instance:=PageInstanceLeft.Instance)
|
||||
Logger.Info($"修改版本 Java 选择设置:{SelectedJava}")
|
||||
End If
|
||||
RefreshRam(True)
|
||||
Private Sub UpdateJavaRelatedUi() Handles ComboArgumentJava.SelectionChanged, TextArgumentJavaRange.TextChanged
|
||||
RunInUi(AddressOf _UpdateJavaRelatedUi)
|
||||
End Sub
|
||||
Private Sub _UpdateJavaRelatedUi()
|
||||
Dim JavaWorker = PageInstanceLeft.CurrentJavaWorker
|
||||
Select Case ComboArgumentJava.SelectedIndex
|
||||
Case 0, 2
|
||||
HintArgumentJava.Visibility = Visibility.Visible
|
||||
TextArgumentJavaRange.Visibility = Visibility.Collapsed
|
||||
PanArgumentJavaSelect.Visibility = Visibility.Collapsed
|
||||
'显示当前会选择的 Java
|
||||
If Not JavaWorker.LastSucceeded OrElse JavaWorker.Running Then
|
||||
If Not JavaWorker.Running Then JavaWorker.Start()
|
||||
HintArgumentJava.Text = $"正在查找 Java……"
|
||||
HintArgumentJava.Theme = MyHint.Themes.Blue
|
||||
ElseIf JavaWorker.LastResult Is Nothing Then
|
||||
If ComboArgumentJava.SelectedIndex = 0 Then
|
||||
HintArgumentJava.Text = $"你的电脑上没有可供该版本使用的 Java,PCL 会在启动游戏时自动下载。"
|
||||
HintArgumentJava.Theme = MyHint.Themes.Yellow
|
||||
Else
|
||||
HintArgumentJava.Text = $"该版本的版本文件夹中没有发现任何 Java!{vbCrLf}请点击此处打开版本文件夹,然后将 Java 文件夹复制进去。"
|
||||
HintArgumentJava.Theme = MyHint.Themes.Red
|
||||
End If
|
||||
Else
|
||||
HintArgumentJava.Text = $"将会使用:{JavaWorker.LastResult}"
|
||||
HintArgumentJava.Theme = MyHint.Themes.Blue
|
||||
End If
|
||||
Case 1
|
||||
HintArgumentJava.Visibility = Visibility.Visible
|
||||
TextArgumentJavaRange.Visibility = Visibility.Visible
|
||||
PanArgumentJavaSelect.Visibility = Visibility.Collapsed
|
||||
'首次设置
|
||||
If Not Settings.HasSaved("VersionArgumentJavaRange", PageInstanceLeft.Instance) Then
|
||||
Dim DefaultRange As String = GetJavaRequirement(PageInstanceLeft.Instance).Range.ToString.Replace("-∞", "").Replace("+∞", "")
|
||||
Settings.Set("VersionArgumentJavaRange", DefaultRange, PageInstanceLeft.Instance)
|
||||
TextArgumentJavaRange.Text = DefaultRange
|
||||
End If
|
||||
'输入的范围有误
|
||||
If Not String.IsNullOrEmpty(TextArgumentJavaRange.ValidateResult) Then
|
||||
HintArgumentJava.Text = $"Java 版本范围错误:{TextArgumentJavaRange.ValidateResult}"
|
||||
HintArgumentJava.Theme = MyHint.Themes.Red
|
||||
Return
|
||||
End If
|
||||
'显示当前会选择的 Java
|
||||
If Not JavaWorker.LastSucceeded OrElse JavaWorker.Running Then
|
||||
If Not JavaWorker.Running Then JavaWorker.Start()
|
||||
HintArgumentJava.Text = $"正在查找 Java……"
|
||||
HintArgumentJava.Theme = MyHint.Themes.Blue
|
||||
ElseIf JavaWorker.LastResult Is Nothing Then
|
||||
HintArgumentJava.Text = $"你的电脑上没有任何 Java 符合该版本范围!{vbCrLf}如果 Mojang 提供了对应版本的 Java,PCL 会在启动游戏时自动下载。"
|
||||
HintArgumentJava.Theme = MyHint.Themes.Yellow
|
||||
Else
|
||||
HintArgumentJava.Text = $"将会使用:{JavaWorker.LastResult}"
|
||||
HintArgumentJava.Theme = MyHint.Themes.Blue
|
||||
End If
|
||||
Case 3
|
||||
HintArgumentJava.Visibility = Visibility.Collapsed
|
||||
TextArgumentJavaRange.Visibility = Visibility.Collapsed
|
||||
PanArgumentJavaSelect.Visibility = Visibility.Visible
|
||||
End Select
|
||||
End Sub
|
||||
Private Sub HintArgumentJava_Click(sender As Object, e As MouseButtonEventArgs) Handles HintArgumentJava.Click
|
||||
If ComboArgumentJava.SelectedIndex = 2 Then PageInstanceOverall.OpenInstanceFolder(PageInstanceLeft.Instance)
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "版本隔离"
|
||||
#Region "选择特定 Java 的下拉框"
|
||||
'注意:修改此处代码时需要同时修改 PageSetupLaunch.xaml.vb
|
||||
|
||||
'刷新 Java 下拉框显示
|
||||
Public Sub UpdateJavaList()
|
||||
If ComboArgumentJavaSelect Is Nothing OrElse LabArgumentJava Is Nothing OrElse Not ComboArgumentJavaSelect.IsLoaded Then Return
|
||||
ComboArgumentJavaSelect.Items.Clear()
|
||||
'还需要等待搜索结束
|
||||
If JavaListRefreshWorker.Running Then
|
||||
BtnArgumentJavaSearch.IsEnabled = False
|
||||
ComboArgumentJavaSelect.IsEnabled = False
|
||||
LabArgumentJava.Text = "搜索中 …"
|
||||
Return
|
||||
End If
|
||||
'========================================== 显示结果 ==========================================
|
||||
BtnArgumentJavaSearch.IsEnabled = True
|
||||
ComboArgumentJavaSelect.IsEnabled = True
|
||||
Dim SelectedJava As Java = Configs.InstanceForcedJava.Get(PageInstanceLeft.Instance.Config)
|
||||
'更新下拉框文本
|
||||
If Not Configs.JavaList.Get().Any() Then
|
||||
LabArgumentJava.Text = "未找到 Java,点击以导入已有的 Java"
|
||||
ElseIf SelectedJava Is Nothing Then
|
||||
LabArgumentJava.Text = "点击选择 Java …"
|
||||
Else
|
||||
LabArgumentJava.Text = SelectedJava.ToString
|
||||
End If
|
||||
'更新列表
|
||||
Try
|
||||
For Each JavaEntry In Configs.JavaList.Get()
|
||||
Dim JavaItem As New MyListItem With {
|
||||
.FontSize = 13, .Height = 24, .IsScaleAnimationEnabled = False, .Type = MyListItem.CheckType.Clickable,
|
||||
.Tag = JavaEntry, .Title = JavaEntry.ToString}
|
||||
AddHandler JavaItem.MouseLeftButtonUp, Sub(sender As Object, e As MouseButtonEventArgs) e.Handled = True
|
||||
AddHandler JavaItem.Click,
|
||||
Sub()
|
||||
Configs.InstanceForcedJava.Set(JavaEntry, PageInstanceLeft.Instance.Config)
|
||||
UpdateJavaList()
|
||||
ComboArgumentJavaSelect.IsDropDownOpen = False
|
||||
End Sub
|
||||
ComboArgumentJavaSelect.Items.Add(JavaItem)
|
||||
Dim Buttons As New List(Of MyIconButton)
|
||||
'从列表中移除按钮
|
||||
Dim IsOfficial As Boolean = JavaEntry.Folder.StartsWithF($"{Paths.AppData}.minecraft\runtime\")
|
||||
Dim DeleteButton As New MyIconButton With {.Logo = Logo.IconButtonStop, .Height = 24, .Width = 24}
|
||||
DeleteButton.IsEnabled = Not IsOfficial
|
||||
DeleteButton.ToolTip = If(DeleteButton.IsEnabled, "从列表中移除", "无法移除官方 Java")
|
||||
AddHandler DeleteButton.Click, Sub() ManuallyRemoveJava(JavaEntry)
|
||||
ToolTipService.SetShowOnDisabled(DeleteButton, True)
|
||||
Buttons.Add(DeleteButton)
|
||||
'打开文件夹按钮
|
||||
Dim OpenButton As New MyIconButton With {.Logo = Logo.IconButtonOpen, .LogoScale = 1.1, .Height = 24, .Width = 24}
|
||||
OpenButton.ToolTip = "打开文件夹"
|
||||
AddHandler OpenButton.Click, Sub() OpenExplorer(JavaEntry.JavaExePath)
|
||||
Buttons.Add(OpenButton)
|
||||
JavaItem.Buttons = Buttons
|
||||
Next
|
||||
Dim ImportItem As New MyListItem With {
|
||||
.FontSize = 13, .Height = 24, .IsScaleAnimationEnabled = False, .Title = " 导入电脑中已有的 Java…", .Type = MyListItem.CheckType.Clickable}
|
||||
AddHandler ImportItem.MouseLeftButtonUp,
|
||||
Sub(sender As Object, e As MouseButtonEventArgs)
|
||||
e.Handled = True
|
||||
ManuallyImportJava()
|
||||
End Sub
|
||||
ComboArgumentJavaSelect.Items.Add(ImportItem)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, "更新 Java 下拉框失败")
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub BtnAdvanceJavaSearch_Click() Handles BtnArgumentJavaSearch.Click
|
||||
ManuallySearchJava()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
'版本隔离
|
||||
Private Sub ComboArgumentIndieV2_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles ComboArgumentIndieV2.SelectionChanged
|
||||
If AniControlEnabled <> 0 Then Return
|
||||
Static IsReverting As Boolean = False
|
||||
@@ -450,23 +541,18 @@ PreFin:
|
||||
"如果你不会迁移存档,不建议修改这项设置!",
|
||||
"警告", "我知道我在做什么", "取消", IsWarn:=True) = 2 Then
|
||||
IsReverting = True
|
||||
ComboArgumentIndieV2.SelectedItem = e.RemovedItems(0)
|
||||
If e.RemovedItems.Count > 0 Then ComboArgumentIndieV2.SelectedItem = e.RemovedItems(0)
|
||||
IsReverting = False
|
||||
End If
|
||||
'实际应用设置
|
||||
Settings.Set("VersionArgumentIndieV2", sender.SelectedIndex = 0, Instance:=PageInstanceLeft.Instance)
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "高级设置"
|
||||
|
||||
'启动前执行命令
|
||||
Private Sub TextAdvanceRun_TextChanged(sender As Object, e As TextChangedEventArgs) Handles TextAdvanceRun.TextChanged
|
||||
CheckAdvanceRunWait.Visibility = If(TextAdvanceRun.Text = "", Visibility.Collapsed, Visibility.Visible)
|
||||
CheckAdvanceRunWait.Visibility = (TextAdvanceRun.Text <> "").ToVisibility
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
'切换到全局设置
|
||||
Private Sub BtnSwitch_Click(sender As Object, e As MouseButtonEventArgs) Handles BtnSwitch.Click
|
||||
FrmMain.PageChange(FormMain.PageType.Setup, FormMain.PageSubType.SetupLaunch)
|
||||
@@ -480,4 +566,5 @@ PreFin:
|
||||
sender.Text = NewText
|
||||
sender.CaretIndex = Math.Max(0, CaretIndex - 1)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Grid x:Class="MyMsgLogin"
|
||||
<Grid x:Class="MyMsgLogin"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class MyMsgLogin
|
||||
Public Class MyMsgLogin
|
||||
Private Data As JObject
|
||||
Private UserCode As String '需要用户在网页上输入的设备代码
|
||||
Private DeviceCode As String '用于轮询的设备代码
|
||||
@@ -60,7 +60,7 @@
|
||||
Public Sub Btn1_Click() Handles Btn1.Click
|
||||
End Sub
|
||||
Public Sub Btn3_Click() Handles Btn3.Click
|
||||
Finished(New ThreadInterruptedException)
|
||||
Finished(New OperationCanceledException)
|
||||
End Sub
|
||||
|
||||
Private Sub Drag(sender As Object, e As MouseButtonEventArgs) Handles PanBorder.MouseLeftButtonDown, LabTitle.MouseLeftButtonDown
|
||||
@@ -116,7 +116,7 @@
|
||||
Timeout:=5000 + UnknownFailureCount * 5000,
|
||||
MakeLog:=False, RequireJson:=True)
|
||||
'获取结果
|
||||
Dim ResultJson As JObject = GetJson(Result)
|
||||
Dim ResultJson As JObject = Result.DeserializeJson()
|
||||
McLaunchLog($"令牌过期时间:{ResultJson("expires_in")} 秒")
|
||||
Hint("网页登录成功!", HintType.Green)
|
||||
Finished({ResultJson("access_token").ToString, ResultJson("refresh_token").ToString})
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<Grid x:Class="MySkin"
|
||||
<Grid x:Class="MySkin"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL"
|
||||
Height="64" Width="64" UseLayoutRounding="True" RenderTransformOrigin="0.5,0.5" Background="{StaticResource ColorBrushSemiTransparent}"
|
||||
ToolTipService.Placement="Center" ToolTipService.VerticalOffset="-50" ToolTipService.HorizontalOffset="2" ToolTipService.InitialShowDelay="100">
|
||||
Height="64" Width="64" UseLayoutRounding="True" RenderTransformOrigin="0.5,0.5" Background="{StaticResource ColorBrushSemiTransparent}" ToolTipService.InitialShowDelay="100">
|
||||
<Grid.Effect>
|
||||
<DropShadowEffect x:Name="ShadowSkin" BlurRadius="10" ShadowDepth="0" Color="{DynamicResource ColorObject2}" Opacity="0.2" />
|
||||
</Grid.Effect>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class MySkin
|
||||
Public Class MySkin
|
||||
|
||||
'事件
|
||||
Public Event Click(sender As Object, e As MouseButtonEventArgs)
|
||||
@@ -143,7 +143,7 @@
|
||||
End If
|
||||
Next
|
||||
If FrmLaunchLeft IsNot Nothing AndAlso HasLoaderRunning Then
|
||||
'由于 Interrupt 不是实时的,暂时不会释放文件,会导致删除报错,故只能取消执行
|
||||
'由于取消不是实时的,暂时不会释放文件,会导致删除报错,故只能取消执行
|
||||
Hint("有正在获取中的皮肤,请稍后再试!", HintType.Blue)
|
||||
Else
|
||||
RunInThread(
|
||||
@@ -231,7 +231,7 @@ Retry:
|
||||
End If
|
||||
Dim AccessToken As String = McLoginMsLoader.Output.AccessToken
|
||||
Dim Uuid As String = McLoginMsLoader.Output.Uuid
|
||||
Dim SkinData As JObject = GetJson(McLoginMsLoader.Output.ProfileJson)
|
||||
Dim SkinData As JObject = McLoginMsLoader.Output.ProfileJson.DeserializeJson()
|
||||
'获取玩家的所有披风
|
||||
Dim SelectedIndex As Integer? = Nothing
|
||||
RunInUiWait(
|
||||
@@ -267,7 +267,7 @@ Retry:
|
||||
ContentType:="application/json",
|
||||
Headers:={{"Authorization", "Bearer " & AccessToken}})
|
||||
If Result.Contains("""errorMessage""") Then
|
||||
Hint("更改披风失败:" & GetJson(Result)("errorMessage").ToString, HintType.Red)
|
||||
Hint("更改披风失败:" & Result.DeserializeJson()("errorMessage").ToString, HintType.Red)
|
||||
Return
|
||||
Else
|
||||
Hint("更改披风成功!", HintType.Green)
|
||||
@@ -286,10 +286,10 @@ Retry:
|
||||
Case HttpStatusCode.BadRequest
|
||||
Logger.Warn(ex, "更改披风时遭遇 400 错误")
|
||||
If requestException.Response?.Contains("""error""") Then
|
||||
Hint("更改披风失败:" & GetJson(requestException.Response)("error").ToString, HintType.Red)
|
||||
Hint("更改披风失败:" & requestException.Response.DeserializeJson()("error").ToString, HintType.Red)
|
||||
Return
|
||||
ElseIf requestException.Response?.Contains("""errorMessage""") Then
|
||||
Hint("更改披风失败:" & GetJson(requestException.Response)("errorMessage").ToString, HintType.Red)
|
||||
Hint("更改披风失败:" & requestException.Response.DeserializeJson()("errorMessage").ToString, HintType.Red)
|
||||
Return
|
||||
End If
|
||||
Case HttpStatusCode.Unauthorized
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageLeft x:Class="PageLaunchLeft"
|
||||
<local:MyPageLeft x:Class="PageLaunchLeft"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
Public Class PageLaunchLeft
|
||||
Imports System.Windows.Threading
|
||||
|
||||
Public Class PageLaunchLeft
|
||||
|
||||
'加载当前版本
|
||||
Private IsLoad As Boolean = False
|
||||
@@ -23,8 +25,8 @@
|
||||
Sub()
|
||||
'自动整合包安装:准备
|
||||
Dim PackInstallPath As String = Nothing
|
||||
If FileUtils.Exists(PathExeFolder & "modpack.zip") Then PackInstallPath = PathExeFolder & "modpack.zip"
|
||||
If FileUtils.Exists(PathExeFolder & "modpack.mrpack") Then PackInstallPath = PathExeFolder & "modpack.mrpack"
|
||||
If FileUtils.Exists(Paths.Base & "modpack.zip") Then PackInstallPath = Paths.Base & "modpack.zip"
|
||||
If FileUtils.Exists(Paths.Base & "modpack.mrpack") Then PackInstallPath = Paths.Base & "modpack.mrpack"
|
||||
If PackInstallPath IsNot Nothing Then
|
||||
Logger.Warn($"需自动安装整合包:{PackInstallPath}")
|
||||
PageSelectLeft.CreateMcFolderInCurrentPath()
|
||||
@@ -52,10 +54,12 @@
|
||||
Logger.Info($"自动安装整合包成功,清理安装包:{PackInstallPath}")
|
||||
FileUtils.Delete(PackInstallPath)
|
||||
End If
|
||||
Catch ex As CancelledException
|
||||
Logger.Warn(ex, $"自动安装整合包被用户取消:{PackInstallPath}")
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, $"自动安装整合包失败:{PackInstallPath}", LogBehavior.Alert)
|
||||
If ex.IsCanceled Then
|
||||
Logger.Info($"自动安装整合包已取消:{PackInstallPath}")
|
||||
Else
|
||||
Logger.Error(ex, $"自动安装整合包失败:{PackInstallPath}", LogBehavior.Alert)
|
||||
End If
|
||||
End Try
|
||||
End If
|
||||
'确认 Minecraft 版本存在
|
||||
@@ -80,7 +84,26 @@
|
||||
RefreshButtonsUI()
|
||||
RefreshPage(False, False) '有可能选择的版本变化了,需要重新刷新
|
||||
If McLoginAble() = "" Then McLoginLoader.Start() '自动登录
|
||||
If Environment.CommandLine.Contains("--test") Then FormMain.EndProgramForce(123) '用于更新器测试生成的程序是否可以正常运行
|
||||
'用于自动化测试生成的程序是否可以正常运行
|
||||
If Environment.CommandLine.Contains("--test") Then
|
||||
RunInThread(
|
||||
Sub()
|
||||
Thread.Sleep(500)
|
||||
RunInUi(Sub() FrmMain.PageChange(FormMain.PageType.Download))
|
||||
Thread.Sleep(500)
|
||||
RunInUi(Sub() FrmMain.PageChange(FormMain.PageType.Download, FormMain.PageSubType.DownloadMod))
|
||||
Thread.Sleep(500)
|
||||
RunInUi(Sub() FrmMain.PageChange(FormMain.PageType.Setup))
|
||||
Thread.Sleep(500)
|
||||
RunInUi(Sub() FrmMain.PageChange(FormMain.PageType.Other))
|
||||
Thread.Sleep(500)
|
||||
RunInUi(Sub() BtnVersion_Click())
|
||||
Thread.Sleep(500)
|
||||
RunInUi(Sub() BtnMore_Click())
|
||||
Thread.Sleep(500)
|
||||
FormMain.EndProgramForce(123)
|
||||
End Sub)
|
||||
End If
|
||||
End Sub)
|
||||
End Sub, "Version Check", ThreadPriority.AboveNormal)
|
||||
|
||||
@@ -244,7 +267,7 @@
|
||||
End Sub, 100),
|
||||
AaOpacity(PanLogin, 1, 100, 120, New AniEaseInFluent)
|
||||
}, "FrmLogin PageChange")
|
||||
End Sub, Threading.DispatcherPriority.Render)
|
||||
End Sub, DispatcherPriority.Render)
|
||||
Else
|
||||
'无动画
|
||||
AniControlEnabled += 1
|
||||
@@ -375,15 +398,15 @@ UnknownType:
|
||||
End If
|
||||
Try
|
||||
Dim Result As String = McSkinGetAddress(Uuid, "Ms")
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
If Data.IsCanceled Then Throw New OperationCanceledException("当前任务已取消:" & UserName)
|
||||
Result = McSkinDownload(Result)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
If Data.IsCanceled Then Throw New OperationCanceledException("当前任务已取消:" & UserName)
|
||||
Data.Output = Result
|
||||
Catch ex As ThreadInterruptedException
|
||||
Data.Output = ""
|
||||
Return
|
||||
Catch ex As Exception
|
||||
If ex.GetDisplay(False).Contains("(429)") Then
|
||||
If ex.IsCanceled Then
|
||||
Data.Output = ""
|
||||
Return
|
||||
ElseIf ex.GetDisplay(False).Contains("(429)") Then
|
||||
Data.Output = PathImage & "Skins/" & McSkinSex(McLoginLegacyUuid(UserName)) & ".png"
|
||||
Logger.Error($"获取正版皮肤失败({UserName}):获取皮肤太过频繁,请 5 分钟后再试!", LogBehavior.Toast)
|
||||
ElseIf ex.GetDisplay(False).Contains("未设置自定义皮肤") Then
|
||||
@@ -398,7 +421,7 @@ Finish:
|
||||
'刷新显示
|
||||
If FrmLoginMsSkin IsNot Nothing Then
|
||||
RunInUi(AddressOf FrmLoginMsSkin.Skin.Load)
|
||||
ElseIf Not Data.IsInterrupted Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
ElseIf Not Data.IsCanceled Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
Data.Input = Nothing '清空输入,因为皮肤实际上没有被渲染,如果不清空切换到页面的 Start 会由于输入相同而不渲染
|
||||
End If
|
||||
End Sub
|
||||
@@ -442,18 +465,18 @@ UseDefault:
|
||||
Data.Output = PathImage & "Skins/Steve.png"
|
||||
Else
|
||||
Dim Result As String = McLoginMojangUuid(ID, True)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & ID)
|
||||
If Data.IsCanceled Then Throw New OperationCanceledException("当前任务已取消:" & ID)
|
||||
Result = McSkinGetAddress(Result, "Mojang")
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & ID)
|
||||
If Data.IsCanceled Then Throw New OperationCanceledException("当前任务已取消:" & ID)
|
||||
Result = McSkinDownload(Result)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & ID)
|
||||
If Data.IsCanceled Then Throw New OperationCanceledException("当前任务已取消:" & ID)
|
||||
Data.Output = Result
|
||||
End If
|
||||
Catch ex As ThreadInterruptedException
|
||||
Data.Output = ""
|
||||
Return
|
||||
Catch ex As Exception
|
||||
If ex.GetDisplay(False).Contains("(429)") Then
|
||||
If ex.IsCanceled Then
|
||||
Data.Output = ""
|
||||
Return
|
||||
ElseIf ex.GetDisplay(False).Contains("(429)") Then
|
||||
Data.Output = PathImage & "Skins/" & McSkinSex(McLoginLegacyUuid(ID)) & ".png"
|
||||
Logger.Info($"获取离线登录使用的正版皮肤失败({ID}):获取皮肤太过频繁,请 5 分钟后再试!")
|
||||
Else
|
||||
@@ -462,17 +485,17 @@ UseDefault:
|
||||
End If
|
||||
End Try
|
||||
Case 4 '自定义
|
||||
If Not FileUtils.Exists(PathAppdata & "CustomSkin.png") Then
|
||||
If Not FileUtils.Exists(Paths.AppDataThenName & "CustomSkin.png") Then
|
||||
Hint("未找到离线皮肤自定义文件,可能它已被删除。PCL 将使用默认的 Steve 皮肤!")
|
||||
Settings.Set("LaunchSkinType", 1)
|
||||
GoTo UseDefault
|
||||
End If
|
||||
Data.Output = PathAppdata & "CustomSkin.png"
|
||||
Data.Output = Paths.AppDataThenName & "CustomSkin.png"
|
||||
End Select
|
||||
'刷新显示
|
||||
If FrmLoginLegacy IsNot Nothing Then
|
||||
RunInUi(AddressOf FrmLoginLegacy.Skin.Load)
|
||||
ElseIf Not Data.IsInterrupted Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
ElseIf Not Data.IsCanceled Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
Data.Input = Nothing '清空输入,因为皮肤实际上没有被渲染,如果不清空切换到页面的 Start 会由于输入相同而不渲染
|
||||
End If
|
||||
End Sub
|
||||
@@ -497,15 +520,15 @@ UseDefault:
|
||||
End If
|
||||
Try
|
||||
Dim Result As String = McSkinGetAddress(Uuid, "Nide")
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
If Data.IsCanceled Then Throw New OperationCanceledException("当前任务已取消:" & UserName)
|
||||
Result = McSkinDownload(Result)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
If Data.IsCanceled Then Throw New OperationCanceledException("当前任务已取消:" & UserName)
|
||||
Data.Output = Result
|
||||
Catch ex As ThreadInterruptedException
|
||||
Data.Output = ""
|
||||
Return
|
||||
Catch ex As Exception
|
||||
If ex.GetDisplay(False).Contains("(429)") Then
|
||||
If ex.IsCanceled Then
|
||||
Data.Output = ""
|
||||
Return
|
||||
ElseIf ex.GetDisplay(False).Contains("(429)") Then
|
||||
Data.Output = PathImage & "Skins/Steve.png"
|
||||
Logger.Error($"获取统一通行证皮肤失败({UserName}):获取皮肤太过频繁,请 5 分钟后再试!", LogBehavior.Toast)
|
||||
ElseIf ex.GetDisplay(False).Contains("未设置自定义皮肤") Then
|
||||
@@ -520,7 +543,7 @@ Finish:
|
||||
'刷新显示
|
||||
If FrmLoginNideSkin IsNot Nothing Then
|
||||
RunInUi(AddressOf FrmLoginNideSkin.Skin.Load)
|
||||
ElseIf Not Data.IsInterrupted Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
ElseIf Not Data.IsCanceled Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
Data.Input = Nothing '清空输入,因为皮肤实际上没有被渲染,如果不清空切换到页面的 Start 会由于输入相同而不渲染
|
||||
End If
|
||||
End Sub
|
||||
@@ -545,15 +568,15 @@ Finish:
|
||||
End If
|
||||
Try
|
||||
Dim Result As String = McSkinGetAddress(UUID, "Auth")
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
If Data.IsCanceled Then Throw New OperationCanceledException("当前任务已取消:" & UserName)
|
||||
Result = McSkinDownload(Result)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
If Data.IsCanceled Then Throw New OperationCanceledException("当前任务已取消:" & UserName)
|
||||
Data.Output = Result
|
||||
Catch ex As ThreadInterruptedException
|
||||
Data.Output = ""
|
||||
Return
|
||||
Catch ex As Exception
|
||||
If ex.GetDisplay(False).Contains("(429)") Then
|
||||
If ex.IsCanceled Then
|
||||
Data.Output = ""
|
||||
Return
|
||||
ElseIf ex.GetDisplay(False).Contains("(429)") Then
|
||||
Data.Output = PathImage & "Skins/Steve.png"
|
||||
Logger.Error($"获取 Authlib-Injector 皮肤失败({UserName}):获取皮肤太过频繁,请 5 分钟后再试!", LogBehavior.Toast)
|
||||
ElseIf ex.GetDisplay(False).Contains("未设置自定义皮肤") Then
|
||||
@@ -568,7 +591,7 @@ Finish:
|
||||
'刷新显示
|
||||
If FrmLoginAuthSkin IsNot Nothing Then
|
||||
RunInUi(AddressOf FrmLoginAuthSkin.Skin.Load)
|
||||
ElseIf Not Data.IsInterrupted Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
ElseIf Not Data.IsCanceled Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
Data.Input = Nothing '清空输入,因为皮肤实际上没有被渲染,如果不清空切换到页面的 Start 会由于输入相同而不渲染
|
||||
End If
|
||||
End Sub
|
||||
@@ -580,19 +603,19 @@ Finish:
|
||||
#End Region
|
||||
|
||||
'版本选择按钮
|
||||
Private Sub BtnVersion_Click(sender As Object, e As EventArgs) Handles BtnVersion.Click
|
||||
Private Sub BtnVersion_Click() Handles BtnVersion.Click
|
||||
If McLaunchLoader.State = LoadState.Loading Then Return
|
||||
FrmMain.PageChange(FormMain.PageType.InstanceSelect)
|
||||
End Sub
|
||||
'启动按钮
|
||||
Public Sub LaunchButtonClick() Handles BtnLaunch.Click
|
||||
If McLaunchLoader.State = LoadState.Loading OrElse Not BtnLaunch.IsEnabled OrElse
|
||||
(FrmMain.PageRight IsNot Nothing AndAlso FrmMain.PageRight.PageState <> MyPageRight.PageStates.ContentStay AndAlso FrmMain.PageRight.PageState <> MyPageRight.PageStates.ContentEnter) Then Return
|
||||
(FrmMain.PageRight IsNot Nothing AndAlso FrmMain.PageRight.PageState <> MyPageRight.PageStates.ContentStay AndAlso FrmMain.PageRight.PageState <> MyPageRight.PageStates.ContentEnter) Then Return
|
||||
'愚人节处理
|
||||
If IsAprilEnabled AndAlso Not IsAprilGiveup Then
|
||||
ThemeUnlock(12, False, "隐藏主题 滑稽彩 已解锁!")
|
||||
IsAprilGiveup = True
|
||||
Settings.Set("AprilDoneYear", Date.Now.Year)
|
||||
Settings.Set("AprilYear", Date.Now.Year)
|
||||
FrmLaunchLeft.AprilScaleTrans.ScaleX = 1
|
||||
FrmLaunchLeft.AprilScaleTrans.ScaleY = 1
|
||||
FrmLaunchLeft.AprilPosTrans.X = 0
|
||||
@@ -670,7 +693,7 @@ ExitRefresh:
|
||||
'取消按钮
|
||||
Private Sub BtnCancel_Click() Handles BtnCancel.Click
|
||||
If McLaunchLoaderReal IsNot Nothing Then
|
||||
McLaunchLoaderReal.Interrupt()
|
||||
McLaunchLoaderReal.Cancel()
|
||||
McLaunchLog("已取消启动")
|
||||
Try
|
||||
If McLaunchWatcher IsNot Nothing Then
|
||||
@@ -684,7 +707,7 @@ ExitRefresh:
|
||||
End If
|
||||
End Sub
|
||||
'版本设置按钮
|
||||
Private Sub BtnMore_Click(sender As Object, e As EventArgs) Handles BtnMore.Click
|
||||
Private Sub BtnMore_Click() Handles BtnMore.Click
|
||||
If McLaunchLoader.State = LoadState.Loading Then Return
|
||||
McInstanceSelected.Load()
|
||||
PageInstanceLeft.Instance = McInstanceSelected
|
||||
@@ -695,7 +718,7 @@ ExitRefresh:
|
||||
''' </summary>
|
||||
Public Sub LaunchingRefresh()
|
||||
Try
|
||||
If McLaunchLoaderReal.State = LoadState.Interrupted Then Return
|
||||
If McLaunchLoaderReal.State = LoadState.Canceled Then Return
|
||||
'阶段状态获取
|
||||
Dim IsLaunched As Boolean = False '是否已经启动游戏,只是在等待窗口
|
||||
Try
|
||||
@@ -736,7 +759,7 @@ ExitRefresh:
|
||||
Logger.Warn(ex, "获取 Minecraft 启动下载器失败,可能是因为启动被取消")
|
||||
HasLaunchDownloader = False
|
||||
End Try
|
||||
LabLaunchingDownload.Text = FormatFileSize(NetManager.Speed) & "/s"
|
||||
LabLaunchingDownload.Text = StringUtils.FormatByteSize(NetManager.Speed) & "/s"
|
||||
'进度改变动画
|
||||
Dim AnimList As New List(Of AniData) From {
|
||||
AaGridLengthWidth(ProgressLaunchingFinished, ShowProgress - ProgressLaunchingFinished.Width.Value, 130,, New AniEaseOutFluent),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight x:Class="PageLaunchRight"
|
||||
<local:MyPageRight x:Class="PageLaunchRight"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Imports System.Windows.Threading
|
||||
Imports System.Windows.Threading
|
||||
|
||||
Public Class PageLaunchRight
|
||||
Implements IRefreshable, IDispatcherUnhandledException
|
||||
@@ -35,7 +35,7 @@ Public Class PageLaunchRight
|
||||
Case 1
|
||||
'加载本地文件
|
||||
Logger.Info("主页自定义数据来源:本地文件")
|
||||
Content = FileUtils.TryReadAsString(PathExeFolder & "PCL\Custom.xaml")
|
||||
Content = FileUtils.TryReadAsString(Paths.Base & "PCL\Custom.xaml")
|
||||
Case 2
|
||||
'联网下载
|
||||
Url = Settings.Get(Of String)("UiCustomNet")
|
||||
@@ -49,7 +49,7 @@ Public Class PageLaunchRight
|
||||
<TextBlock Margin=""25,38,23,15"" FontSize=""13.5"" IsHitTestVisible=""False"" Text=""{hint}"" TextWrapping=""Wrap"" Foreground=""{DynamicResource ColorBrush1}"" />
|
||||
<local:MyIconButton Height=""22"" Width=""22"" Margin=""9"" VerticalAlignment=""Top"" HorizontalAlignment=""Right""
|
||||
EventType=""刷新主页"" EventData=""/""
|
||||
Logo=""M875.52 148.48C783.36 56.32 655.36 0 512 0 291.84 0 107.52 138.24 30.72 332.8l122.88 46.08C204.8 230.4 348.16 128 512 128c107.52 0 199.68 40.96 271.36 112.64L640 384h384V0L875.52 148.48zM512 896c-107.52 0-199.68-40.96-271.36-112.64L384 640H0v384l148.48-148.48C240.64 967.68 368.64 1024 512 1024c220.16 0 404.48-138.24 481.28-332.8L870.4 645.12C819.2 793.6 675.84 896 512 896z"" />
|
||||
Logo=""M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z"" />
|
||||
</local:MyCard>"
|
||||
Case 1
|
||||
Logger.Info("主页预设:回声洞")
|
||||
@@ -58,7 +58,7 @@ Public Class PageLaunchRight
|
||||
<TextBlock Margin=""25,38,23,15"" FontSize=""13.5"" IsHitTestVisible=""False"" Text=""{cave}"" TextWrapping=""Wrap"" Foreground=""{DynamicResource ColorBrush1}"" />
|
||||
<local:MyIconButton Height=""22"" Width=""22"" Margin=""9"" VerticalAlignment=""Top"" HorizontalAlignment=""Right""
|
||||
EventType=""刷新主页"" EventData=""/""
|
||||
Logo=""M875.52 148.48C783.36 56.32 655.36 0 512 0 291.84 0 107.52 138.24 30.72 332.8l122.88 46.08C204.8 230.4 348.16 128 512 128c107.52 0 199.68 40.96 271.36 112.64L640 384h384V0L875.52 148.48zM512 896c-107.52 0-199.68-40.96-271.36-112.64L384 640H0v384l148.48-148.48C240.64 967.68 368.64 1024 512 1024c220.16 0 404.48-138.24 481.28-332.8L870.4 645.12C819.2 793.6 675.84 896 512 896z"" />
|
||||
Logo=""M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z"" />
|
||||
</local:MyCard>"
|
||||
Case 2
|
||||
Logger.Info("主页预设:Minecraft 新闻")
|
||||
@@ -105,6 +105,9 @@ Public Class PageLaunchRight
|
||||
Case 16
|
||||
Logger.Info("主页预设:整合包推荐引擎")
|
||||
Url = "https://qawsedrftgyhujiko.fun/pcl2/Custom.xaml"
|
||||
Case 17
|
||||
Logger.Info("Bangumi 番剧主页")
|
||||
Url = "https://pbp.kaphia.qzz.io"
|
||||
End Select
|
||||
End Select
|
||||
'联网下载
|
||||
@@ -222,7 +225,7 @@ Public Class PageLaunchRight
|
||||
End If
|
||||
Dim LoadStartTime As Date = Date.Now
|
||||
'修改时应同时修改 PageOtherHelpDetail.Init
|
||||
Content = ArgumentReplace(Content, AddressOf EscapeUtils.XmlEscape)
|
||||
Content = ArgumentReplace(Content, AddressOf StringUtils.XmlEscape)
|
||||
Do While Content.Contains("xmlns")
|
||||
Content = Content.RegexReplace("xmlns[^""']*(""|')[^""']*(""|')", "").Replace("xmlns", "") '禁止声明命名空间
|
||||
Loop
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Grid x:Class="PageLoginAuth" Tag="False"
|
||||
<Grid x:Class="PageLoginAuth" Tag="False"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageLoginAuth
|
||||
Public Class PageLoginAuth
|
||||
Private IsFirstLoad As Boolean = True
|
||||
''' <summary>
|
||||
''' 刷新页面显示的所有信息。
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Grid x:Class="PageLoginAuthSkin" Tag="True"
|
||||
<Grid x:Class="PageLoginAuthSkin" Tag="True"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -20,8 +20,8 @@
|
||||
<TextBlock Name="TextName" Text="加载中" Margin="8,0" FontSize="14" HorizontalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Name="TextEmail" Text="加载中" Margin="8,4,8,0" FontSize="12" HorizontalAlignment="Center" TextTrimming="CharacterEllipsis" Foreground="{DynamicResource ColorBrushGray3}" />
|
||||
</StackPanel>
|
||||
<local:MyIconButton ToolTip="更换角色" Grid.Row="1" Height="14" Opacity="0" x:Name="BtnEdit" ToolTipService.Placement="Center" ToolTipService.VerticalOffset="32" ToolTipService.HorizontalOffset="1" ToolTipService.InitialShowDelay="50" Grid.Column="0" HorizontalAlignment="Center" Logo="F1 M 53.2929,21.2929L 54.7071,22.7071C 56.4645,24.4645 56.4645,27.3137 54.7071,29.0711L 52.2323,31.5459L 44.4541,23.7677L 46.9289,21.2929C 48.6863,19.5355 51.5355,19.5355 53.2929,21.2929 Z M 31.7262,52.052L 23.948,44.2738L 43.0399,25.182L 50.818,32.9601L 31.7262,52.052 Z M 23.2409,47.1023L 28.8977,52.7591L 21.0463,54.9537L 23.2409,47.1023 Z" Margin="8,0,0,0" VerticalAlignment="Center" />
|
||||
<local:MyIconButton ToolTip="退出登录" Grid.Row="1" Height="14" Opacity="0" x:Name="BtnExit" ToolTipService.Placement="Center" ToolTipService.VerticalOffset="32" ToolTipService.HorizontalOffset="1" ToolTipService.InitialShowDelay="50" Grid.Column="2" HorizontalAlignment="Center" Logo="F1 M 51.0071,19.0027L 51.0071,27.0038L 48.0067,27.0038L 48.0067,22.0031L 25.0035,22.0031L 25.0035,54.0075L 48.0067,54.0075L 48.0067,49.0068L 51.0071,49.0068L 51.0071,57.008L 22.1698,57.008L 22.0031,19.0027L 51.0071,19.0027 Z M 30.0042,35.0049L 45.2563,35.0049L 37.005,28.0039L 47.0066,28.0039L 58.5082,38.0053L 47.0066,48.0067L 37.005,48.0067L 45.2563,41.0057L 30.0042,41.0057L 30.0042,35.0049 Z" Margin="0,0,8,0" VerticalAlignment="Center" />
|
||||
<local:MyIconButton ToolTip="更换角色" Grid.Row="1" Height="14" Opacity="0" x:Name="BtnEdit" ToolTipService.InitialShowDelay="50" Grid.Column="0" HorizontalAlignment="Center" Logo="F1 M 53.2929,21.2929L 54.7071,22.7071C 56.4645,24.4645 56.4645,27.3137 54.7071,29.0711L 52.2323,31.5459L 44.4541,23.7677L 46.9289,21.2929C 48.6863,19.5355 51.5355,19.5355 53.2929,21.2929 Z M 31.7262,52.052L 23.948,44.2738L 43.0399,25.182L 50.818,32.9601L 31.7262,52.052 Z M 23.2409,47.1023L 28.8977,52.7591L 21.0463,54.9537L 23.2409,47.1023 Z" Margin="8,0,0,0" VerticalAlignment="Center" />
|
||||
<local:MyIconButton ToolTip="退出登录" Grid.Row="1" Height="14" Opacity="0" x:Name="BtnExit" ToolTipService.InitialShowDelay="50" Grid.Column="2" HorizontalAlignment="Center" Logo="F1 M 51.0071,19.0027L 51.0071,27.0038L 48.0067,27.0038L 48.0067,22.0031L 25.0035,22.0031L 25.0035,54.0075L 48.0067,54.0075L 48.0067,49.0068L 51.0071,49.0068L 51.0071,57.008L 22.1698,57.008L 22.0031,19.0027L 51.0071,19.0027 Z M 30.0042,35.0049L 45.2563,35.0049L 37.005,28.0039L 47.0066,28.0039L 58.5082,38.0053L 47.0066,48.0067L 37.005,48.0067L 45.2563,41.0057L 30.0042,41.0057L 30.0042,35.0049 Z" Margin="0,0,8,0" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
<local:MySkin HorizontalAlignment="Center" VerticalAlignment="Top" x:Name="Skin" HasCape="False" />
|
||||
</Grid>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageLoginAuthSkin
|
||||
Public Class PageLoginAuthSkin
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Grid x:Class="PageLoginLegacy" Tag="True"
|
||||
<Grid x:Class="PageLoginLegacy" Tag="True"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Windows.Forms
|
||||
|
||||
Public Class PageLoginLegacy
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<StackPanel x:Class="PageLoginMs" Tag="False" Orientation="Vertical"
|
||||
<StackPanel x:Class="PageLoginMs" Tag="False" Orientation="Vertical"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageLoginMs
|
||||
Public Class PageLoginMs
|
||||
|
||||
''' <summary>
|
||||
''' 刷新页面显示的所有信息。
|
||||
@@ -9,7 +9,7 @@
|
||||
ComboAccounts.Items.Clear()
|
||||
ComboAccounts.Items.Add(New MyComboBoxItem With {.Content = "添加新账号"})
|
||||
Try
|
||||
Dim MsJson As JObject = GetJson(Settings.Get(Of String)("LoginMsJson"))
|
||||
Dim MsJson As JObject = Settings.Get(Of String)("LoginMsJson").DeserializeJson()
|
||||
For Each Account In MsJson
|
||||
Dim Item As MyListItem = CType(FindResource("ComboBoxItemTemplateWithDelete"), DataTemplate).LoadContent()
|
||||
Item.Tag = Account.Value.ToString
|
||||
@@ -78,17 +78,15 @@
|
||||
Loop
|
||||
If McLoginMsLoader.State = LoadState.Finished Then
|
||||
RunInUi(Sub() FrmLaunchLeft.RefreshPage(False, True))
|
||||
ElseIf McLoginMsLoader.State = LoadState.Interrupted Then
|
||||
Throw New ThreadInterruptedException
|
||||
ElseIf McLoginMsLoader.State = LoadState.Canceled Then
|
||||
Throw New OperationCanceledException
|
||||
ElseIf McLoginMsLoader.Error Is Nothing Then
|
||||
Throw New Exception("未知错误!")
|
||||
Else
|
||||
Throw New Exception(McLoginMsLoader.Error.Message, McLoginMsLoader.Error)
|
||||
End If
|
||||
Catch ex As ThreadInterruptedException
|
||||
Hint("已取消登录!")
|
||||
Catch ex As Exception
|
||||
If ex.Message = "$$" Then
|
||||
If ex.IsCanceled Then
|
||||
ElseIf ex.Message.StartsWithF("$") Then
|
||||
Hint(ex.Message.TrimStart("$"), HintType.Red)
|
||||
ElseIf TypeOf ex Is Security.Authentication.AuthenticationException AndAlso ex.Message.Contains("SSL/TLS") Then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Grid x:Class="PageLoginMsSkin" Tag="True"
|
||||
<Grid x:Class="PageLoginMsSkin" Tag="True"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -18,7 +18,7 @@
|
||||
CornerRadius="5" Background="{DynamicResource ColorBrush8}" Padding="10,3,9,3">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<local:MyIconButton Height="24" Margin="0,0.5,9,0" x:Name="BtnSkin"
|
||||
ToolTip="皮肤与披风" ToolTipService.Placement="Center" ToolTipService.VerticalOffset="35" ToolTipService.HorizontalOffset="1" ToolTipService.InitialShowDelay="50"
|
||||
ToolTip="皮肤与披风" ToolTipService.InitialShowDelay="50"
|
||||
LogoScale="1.08" Logo="M764.0003 0.076794a215.433442 215.433442 0 0 0-76.282279 13.950954l-9.06172 3.686123c-49.148314 20.734445-88.518161 30.53851-115.498538 30.53851-27.031573 0-66.478214-9.855261-116.676049-31.050471a217.583681 217.583681 0 0 0-72.186586-16.766743l-9.138515-0.307177-3.839712-0.051196-8.626553 0.307177-4.223683 0.281579A160.755943 160.755943 0 0 0 250.477214 45.385396l-219.32435 212.438467a102.392321 102.392321 0 0 0-11.263156 134.210734l106.360023 144.552359 3.378947 4.351674a102.469115 102.469115 0 0 0 112.810739 31.690423l5.657176-2.175837V883.210559a140.789441 140.789441 0 0 0 140.789441 140.789441h372.170487l5.657175-0.102392a140.789441 140.789441 0 0 0 135.132266-140.687049l-0.025599-318.6705 1.177512 0.716747a102.392321 102.392321 0 0 0 141.941355-44.233483l70.906682-144.39877a102.392321 102.392321 0 0 0-20.657651-118.647101L875.86391 45.385396A160.730345 160.730345 0 0 0 764.0003 0.076794z m-357.349199 111.454041C468.444867 137.615279 520.562558 150.644702 563.157763 150.644702c42.492813 0 94.584906-12.978227 156.199485-38.985876A112.580356 112.580356 0 0 1 764.0003 102.469115c15.154063 0 29.693773 5.887558 40.598555 16.433967L1023.923206 331.495138l-70.906682 144.39877-93.023423-65.684674a38.39712 38.39712 0 0 0-60.53946 31.383247V883.210559a38.39712 38.39712 0 0 1-38.39712 38.39712H388.886034a38.39712 38.39712 0 0 1-38.397121-38.39712V445.176212a38.39712 38.39712 0 0 0-61.691373-30.487314l-80.070795 61.20501L102.392321 331.341549l219.32435-212.438467a58.363623 58.363623 0 0 1 35.581332-16.229183L362.110442 102.469115l6.322726 0.179186a115.191361 115.191361 0 0 1 38.217933 8.882534z">
|
||||
<local:MyIconButton.ContextMenu>
|
||||
<ContextMenu Closed="HidePanel" HorizontalOffset="10" VerticalOffset="18">
|
||||
@@ -32,7 +32,7 @@
|
||||
</local:MyIconButton.ContextMenu>
|
||||
</local:MyIconButton>
|
||||
<local:MyIconButton Height="24" Margin="0,0,9,0" x:Name="BtnEdit"
|
||||
ToolTip="修改信息" ToolTipService.Placement="Center" ToolTipService.VerticalOffset="35" ToolTipService.HorizontalOffset="1" ToolTipService.InitialShowDelay="50"
|
||||
ToolTip="修改信息" ToolTipService.InitialShowDelay="50"
|
||||
LogoScale="1.1" Logo="M462.336 924.891429L73.142857 950.857143l25.965714-389.193143 467.017143-467.017143a73.398857 73.398857 0 0 1 103.789715 0l259.437714 259.437714a73.398857 73.398857 0 0 1 0 103.789715l-467.017143 467.017143z m155.684571-778.349715L202.861714 561.664l259.474286 259.474286L877.458286 405.942857 618.057143 146.541714zM151.003429 873.033143l233.508571-25.965714-207.579429-207.579429-25.965714 233.545143z m544.841142-492.982857l51.894858 51.894857-233.508572 233.508571-51.931428-51.894857 233.545142-233.508571z">
|
||||
<local:MyIconButton.ContextMenu>
|
||||
<ContextMenu Closed="HidePanel" HorizontalOffset="10" VerticalOffset="18">
|
||||
@@ -42,7 +42,7 @@
|
||||
</local:MyIconButton.ContextMenu>
|
||||
</local:MyIconButton>
|
||||
<local:MyIconButton Height="24" x:Name="BtnExit" Margin="0,0,0,0"
|
||||
ToolTip="切换账号" ToolTipService.Placement="Center" ToolTipService.VerticalOffset="35" ToolTipService.HorizontalOffset="1" ToolTipService.InitialShowDelay="50"
|
||||
ToolTip="切换账号" ToolTipService.InitialShowDelay="50"
|
||||
LogoScale="1.15" Logo="M512 0A512 512 0 1 0 1024 512 512 512 0 0 0 512 0z m0 941.407086A429.407086 429.407086 0 1 1 941.407086 512 429.407086 429.407086 0 0 1 512 941.407086z m235.139657-368.64H264.045714a43.505371 43.505371 0 0 0-31.246628 72.060343l159.305143 166.765714a41.281829 41.281829 0 1 0 59.626057-56.788114l-94.997943-99.474286H747.227429a41.311086 41.311086 0 1 0 0-82.622172zM262.670629 450.940343H745.764571a43.505371 43.505371 0 0 0 31.246629-72.352914l-159.305143-166.765715a41.281829 41.281829 0 1 0-59.713828 57.022172l94.968685 99.474285H262.670629a41.281829 41.281829 0 0 0 0 82.563658z" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageLoginMsSkin
|
||||
Public Class PageLoginMsSkin
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
@@ -32,7 +32,7 @@
|
||||
Private Sub ShowPanel(sender As Object, e As MouseEventArgs) Handles PanData.MouseEnter
|
||||
AniStart(AaOpacity(PanButtons, 1 - PanButtons.Opacity, 120), "PageLoginMsSkin Button")
|
||||
End Sub
|
||||
Public Sub HidePanel() Handles PanData.MouseLeave
|
||||
Public Sub HidePanel(sender As Object, e As EventArgs) Handles PanData.MouseLeave
|
||||
If BtnEdit.ContextMenu.IsOpen OrElse BtnSkin.ContextMenu.IsOpen OrElse PanData.IsMouseOver Then Return
|
||||
AniStart(AaOpacity(PanButtons, -PanButtons.Opacity, 120), "PageLoginMsSkin Button")
|
||||
End Sub
|
||||
@@ -50,7 +50,7 @@
|
||||
Settings.Set("CacheMsV2Uuid", "")
|
||||
Settings.Set("CacheMsV2Name", "")
|
||||
Settings.Set("CacheMsV2Expires", 0L)
|
||||
McLoginMsLoader.Interrupt()
|
||||
McLoginMsLoader.Cancel()
|
||||
FrmLaunchLeft.RefreshPage(False, True)
|
||||
End Sub
|
||||
|
||||
@@ -91,16 +91,12 @@ Retry:
|
||||
If McLoginMsLoader.State = LoadState.Failed Then Throw New Exception("登录失败", McLoginMsLoader.Error)
|
||||
Dim AccessToken As String = Settings.Get(Of String)("CacheMsV2Access")
|
||||
Dim Uuid As String = Settings.Get(Of String)("CacheMsV2Uuid")
|
||||
Dim Result As String = Nothing
|
||||
ResilientUtils.Retry( 'MultipartFormDataContent 在一次请求后就会被 Dispose,所以不能直接 Retry(#8397)
|
||||
Sub()
|
||||
Result = NetRequestByClient("https://api.minecraftservices.com/minecraft/profile/skins", HttpMethod.Post,
|
||||
Content:=New Net.Http.MultipartFormDataContent From {
|
||||
{New Net.Http.StringContent(If(SkinInfo.IsSlim, "slim", "classic")), "variant"},
|
||||
{New Net.Http.ByteArrayContent(FileUtils.ReadAsBytes(SkinInfo.LocalFile)), "file", PathUtils.GetLastPart(SkinInfo.LocalFile)}
|
||||
},
|
||||
Headers:={{"Authorization", "Bearer " & AccessToken}, {"Accept", "*/*"}, {"User-Agent", "MojangSharp/0.1"}})
|
||||
End Sub, 3)
|
||||
Dim Result As String = NetRequestByClientRetry("https://api.minecraftservices.com/minecraft/profile/skins", HttpMethod.Post,
|
||||
Content:=New Net.Http.MultipartFormDataContent From {
|
||||
{New Net.Http.StringContent(If(SkinInfo.IsSlim, "slim", "classic")), "variant"},
|
||||
{New Net.Http.ByteArrayContent(FileUtils.ReadAsBytes(SkinInfo.LocalFile)), "file", PathUtils.GetLastPart(SkinInfo.LocalFile)}
|
||||
},
|
||||
Headers:={{"Authorization", "Bearer " & AccessToken}, {"Accept", "*/*"}, {"User-Agent", "MojangSharp/0.1"}})
|
||||
If Result.Contains("request requires user authentication") Then
|
||||
Hint("正在重新登录,将在登录后自动更改皮肤……")
|
||||
McLoginMsLoader.Start(GetLoginData(), IsForceRestart:=True)
|
||||
@@ -108,7 +104,7 @@ Retry:
|
||||
End If
|
||||
'获取新皮肤地址
|
||||
Logger.Info($"皮肤修改返回值:{vbCrLf}{Result}")
|
||||
Dim ResultJson As JObject = GetJson(Result)
|
||||
Dim ResultJson As JObject = Result.DeserializeJson()
|
||||
If ResultJson.ContainsKey("errorMessage") Then Throw New Exception(ResultJson("errorMessage").ToString) '#5309
|
||||
For Each Skin As JObject In ResultJson("skins")
|
||||
If Skin("state").ToString = "ACTIVE" Then
|
||||
@@ -124,10 +120,10 @@ Retry:
|
||||
Case HttpStatusCode.BadRequest
|
||||
Logger.Warn(ex, "更改皮肤时遭遇 400 错误")
|
||||
If requestException.Response?.Contains("""error""") Then
|
||||
Hint("更改皮肤失败:" & GetJson(requestException.Response)("error").ToString, HintType.Red)
|
||||
Hint("更改皮肤失败:" & requestException.Response.DeserializeJson()("error").ToString, HintType.Red)
|
||||
Return
|
||||
ElseIf requestException.Response?.Contains("""errorMessage""") Then
|
||||
Hint("更改皮肤失败:" & GetJson(requestException.Response)("errorMessage").ToString, HintType.Red)
|
||||
Hint("更改皮肤失败:" & requestException.Response.DeserializeJson()("errorMessage").ToString, HintType.Red)
|
||||
Return
|
||||
End If
|
||||
Case HttpStatusCode.Unauthorized
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Grid x:Class="PageLoginNide" Tag="False"
|
||||
<Grid x:Class="PageLoginNide" Tag="False"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageLoginNide
|
||||
Public Class PageLoginNide
|
||||
Private IsFirstLoad As Boolean = True
|
||||
''' <summary>
|
||||
''' 刷新页面显示的所有信息。
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Grid x:Class="PageLoginNideSkin" Tag="True"
|
||||
<Grid x:Class="PageLoginNideSkin" Tag="True"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -20,9 +20,9 @@
|
||||
<TextBlock Name="TextName" Text="加载中" Margin="8,0" FontSize="14" HorizontalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Name="TextEmail" Text="加载中" Margin="8,4,8,0" FontSize="12" HorizontalAlignment="Center" TextTrimming="CharacterEllipsis" Foreground="{DynamicResource ColorBrushGray3}" />
|
||||
</StackPanel>
|
||||
<local:MyIconButton ToolTip="更改密码" Grid.Row="1" Height="14" Opacity="0" x:Name="BtnEdit" ToolTipService.Placement="Center" ToolTipService.VerticalOffset="32" ToolTipService.HorizontalOffset="1" ToolTipService.InitialShowDelay="50" Grid.Column="0" HorizontalAlignment="Center" Logo="F1 M 53.2929,21.2929L 54.7071,22.7071C 56.4645,24.4645 56.4645,27.3137 54.7071,29.0711L 52.2323,31.5459L 44.4541,23.7677L 46.9289,21.2929C 48.6863,19.5355 51.5355,19.5355 53.2929,21.2929 Z M 31.7262,52.052L 23.948,44.2738L 43.0399,25.182L 50.818,32.9601L 31.7262,52.052 Z M 23.2409,47.1023L 28.8977,52.7591L 21.0463,54.9537L 23.2409,47.1023 Z" Margin="8,0,0,0" VerticalAlignment="Center"
|
||||
<local:MyIconButton ToolTip="更改密码" Grid.Row="1" Height="14" Opacity="0" x:Name="BtnEdit" ToolTipService.InitialShowDelay="50" Grid.Column="0" HorizontalAlignment="Center" Logo="F1 M 53.2929,21.2929L 54.7071,22.7071C 56.4645,24.4645 56.4645,27.3137 54.7071,29.0711L 52.2323,31.5459L 44.4541,23.7677L 46.9289,21.2929C 48.6863,19.5355 51.5355,19.5355 53.2929,21.2929 Z M 31.7262,52.052L 23.948,44.2738L 43.0399,25.182L 50.818,32.9601L 31.7262,52.052 Z M 23.2409,47.1023L 28.8977,52.7591L 21.0463,54.9537L 23.2409,47.1023 Z" Margin="8,0,0,0" VerticalAlignment="Center"
|
||||
local:CustomEventService.EventType="打开网页" local:CustomEventService.EventData="https://login.mc-user.com:233/account/changepw" />
|
||||
<local:MyIconButton ToolTip="退出登录" Grid.Row="1" Height="14" Opacity="0" x:Name="BtnExit" ToolTipService.Placement="Center" ToolTipService.VerticalOffset="32" ToolTipService.HorizontalOffset="1" ToolTipService.InitialShowDelay="50" Grid.Column="2" HorizontalAlignment="Center" Logo="F1 M 51.0071,19.0027L 51.0071,27.0038L 48.0067,27.0038L 48.0067,22.0031L 25.0035,22.0031L 25.0035,54.0075L 48.0067,54.0075L 48.0067,49.0068L 51.0071,49.0068L 51.0071,57.008L 22.1698,57.008L 22.0031,19.0027L 51.0071,19.0027 Z M 30.0042,35.0049L 45.2563,35.0049L 37.005,28.0039L 47.0066,28.0039L 58.5082,38.0053L 47.0066,48.0067L 37.005,48.0067L 45.2563,41.0057L 30.0042,41.0057L 30.0042,35.0049 Z" Margin="0,0,8,0" VerticalAlignment="Center" />
|
||||
<local:MyIconButton ToolTip="退出登录" Grid.Row="1" Height="14" Opacity="0" x:Name="BtnExit" ToolTipService.InitialShowDelay="50" Grid.Column="2" HorizontalAlignment="Center" Logo="F1 M 51.0071,19.0027L 51.0071,27.0038L 48.0067,27.0038L 48.0067,22.0031L 25.0035,22.0031L 25.0035,54.0075L 48.0067,54.0075L 48.0067,49.0068L 51.0071,49.0068L 51.0071,57.008L 22.1698,57.008L 22.0031,19.0027L 51.0071,19.0027 Z M 30.0042,35.0049L 45.2563,35.0049L 37.005,28.0039L 47.0066,28.0039L 58.5082,38.0053L 47.0066,48.0067L 37.005,48.0067L 45.2563,41.0057L 30.0042,41.0057L 30.0042,35.0049 Z" Margin="0,0,8,0" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
<local:MySkin HorizontalAlignment="Center" VerticalAlignment="Top" x:Name="Skin" HasCape="False" />
|
||||
</Grid>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageLoginNideSkin
|
||||
Public Class PageLoginNideSkin
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -37,8 +37,7 @@
|
||||
<local:MyIconButton Grid.Column="5" Grid.Row="1" x:Name="BtnLoadCancel" Height="25" Width="25"
|
||||
VerticalAlignment="Top" Margin="0,-13,-13,0"
|
||||
Theme="Black" Opacity="0.3"
|
||||
ToolTip="取消" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="100"
|
||||
ToolTipService.VerticalOffset="-2" ToolTipService.HorizontalOffset="0"
|
||||
ToolTip="取消" ToolTipService.InitialShowDelay="100"
|
||||
LogoScale="0.72" Logo="F1 M2,0 L0,2 8,10 0,18 2,20 10,12 18,20 20,18 12,10 20,2 18,0 10,8 2,0Z" />
|
||||
<Grid Height="12" VerticalAlignment="Bottom" Grid.ColumnSpan="100" Grid.RowSpan="100" Margin="0,0,0,-0.6">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -164,7 +163,7 @@
|
||||
<local:MyCard Grid.Row="4" HorizontalAlignment="Center" VerticalAlignment="Center" CornerRadius="8">
|
||||
<StackPanel Orientation="Horizontal" Margin="3,0">
|
||||
<StackPanel x:Name="BtnFinishPing" Orientation="Horizontal" Background="{StaticResource ColorBrushSemiTransparent}"
|
||||
ToolTip="延迟" ToolTipService.Placement="Center" ToolTipService.InitialShowDelay="50" ToolTipService.VerticalOffset="40" ToolTipService.HorizontalOffset="4">
|
||||
ToolTip="延迟" ToolTipService.InitialShowDelay="50">
|
||||
<Path IsHitTestVisible="False" Height="14" Width="14" Stretch="Uniform" Fill="#9C9C9C" Margin="13,0,8,0"
|
||||
Data="M60.9 966.2A60.3 60.3 0 0 1 0.8 906.1v-90.1a60.3 60.3 0 0 1 60.1-60.1 60.3 60.3 0 0 1 60.1 60.1v90.1a60.2 60.2 0 0 1-60.1 60.1z m300.6 0a60.3 60.3 0 0 1-60.1-60.1V665.6a60.3 60.3 0 0 1 60.1-60.1 60.3 60.3 0 0 1 60.1 60.1v240.5a60.2 60.2 0 0 1-60.1 60.1z m300.6 0a60.3 60.3 0 0 1-60.1-60.1V425.1a60.3 60.3 0 0 1 60.1-60.1 60.3 60.3 0 0 1 60.1 60.1v481.0a60.3 60.3 0 0 1-60.1 60.1z m300.6 0a60.3 60.3 0 0 1-60.1-60.1V124.5a60.3 60.3 0 0 1 60.1-60.1 60.3 60.3 0 0 1 60.1 60.1v781.6a60.3 60.3 0 0 1-60.1 60.1z" />
|
||||
<TextBlock x:Name="LabFinishPing" IsHitTestVisible="False" Text="15 ms" VerticalAlignment="Center" Foreground="{StaticResource ColorBrushGray1}" Margin="0,0.5,13,0" />
|
||||
@@ -175,7 +174,7 @@
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
<StackPanel x:Name="BtnFinishPlayer" Orientation="Horizontal" Background="{StaticResource ColorBrushSemiTransparent}"
|
||||
ToolTip="房间内人数" ToolTipService.Placement="Center" ToolTipService.InitialShowDelay="50" ToolTipService.VerticalOffset="40" ToolTipService.HorizontalOffset="4">
|
||||
ToolTip="房间内人数" ToolTipService.InitialShowDelay="50">
|
||||
<Path IsHitTestVisible="False" Height="18" Width="18" Stretch="Uniform" Fill="{StaticResource ColorBrushGray4}" Margin="13,0,8,0"
|
||||
Data="m843.3,478.4c-.1-3.9-.2-7.7-.2-10.8,0-42.8-11.1-84.4-32-120.2-19.6-33.5-47.1-60.7-79.7-79,15-16.8,23.6-39.2,25-65.2,1.3-24.8-3.7-52.1-14.6-79-20.5-50.8-56-86.3-86.3-86.3s-25.1,4.1-37.5,23.5l-.4.7-.2.8c-4.1,16.6,3.9,33.4,20,41.7l.7.4h.8c34.9,5.6,50.6,38.7,53.5,65.3,3.3,30.7-7.8,67.2-40.1,80.1-7.4,1.1-9.9,7.7-11.5,12.1-.6,1.7-1.2,3.3-1.9,4.3l-.7,1v1.2c-3.4,27.8,19.6,39.8,46.3,53.6,41.4,21.4,93,48.1,93.1,144.9v.3c.3,4.3,0,9.9-.1,15.7-.6,17.9-1.4,40.2,10.3,52.4,5.5,5.7,13,8.6,22.5,8.7.7,0,1.4,0,2.1,0h0c8.1,0,14.7-2.6,19.8-7.9,12.7-13.1,11.9-39.4,11.4-58.6Z M204.7,295.9l.5-1.1v-30.1c0-3.9-2.1-6-3.3-7.1-.1-.1-.2-.2-.3-.3v-1.7l-8.9-9.2-.7-.4c-26.3-13.5-42.6-40.8-42.6-71.3s21.8-67.4,55.5-78.1c17-4.5,28.2-22.1,24.5-38.4v-.6c-.1,0-.4-.5-.4-.5-7.5-15.3-21.4-24.7-36.2-24.7s-5.1.3-7.7.8h-.2c-29.8,7.2-56.6,25.5-75.7,51.4-18.9,25.7-29.3,57.8-29.3,90.4s11.1,64.8,32.2,92.1C45.3,303.9,2.5,376.9,0,458.9v57.5s0,.2,0,.2c1.4,15.3,13.1,30.8,32.8,30.8s32.9-12.7,32.9-33.9v-43.3c0-76.2,45.9-139.2,114.3-157.1,10.5-.5,19.5-6.8,24.7-17.3Z M516,286.5c36.8-31.1,58.5-77.4,58.5-125.4C574.4,70.8,507.4,0,421.7,0s-152.7,70.8-152.7,161.2,20.4,95.1,56.4,125.6c-51.7,19.8-96.1,54.8-129,101.5-35.2,50.2-53.9,109.7-53.9,172v33.8c0,16.9,13.7,30.6,30.6,30.6h496.6c16.9,0,30.6-13.7,30.6-30.6v-33.8c0-61.4-19-120.6-54.9-171.3-32.9-46.4-78.6-82.5-129.5-102.4Zm-94.5-225.3c51.3,0,91.5,43.9,91.5,100s-41.9,100-91.5,100-91.5-43.9-91.5-100,40.2-100,91.5-100Zm218,502H203.8v-3.2c0-127,97.8-230.3,218-230.3s217.7,105.4,217.7,230.3v3.2Z" />
|
||||
<TextBlock x:Name="LabFinishPlayer" IsHitTestVisible="False" Text="2 人" VerticalAlignment="Center" Foreground="{StaticResource ColorBrushGray1}" Margin="0,0.5,13,0" />
|
||||
@@ -186,13 +185,13 @@
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
<StackPanel x:Name="BtnFinishPort" Orientation="Horizontal" Background="{StaticResource ColorBrushSemiTransparent}"
|
||||
ToolTip="端口" ToolTipService.Placement="Center" ToolTipService.InitialShowDelay="50" ToolTipService.VerticalOffset="40" ToolTipService.HorizontalOffset="4">
|
||||
ToolTip="端口" ToolTipService.InitialShowDelay="50">
|
||||
<Path IsHitTestVisible="False" Height="16" Width="16" Stretch="Uniform" Fill="{StaticResource ColorBrushGray4}" Margin="13,0,7,0"
|
||||
Data="m365,295.3c-15.1-3.6-36.5-1.8-39.6,17.5-1.2,12.4,0,107-.5,119.7.8,16.8-5.2,42.4,16.8,47.1,14.3,3.3,34.5,1.9,38.7-15.4,2.6-1.4.1-142.4,1-148.3-.7-10.9-6.2-17.8-16.4-20.6ZM234.1,311.6c-3.2-16.7-20-18.6-34.4-17.2-9.8.4-17.2,6.2-20,15.4-4.4,47.8-.2,97.3-1.6,144.8,0,16,9.8,26.6,24.6,26.1,14.4,1.4,29.1-2.9,31.7-19,2.2-8.8.8-63.9,1.1-74.1-1-25.3,2.1-50.6-1.5-75.9ZM521.4,300.6c-5.4-6.2-15.9-7.1-24.6-6.4-11.9-1-23,6.6-24.7,18.7-2.2,24.1-2,124-.2,148.1,2.6,19.7,24.1,22.4,40.1,18.4,11.9-2.4,16.6-15.2,16.3-27.1,0-33.6.1-69.3,0-103.1-1.2-15.1,4.2-37-6.9-48.5ZM708.8,194.2c.7-34.5-26.8-63.7-61.5-63.4-22.1-.1-52.4,0-75.6,0-13.4,1.1-8.7-12.1-9.6-20.9-1.6-30.6,7.5-67.2-17.5-90.9-11.7-11.9-27.4-18.4-44.3-18.4-64.8,0-129.7,0-194.5,0-37.7,1.4-76.5-3.1-113.8,2.2-48.1,14.7-46.7,55.3-45.4,97.3,0,8,.1,16.1,0,24.1.2,7-7.3,6.8-12.2,6.6-16,0-32,0-48,0-24.4-.7-51.3-1-68.6,18.4C5.8,161.2,0,176.1,0,194.7c0,0,0,350.9,0,350.9,0,22.9,5.5,41.7,16.8,57.5,19.2,27,45.9,40.7,79.5,40.7,37.4,0,77.4.1,129.9.1,42.5,0,85,0,127.5,0,11.2-1.3,273.6,2.4,278-1.8,46.1-9.1,77.1-46.8,77.1-93.8,0-117.8,0-237.9,0-354.1Zm-71-5.3c7.6.2,9.2,1.9,9.3,9.7,0,0,0,347.3,0,347.3,0,3.2.2,6.5-.3,9.9-2.8,19.3-18.9,32.3-38.5,31.9-4.5.4-508.9-.4-513.5,0-3.2,0-6.5.1-9.9-.4-19-2.9-31.8-17.8-31.8-37.1,0-117.9,0-233.9,0-350.9,0-9,2.3-10.3,10.9-10.3,0,0,131.2,0,131.2,0,1.6,0,3,0,4.5,0,0-1.5,0-2.7,0-4.3,0,0,0-115.7,0-115.7.1-8.3,1.9-10.1,10.3-10.1h280.3c8.3,0,10.1,1.8,10.1,10.3v114.1c0,1.9,0,3.7,0,5.6" />
|
||||
<TextBlock x:Name="LabFinishPort" IsHitTestVisible="False" Text="12345" VerticalAlignment="Center" Foreground="{StaticResource ColorBrushGray1}" Margin="0,0.5,13,0" />
|
||||
</StackPanel>
|
||||
<StackPanel x:Name="BtnFinishIp" Orientation="Horizontal" Background="{StaticResource ColorBrushSemiTransparent}"
|
||||
ToolTip="服务器 IP(点击复制)" ToolTipService.Placement="Center" ToolTipService.InitialShowDelay="50" ToolTipService.VerticalOffset="40" ToolTipService.HorizontalOffset="4">
|
||||
ToolTip="服务器 IP(点击复制)" ToolTipService.InitialShowDelay="50">
|
||||
<Path IsHitTestVisible="False" Height="17" Width="17" Stretch="Uniform" Fill="{StaticResource ColorBrushGray4}" Margin="11,0,7,0"
|
||||
Data="m346.4,692.8c-92.5,0-179.5-36-244.9-101.5C36,525.9,0,438.9,0,346.4S36,166.9,101.5,101.5C166.9,36,253.9,0,346.4,0s179.5,36,244.9,101.5c65.4,65.4,101.5,152.4,101.5,244.9s-36,179.5-101.5,244.9c-65.4,65.4-152.4,101.5-244.9,101.5Zm0-645.1c-164.7,0-298.7,134-298.7,298.7s134,298.7,298.7,298.7,298.7-134,298.7-298.7S511.1,47.7,346.4,47.7Zm13.8,473.4c-14.5,0-28.2-9.8-28.2-24.2V207.9c0-14.5,11.8-26.2,26.2-26.2h78.9c57.9,0,105.1,47.1,105.1,105.1s-47.1,105.1-105.1,105.1h-52.6v105.1c0,14.5-9.8,24.2-24.2,24.2Zm24.2-181.7h52.6c29,0,52.6-23.6,52.6-52.6s-20-49.2-46.5-52.3h-.4s-5.3-.4-5.3-.4h-53v105.2Zm-158.8,181.7c-14.5,0-28.2-9.8-28.2-24.2V207.9c0-14.5,11.8-26.2,26.2-26.2s26.2,11.8,26.2,26.2v289c0,14.5-9.8,24.2-24.2,24.2Z" />
|
||||
<TextBlock x:Name="LabFinishIp" IsHitTestVisible="False" Text="6.0.0.1:12345" VerticalAlignment="Center" Foreground="{StaticResource ColorBrushGray1}" Margin="0,0.5,13,0" />
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
Imports System.Globalization
|
||||
Imports System.Collections.ObjectModel
|
||||
Imports System.Globalization
|
||||
Imports System.Net.Sockets
|
||||
Imports System.Reflection
|
||||
Imports PCL
|
||||
|
||||
Public Class PageLinkMain
|
||||
Private Const INVITE_CODE_VERSION As Integer = 2
|
||||
@@ -70,7 +73,7 @@ Public Class PageLinkMain
|
||||
'由任意状态切换到 Waiting
|
||||
Private Sub SwitchToWaiting(OldState As LinkStates)
|
||||
'加载器与进程状态
|
||||
LinkLoader.Interrupt()
|
||||
LinkLoader.Cancel()
|
||||
SyncLock LinkLoader.LockState
|
||||
LinkLoader.State = LoadState.Waiting
|
||||
End SyncLock
|
||||
@@ -92,7 +95,7 @@ Public Class PageLinkMain
|
||||
Private Sub Create_MouseLeftButtonUp() Handles PanSelectCreate.MouseLeftButtonUp
|
||||
'输入端口号
|
||||
Dim Port As String = MyMsgBoxInput("输入端口", $"在单人游戏的暂停菜单选择 {vbLQ}对局域网开放{vbRQ},然后输入端口数字。{vbCrLf}甚至可以输入其他游戏的端口……嗯……",
|
||||
ValidateRules:=New ObjectModel.Collection(Of Validate) From {New ValidateInteger(1024, 65535)},
|
||||
ValidateRules:=New Collection(Of Validate) From {New ValidateInteger(1024, 65535)},
|
||||
HintText:="端口号")
|
||||
If Port Is Nothing Then Return
|
||||
'基础信息
|
||||
@@ -223,7 +226,7 @@ Public Class PageLinkMain
|
||||
'由 Loading 状态切换到 Failed
|
||||
Private Sub SwitchToFailed(OldState As LinkStates)
|
||||
'加载器与进程状态
|
||||
LinkLoader.Interrupt()
|
||||
LinkLoader.Cancel()
|
||||
ProcessStop()
|
||||
'UI 更新
|
||||
UpdateProgressBar(1)
|
||||
@@ -379,7 +382,7 @@ Public Class PageLinkMain
|
||||
''' <summary>
|
||||
''' EasyTier 所在的文件夹路径,以 \ 结尾。
|
||||
''' </summary>
|
||||
Private PathEasyTier As String = PathAppdata & "EasyTier\"
|
||||
Private PathEasyTier As String = Paths.AppDataThenName & "EasyTier\"
|
||||
''' <summary>
|
||||
''' 当前是服务端还是客户端。
|
||||
''' </summary>
|
||||
@@ -444,11 +447,11 @@ Public Class PageLinkMain
|
||||
UpdateLoadingPage("正在获取 CPU 架构……", "获取 CPU 架构")
|
||||
Dim Architecture As String = GetType(String).Assembly.GetName().ProcessorArchitecture
|
||||
Select Case Architecture
|
||||
Case Reflection.ProcessorArchitecture.X86
|
||||
Case ProcessorArchitecture.X86
|
||||
Architecture = "i686"
|
||||
Case Reflection.ProcessorArchitecture.Amd64
|
||||
Case ProcessorArchitecture.Amd64
|
||||
Architecture = "x86_64"
|
||||
Case Reflection.ProcessorArchitecture.Arm
|
||||
Case ProcessorArchitecture.Arm
|
||||
Architecture = "arm64"
|
||||
Case Else
|
||||
Logger.Warn($"CPU 是不支持的 {Architecture} 架构,这可能会导致联机模块无法启动!")
|
||||
@@ -470,7 +473,7 @@ Public Class PageLinkMain
|
||||
RequiredFiles.Add(New NetFile(
|
||||
ServerConfig("Link")("Downloads").Select(Function(UrlEntry) UrlEntry.ToString.Replace("{arch}", Architecture)),
|
||||
PathEasyTier & "EasyTier.zip",
|
||||
New FileChecker(MinSize:=1024 * 1024 * 2)))
|
||||
New FileChecker With {.MinSize = 1024 * 1024 * 2}))
|
||||
End If
|
||||
'开始下载
|
||||
UpdateLoadingPage("正在下载联机模块……", "下载联机模块")
|
||||
@@ -486,11 +489,9 @@ Public Class PageLinkMain
|
||||
Dim ExtractPath As String = RequestTaskTempFolder()
|
||||
FileUtils.ExtractToDirectory(PathEasyTier & "EasyTier.zip", ExtractPath,
|
||||
progressHandler:=Sub(Percentage) Task.Progress = Percentage * 0.05)
|
||||
DirectoryUtils.Copy(DirectoryUtils.GetDirectories(ExtractPath).First, PathEasyTier)
|
||||
DirectoryUtils.Copy(DirectoryUtils.EnumerateDirectories(ExtractPath, True).First, PathEasyTier)
|
||||
'重命名
|
||||
FileUtils.Delete(PathEasyTier & "联机模块.exe")
|
||||
FileUtils.Move(PathEasyTier & "easytier-core.exe", PathEasyTier & "联机模块.exe")
|
||||
FileUtils.Delete(PathEasyTier & "联机模块 CLI.exe")
|
||||
FileUtils.Move(PathEasyTier & "easytier-cli.exe", PathEasyTier & "联机模块 CLI.exe")
|
||||
'清理
|
||||
FileUtils.Delete(PathEasyTier & "EasyTier.zip")
|
||||
@@ -583,8 +584,8 @@ Public Class PageLinkMain
|
||||
Panic("无法连接到房主", $"可能的原因:{vbCrLf}- 你或者房主的网络环境不佳{vbCrLf}- 房主已关闭房间{vbCrLf}- 邀请码输错了")
|
||||
End Select
|
||||
End If
|
||||
Loop Until Task.IsInterrupted
|
||||
If Task.IsInterrupted Then Throw New ThreadInterruptedException
|
||||
Loop Until Task.IsCanceled
|
||||
If Task.IsCanceled Then Throw New OperationCanceledException
|
||||
'等待连接稳定,最多 5s
|
||||
If IsServerSide Then Return
|
||||
UpdateLoadingPage("连接优化中……", "优化连接")
|
||||
@@ -592,7 +593,7 @@ Public Class PageLinkMain
|
||||
For i = 1 To 50
|
||||
Dim Server = GetTargetPeer()
|
||||
If Server IsNot Nothing AndAlso Not Server.Relay AndAlso Server.Ping < 100 Then Return '结束
|
||||
If Task.IsInterrupted Then Throw New ThreadInterruptedException
|
||||
If Task.IsCanceled Then Throw New OperationCanceledException
|
||||
Thread.Sleep(100)
|
||||
Next
|
||||
End Sub
|
||||
@@ -612,10 +613,10 @@ Public Class PageLinkMain
|
||||
Dim RawNodes As JObject
|
||||
Dim IsFallbackRawList As Boolean = False
|
||||
Try
|
||||
RawNodes = GetJson(NetRequestByClient("https://uptime.easytier.cn/api/nodes?page=1&per_page=1000", RequireJson:=True))
|
||||
RawNodes = NetRequestByClient("https://uptime.easytier.cn/api/nodes?page=1&per_page=1000", RequireJson:=True).DeserializeJson()
|
||||
Catch exx As Exception
|
||||
Logger.Warn(exx, "从源站获取节点列表失败,将使用 CDN 缓存")
|
||||
RawNodes = GetJson(NetRequestByClientRetry("https://easytier.meloong.com/?page=1&per_page=1000", RequireJson:=True))
|
||||
RawNodes = NetRequestByClientRetry("https://easytier.meloong.com/?page=1&per_page=1000", RequireJson:=True).DeserializeJson()
|
||||
IsFallbackRawList = True
|
||||
End Try
|
||||
'分析节点列表
|
||||
@@ -654,7 +655,7 @@ ForcedPass:
|
||||
If SelectedDiscoverNode Is Nothing Then
|
||||
Logger.Warn($"未找到 ID {DiscoverNodeID} 的发现节点")
|
||||
Panic("房间已过期", "请让房主重新创建房间!")
|
||||
Throw New ThreadInterruptedException
|
||||
Throw New OperationCanceledException
|
||||
End If
|
||||
End If
|
||||
If SelectedDiscoverNode Is Nothing Then '使用回退发现节点
|
||||
@@ -671,9 +672,8 @@ ForcedPass:
|
||||
If RelayNodes.Count < RelayCount Then Throw New Exception($"可用的中继节点数量不足,需要 {RelayCount} 个,实际 {RelayNodes.Count} 个")
|
||||
FinalPeers.AddRange(RelayNodes.Take(RelayCount).Select(Function(n) n("address").ToString()))
|
||||
End If
|
||||
Catch ex As ThreadInterruptedException
|
||||
Throw
|
||||
Catch ex As Exception
|
||||
ex.ThrowIfCanceled()
|
||||
Logger.Error(ex, "获取节点列表失败,联机质量可能受到影响", LogBehavior.Toast)
|
||||
FinalPeers.AddRange(ServerConfig("Link")("Peers").Select(Function(p) p.ToString))
|
||||
If FinalDiscoverID <= 0 Then
|
||||
@@ -771,23 +771,22 @@ ForcedPass:
|
||||
Logger.Info($"正在启动 EasyTier:{Arguments}")
|
||||
ProcessCore = New Process With {.StartInfo = Info}
|
||||
Dim LogLineHandler =
|
||||
Function(sender As Object, e As DataReceivedEventArgs, Handle As AutoResetEvent)
|
||||
Sub(sender As Object, e As DataReceivedEventArgs, Handle As AutoResetEvent)
|
||||
Try
|
||||
If e.Data Is Nothing Then
|
||||
Handle.[Set]()
|
||||
Return Nothing
|
||||
Return
|
||||
End If
|
||||
ProcessLogLine(e.Data)
|
||||
Catch unused As ObjectDisposedException
|
||||
Catch ex As Exception
|
||||
Logger.Warn(ex, "读取 EasyTier 信息失败")
|
||||
End Try
|
||||
Return Nothing
|
||||
End Function
|
||||
End Sub
|
||||
ProcessOutputHandle = New AutoResetEvent(False)
|
||||
AddHandler ProcessCore.OutputDataReceived, Function(sender, e) LogLineHandler(sender, e, ProcessOutputHandle)
|
||||
AddHandler ProcessCore.OutputDataReceived, Sub(sender, e) LogLineHandler(sender, e, ProcessOutputHandle)
|
||||
ProcessErrorHandle = New AutoResetEvent(False)
|
||||
AddHandler ProcessCore.ErrorDataReceived, Function(sender, e) LogLineHandler(sender, e, ProcessErrorHandle)
|
||||
AddHandler ProcessCore.ErrorDataReceived, Sub(sender, e) LogLineHandler(sender, e, ProcessErrorHandle)
|
||||
ProcessCore.Start()
|
||||
ProcessCore.BeginOutputReadLine()
|
||||
ProcessCore.BeginErrorReadLine()
|
||||
@@ -872,7 +871,7 @@ ForcedPass:
|
||||
Double.TryParse(Info("lat_ms"), NumberStyles.Any, CultureInfo.InvariantCulture, Ping)
|
||||
Name = PeerName
|
||||
Relay = Info("cost").ToString.ContainsIgnoreCase("relay")
|
||||
NATType = Info("nat_type").ToString.ToEnum(Of NATTypes)
|
||||
NATType = EnumUtils.FromString(Of NATTypes)(Info("nat_type"))
|
||||
End Sub
|
||||
Public Overrides Function ToString() As String
|
||||
Return $"{Type} - {Name} - Ping {Ping:0.0}ms [中继? {Relay}] - NAT {NATType}"
|
||||
@@ -914,12 +913,12 @@ ForcedPass:
|
||||
Private RefreshPeerLoader As New LoaderTask(Of Integer, List(Of Peer))("EasyTier CLI", AddressOf RefreshPeer)
|
||||
Private Sub RefreshPeer()
|
||||
Try
|
||||
Dim CliResult = StartProcessAndGetOutput(PathEasyTier & "联机模块 CLI.exe", $"-o json -p 127.0.0.1:{RPCPort} peer", 2000, Encoding:=Encoding.UTF8, PrintLog:=False)
|
||||
Dim CliResult = "" 'StartProcessAndGetOutput(PathEasyTier & "联机模块 CLI.exe", $"-o json -p 127.0.0.1:{RPCPort} peer", 2000, Encoding:=Encoding.UTF8, PrintLog:=False)
|
||||
'解析
|
||||
If Not CliResult.Contains("lat_ms") Then Throw New Exception("CLI 调用失败:" & vbCrLf & CliResult)
|
||||
If GetUuid() Mod If(ModeDebug, 23, 103) = 0 Then Logger.Info($"CLI 输出抽样:{vbCrLf}{CliResult}")
|
||||
Dim NewPeers As New List(Of Peer)
|
||||
For Each Line As JObject In CType(GetJson(CliResult), JArray)
|
||||
For Each Line As JObject In CType(CliResult.DeserializeJson(), JArray)
|
||||
Try
|
||||
Dim Peer = New Peer(Line)
|
||||
If Peer.Type = Peer.Types.Self Then
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
Public Class PageOtherAbout
|
||||
Public Class PageOtherAbout
|
||||
|
||||
Private Shadows IsLoaded As Boolean = False
|
||||
Private Sub PageOtherAbout_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageOtherHelp
|
||||
Public Class PageOtherHelp
|
||||
Implements IRefreshable
|
||||
|
||||
#Region "初始化"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight x:Class="PageOtherHelpDetail"
|
||||
<local:MyPageRight x:Class="PageOtherHelpDetail"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageOtherHelpDetail
|
||||
Public Class PageOtherHelpDetail
|
||||
Implements IRefreshable
|
||||
Public Entry As HelpEntry
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
If Content = "" Then Throw New Exception("帮助 xaml 文件为空")
|
||||
Try
|
||||
'修改时应同时修改 PageLaunchRight.LoadContent
|
||||
Content = ArgumentReplace(Content, AddressOf EscapeUtils.XmlEscape)
|
||||
Content = ArgumentReplace(Content, AddressOf StringUtils.XmlEscape)
|
||||
Do While Content.Contains("xmlns")
|
||||
Content = Content.RegexReplace("xmlns[^""']*(""|')[^""']*(""|')", "").Replace("xmlns", "") '禁止声明命名空间
|
||||
Loop
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageLeft x:Class="PageOtherLeft"
|
||||
<local:MyPageLeft x:Class="PageOtherLeft"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" AnimatedControl="PanItem">
|
||||
@@ -7,7 +7,7 @@
|
||||
LogoScale="0.97" Logo="M520.6 620.3c-11.3-0.6-20.1-4-26.9-10.5-6.6-6.3-8.1-11-10.1-20.8-1.9-9.5-1.5-16.7-1-24.9l0.3-5.3c0.5-9.9 3.5-19.6 8.8-28.1 5.7-9 12.5-17.2 20.8-25.1 8.6-8 17.7-15.7 27-22.9 9.4-7.2 18.7-14.8 27.7-22.7 9-7.9 16.2-15.8 22.1-24.3 6.2-9 9.3-18.8 9.3-29.4 1.2-20.3-6.5-37.7-22.8-51.3-16-13.3-37.4-20-63.5-20-13.7 0-26.3 3.3-37.4 10-10.9 6.5-20.2 14.5-27.7 23.8-7.5 9.2-13.5 19-17.9 29.2-4.5 10.6-6.7 19.4-6.7 26.8 0 9.2-3.3 16-10.1 20.8-6.9 4.8-14.6 7.3-22.8 7.3h-1.3c-9-0.3-17-3.3-24.6-9.2-7.3-5.6-11.1-14.6-11.6-27.5-0.6-11.5 1.9-26.1 7.2-43.5 5.4-17.4 14.8-34.4 28.1-50.5 13.4-16.3 31.2-30.4 52.8-41.8 21.6-11.4 49.2-17.2 81.9-17.2 26.4 0 49.6 3.9 69.1 11.7 19.4 7.7 35.4 18.2 47.5 31.1l1.6 1.7c11.8 12.6 20.3 21.7 29.4 44.4 11.6 28.9 7.1 52.1 5.5 58.5-5.8 22.6-12.6 37.7-22.7 50.4-11.7 14.6-24.9 28.2-39.2 40.4-14 11.7-39.2 33.3-39.2 33.3-13.3 11.4-19.4 22.1-18.6 32.9V587c0.5 8.7-2.4 16.1-8.8 22.8-6.2 6.4-14.8 10-26.2 10.5zM519 766.1c-13 0-23.6-4.2-32.2-12.9-8.7-8.7-13-19-13-31.4 0-12.9 4.2-23.5 12.9-32.2 8.7-8.7 19.2-12.9 32.2-12.9 13 0 23.5 4.2 32.2 12.9s12.9 19.2 12.9 32.2c0 12.4-4.2 22.7-12.9 31.4-8.6 8.6-19.2 12.9-32.1 12.9z M515 928.3c-228.1 0-413.7-185.6-413.7-413.7S286.9 100.9 515 100.9s413.7 185.6 413.7 413.7c0.1 228.1-185.5 413.7-413.7 413.7z m0-747.4c-184 0-333.7 149.7-333.7 333.7S331 848.3 515 848.3s333.7-149.7 333.7-333.7S699 180.9 515 180.9z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="0" ToolTip="刷新" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" Click="Refresh" LogoScale="0.85" Logo="M875.52 148.48C783.36 56.32 655.36 0 512 0 291.84 0 107.52 138.24 30.72 332.8l122.88 46.08C204.8 230.4 348.16 128 512 128c107.52 0 199.68 40.96 271.36 112.64L640 384h384V0L875.52 148.48zM512 896c-107.52 0-199.68-40.96-271.36-112.64L384 640H0v384l148.48-148.48C240.64 967.68 368.64 1024 512 1024c220.16 0 404.48-138.24 481.28-332.8L870.4 645.12C819.2 793.6 675.84 896 512 896z" />
|
||||
<local:MyIconButton Tag="0" ToolTip="刷新" Click="Refresh" LogoScale="0.85" Logo="M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageOtherLeft
|
||||
Public Class PageOtherLeft
|
||||
|
||||
Private IsLoad As Boolean = False
|
||||
Private IsPageSwitched As Boolean = False '如果在 Loaded 前切换到其他页面,会导致触发 Loaded 时再次切换一次
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight x:Class="PageOtherTest"
|
||||
<local:MyPageRight x:Class="PageOtherTest"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageOtherTest
|
||||
Public Class PageOtherTest
|
||||
|
||||
Public Shared Sub StartCustomDownload(Url As String, FileName As String, Optional Folder As String = Nothing)
|
||||
Hint("为便于维护,开源内容中不包含百宝箱功能……")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageLeft
|
||||
<local:MyPageLeft
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:PCL;assembly=" x:Class="PageSelectLeft"
|
||||
AnimatedControl="PanList">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageSelectLeft
|
||||
Public Class PageSelectLeft
|
||||
Implements IRefreshable
|
||||
|
||||
Private Sub PageSelectLeft_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
|
||||
@@ -64,7 +64,7 @@
|
||||
</ContextMenu>
|
||||
)
|
||||
End Select
|
||||
If (Folder.Type = McFolder.Types.Vanilla OrElse Folder.Type = McFolder.Types.RenamedVanilla) AndAlso Folder.Location = PathExeFolder & ".minecraft\" AndAlso McFolderList.IsSingle Then CType(ContMenu.FindName("Delete"), MyMenuItem).Header = "清空"
|
||||
If (Folder.Type = McFolder.Types.Vanilla OrElse Folder.Type = McFolder.Types.RenamedVanilla) AndAlso Folder.Location = Paths.Base & ".minecraft\" AndAlso McFolderList.IsSingle Then CType(ContMenu.FindName("Delete"), MyMenuItem).Header = "清空"
|
||||
'注册事件
|
||||
If Not Folder.Type = McFolder.Types.Vanilla Then CType(ContMenu.FindName("Remove"), MyMenuItem).AddHandler(MyMenuItem.ClickEvent, New RoutedEventHandler(AddressOf FrmSelectLeft.Remove_Click))
|
||||
CType(ContMenu.FindName("Open"), MyMenuItem).AddHandler(MyMenuItem.ClickEvent, New RoutedEventHandler(AddressOf FrmSelectLeft.Open_Click))
|
||||
@@ -88,14 +88,11 @@
|
||||
FrmSelectLeft.PanList.Children.Add(New TextBlock With {.Text = "添加或导入", .Margin = New Thickness(13, 18, 5, 4), .Opacity = 0.6, .FontSize = 12})
|
||||
|
||||
'确认创建按钮状态
|
||||
If Not DirectoryUtils.Exists(PathExeFolder & ".minecraft\") Then
|
||||
If Not DirectoryUtils.Exists(Paths.Base & ".minecraft\") Then
|
||||
Dim ItemCreate As New MyListItem With {.IsScaleAnimationEnabled = False, .Type = MyListItem.CheckType.Clickable, .Title = "新建 .minecraft 文件夹", .Height = 34,
|
||||
.ToolTip = "在 PCL 当前所在文件夹下创建新的 .minecraft 文件夹",
|
||||
.LogoScale = 0.9,
|
||||
.Logo = "M103.331925 384.978025l25.805736 0L129.137661 161.847132c0-18.313088 14.905478-33.718963 33.718963-33.718963l0.969071 0 253.006318 0c10.82044 0 20.218484 4.797259 26.500561 12.257162l117.579929 126.753869 297.819966 0c18.297738 0 33.736359 15.179724 33.736359 33.977859l0 0.952698 0 82.909292 25.547863 0c18.538215 0 34.187637 15.179724 34.187637 33.977859 0 2.163269-0.469698 3.617387-0.469698 5.539156l-54.437843 432.971086c-1.210571 10.382465-7.007601 19.056008-14.968923 24.352641-6.249331 5.765307-14.680351 9.624195-23.595394 9.624195l-0.969071 0-694.906773 0c-9.155521 0-17.344017-3.858888-23.626094-9.155521-8.67252-5.765307-14.453177-14.939247-15.389502-25.758664L69.597613 423.040922c-2.165316-18.313088 10.868535-35.414581 29.665647-38.062897L103.331925 384.978025 103.331925 384.978025zM196.576609 384.978025 196.576609 384.978025l627.938546 0 0-49.625234L546.461371 335.352791l0 0c-9.400091 0-18.329461-4.117784-25.048489-11.110035L402.363486 196.067514 196.576609 196.067514 196.576609 384.978025 196.576609 384.978025zM879.469767 452.916347 879.469767 452.916347l-20.267603 0-0.469698 0-0.969071 0-694.906773 0-0.984421 0-20.218484 0 45.781696 366.728382 646.218888 0L879.469767 452.916347 879.469767 452.916347z"}
|
||||
ToolTipService.SetPlacement(ItemCreate, Primitives.PlacementMode.Right)
|
||||
ToolTipService.SetHorizontalOffset(ItemCreate, -50)
|
||||
ToolTipService.SetVerticalOffset(ItemCreate, 2.5)
|
||||
FrmSelectLeft.PanList.Children.Add(ItemCreate)
|
||||
AddHandler ItemCreate.Click, AddressOf FrmSelectLeft.Create_Click
|
||||
End If
|
||||
@@ -104,9 +101,6 @@
|
||||
Dim ItemAdd As New MyListItem With {.IsScaleAnimationEnabled = False, .Type = MyListItem.CheckType.Clickable, .Title = "添加已有文件夹", .Height = 34,
|
||||
.ToolTip = "将一个已有的 Minecraft 文件夹添加到列表",
|
||||
.Logo = "M512.277 954.412c-118.89 0-230.659-46.078-314.73-129.73S67.12 629.666 67.12 511.222s46.327-229.744 130.398-313.427 195.82-129.73 314.73-129.73 230.659 46.078 314.72 129.73S957.397 392.81 957.397 511.183 911.078 740.96 826.97 824.642s-195.8 129.77-314.692 129.77z m0-822.784c-101.972 0-197.809 39.494-269.865 111.222s-111.7 166.997-111.7 268.373 39.653 196.695 111.67 268.335S410.246 890.78 512.248 890.78s197.809-39.484 269.865-111.222 111.7-166.998 111.67-268.374c-0.03-101.375-39.654-196.665-111.67-268.303S614.22 131.628 512.277 131.628z m222.585 347.8H544.073V288.64c-0.76-17.561-15.613-31.18-33.173-30.419-16.495 0.714-29.704 13.924-30.419 30.419v190.787H289.703c-17.56 0.761-31.179 15.614-30.419 33.174 0.715 16.494 13.924 29.703 30.42 30.418H480.48v190.788c0.761 17.56 15.614 31.179 33.174 30.419 16.494-0.715 29.703-13.925 30.418-30.42V543.02h190.788c17.56 0.762 32.413-12.857 33.173-30.418 0.762-17.561-12.858-32.414-30.419-33.174a31.683 31.683 0 0 0-2.753 0z"}
|
||||
ToolTipService.SetPlacement(ItemAdd, Primitives.PlacementMode.Right)
|
||||
ToolTipService.SetHorizontalOffset(ItemAdd, -50)
|
||||
ToolTipService.SetVerticalOffset(ItemAdd, 2.5)
|
||||
FrmSelectLeft.PanList.Children.Add(ItemAdd)
|
||||
AddHandler ItemAdd.Click, AddressOf FrmSelectLeft.Add_Click
|
||||
|
||||
@@ -114,9 +108,6 @@
|
||||
Dim ItemInstall As New MyListItem With {.IsScaleAnimationEnabled = False, .Type = MyListItem.CheckType.Clickable, .Title = "导入整合包", .Height = 34,
|
||||
.ToolTip = "在当前选择的 Minecraft 文件夹下安装整合包",
|
||||
.Logo = "M512 40.96C249.344 40.96 35.84 252.416 35.84 512s213.504 471.04 476.16 471.04c103.424 0 202.752-33.28 286.72-96.256l1.536-1.536c5.12-5.632 7.68-12.8 7.68-19.968 0-16.896-13.824-30.208-30.72-30.208-7.68 0-15.36 2.56-20.992 7.68h-0.512c-71.68 52.224-155.648 79.36-243.712 79.36-227.328 0-412.16-182.784-412.16-407.552 0-224.768 184.832-407.552 412.16-407.552s412.16 182.784 412.16 407.552c0 68.608-15.872 132.608-46.592 190.464-0.512 1.024-1.024 2.048-1.024 3.072-0.512 2.048-1.536 4.608-1.536 8.192 0 16.896 13.824 30.208 30.72 30.208 12.288 0 23.04-7.168 28.16-18.432 35.84-68.608 53.76-141.312 53.76-216.064 0.512-259.584-212.992-471.04-475.648-471.04z M812.032 483.328c-31.744-20.992-71.68 1.536-78.848 6.144-1.024 0.512-104.448 61.44-128 74.752-8.192 4.608-22.528-0.512-27.136-4.096-31.232-36.352-54.272-70.656-68.608-102.4-13.312-29.184 0.512-41.472 3.072-43.52 7.168-4.608 114.688-68.608 143.36-83.456 24.064-12.288 40.96-25.088 46.08-45.056 3.072-13.312 0-27.136-9.216-39.936-22.016-31.744-172.544-84.992-311.296-3.584-157.184 91.648-152.064 242.688-150.528 292.352v9.216c0 18.944-12.8 37.376-14.848 40.448l-20.992 21.504c-6.144 6.144-9.216 13.824-9.216 22.528 0 8.704 3.584 16.384 9.728 22.528 12.8 12.288 32.768 11.776 45.056-0.512l22.528-23.552 0.512-0.512c3.072-3.584 30.208-38.4 30.208-81.92l-0.512-11.264c-1.536-44.544-5.632-162.816 119.296-235.52 88.064-51.2 173.056-32.256 208.896-19.968-36.864 19.456-143.36 83.456-144.896 84.48-22.016 14.336-55.808 58.88-26.112 122.88 17.408 37.376 43.52 76.8 80.896 120.32 14.336 17.408 62.976 37.376 103.424 15.36 24.576-13.312 125.44-73.216 130.048-75.776 2.048-1.024 4.608-2.56 7.68-3.584 0 2.56-0.512 6.144-1.024 10.752-5.632 35.84-35.328 155.136-191.488 181.76-49.664 8.704-89.6 3.584-121.856-0.512h-0.512c-37.888-4.608-73.216-9.216-101.888 14.336-31.232 26.112-40.96 34.304-35.84 54.272 3.584 14.336 16.384 24.064 30.72 24.064 2.56 0 5.12-0.512 7.68-1.024 6.656-1.536 12.8-5.632 16.896-10.752 2.048-2.048 7.68-6.656 20.992-18.432 6.656-5.632 25.088-3.584 52.736 0 34.816 4.608 81.92 10.24 141.312 0.512 157.184-26.624 228.864-138.752 243.2-234.496 7.68-38.912 0-64.512-21.504-78.336z"}
|
||||
ToolTipService.SetPlacement(ItemInstall, Primitives.PlacementMode.Right)
|
||||
ToolTipService.SetHorizontalOffset(ItemInstall, -50)
|
||||
ToolTipService.SetVerticalOffset(ItemInstall, 2.5)
|
||||
FrmSelectLeft.PanList.Children.Add(ItemInstall)
|
||||
AddHandler ItemInstall.Click, AddressOf ModpackInstall
|
||||
|
||||
@@ -190,7 +181,7 @@
|
||||
End If
|
||||
'检查实际的 Minecraft 文件夹位置(没有问题,或是在子文件夹中)
|
||||
If Not CheckPermission(FolderPath & "versions\") Then
|
||||
For Each Folder In DirectoryUtils.GetDirectories(FolderPath)
|
||||
For Each Folder In DirectoryUtils.EnumerateDirectories(FolderPath, True)
|
||||
If CheckPermission(Folder & "\versions\") Then
|
||||
FolderPath = Folder & "\"
|
||||
Exit For
|
||||
@@ -264,12 +255,12 @@
|
||||
Hint("新建 .minecraft 文件夹成功!", HintType.Green)
|
||||
End Sub
|
||||
Public Shared Sub CreateMcFolderInCurrentPath()
|
||||
McFolderSelected = PathExeFolder & ".minecraft\"
|
||||
McFolderSelected = Paths.Base & ".minecraft\"
|
||||
If Not DirectoryUtils.Exists(McFolderSelected) Then
|
||||
DirectoryUtils.Create(McFolderSelected & "versions\")
|
||||
McFolderLauncherProfilesJsonCreate(McFolderSelected)
|
||||
End If
|
||||
AddFolder(McFolderSelected, PathUtils.GetLastPart(PathExeFolder), False)
|
||||
AddFolder(McFolderSelected, PathUtils.GetLastPart(Paths.Base), False)
|
||||
End Sub
|
||||
|
||||
'右键菜单
|
||||
@@ -283,7 +274,7 @@
|
||||
Case 1
|
||||
'删除配置文件
|
||||
FileUtils.Delete(Target.Location & "PCL.ini")
|
||||
For Each Instance In DirectoryUtils.GetDirectories(Target.Location & "versions\", True)
|
||||
For Each Instance In DirectoryUtils.EnumerateDirectories(Target.Location & "versions\")
|
||||
DirectoryUtils.Delete(Path.Combine(Instance, "PCL"), True)
|
||||
Next
|
||||
Case 2
|
||||
@@ -302,14 +293,14 @@
|
||||
End Sub
|
||||
Public Sub Delete_Click(sender As Object, e As RoutedEventArgs)
|
||||
Dim Target As McFolder = CType(CType(CType(sender.Parent, ContextMenu).Parent, Primitives.Popup).PlacementTarget, MyListItem).Tag
|
||||
Dim DeleteText As String = If((Target.Type = McFolder.Types.Vanilla OrElse Target.Type = McFolder.Types.RenamedVanilla) AndAlso Target.Location = PathExeFolder & ".minecraft\" AndAlso McFolderList.IsSingle, "清空", "删除")
|
||||
Dim DeleteText As String = If((Target.Type = McFolder.Types.Vanilla OrElse Target.Type = McFolder.Types.RenamedVanilla) AndAlso Target.Location = Paths.Base & ".minecraft\" AndAlso McFolderList.IsSingle, "清空", "删除")
|
||||
If MyMsgBox("你确定要" & DeleteText & "这个文件夹吗?" & vbCrLf &
|
||||
"目标文件夹:" & Target.Location & vbCrLf & vbCrLf &
|
||||
"该文件夹中的游戏存档、游戏版本,以及 MC 之外的其他文件,都会永久丢失,不可恢复!", "警告", "取消", "确认", "取消") <> 2 Then Return
|
||||
If MyMsgBoxInput("删除确认",
|
||||
"该文件夹中的游戏存档、游戏版本,以及 MC 之外的其他文件,都会永久丢失,不可恢复!" & vbCrLf &
|
||||
"目标文件夹:" & Target.Location & vbCrLf & vbCrLf &
|
||||
"如果确实要删除,请在下面输入【Potato】以继续。",
|
||||
"如果确实要删除,请在下面输入【Potato】这个单词以继续。",
|
||||
ValidateRules:=New ObjectModel.Collection(Of Validate) From {New ValidateSame("Potato", $"请输入 {vbLQ}Potato{vbRQ}", IgnoreCase:=True)},
|
||||
Button1:="永久删除文件夹", Button2:="取消", IsWarn:=True) Is Nothing Then Return
|
||||
RemoveFolderFromSetup(Target)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageSelectRight
|
||||
Public Class PageSelectRight
|
||||
|
||||
'窗口基础
|
||||
Private Sub PageSelectRight_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
@@ -121,16 +121,10 @@
|
||||
Dim BtnStar As New MyIconButton
|
||||
If Instance.IsStar Then
|
||||
BtnStar.ToolTip = "取消收藏"
|
||||
ToolTipService.SetPlacement(BtnStar, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnStar, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnStar, 2)
|
||||
BtnStar.LogoScale = 1.1
|
||||
BtnStar.Logo = Logo.IconButtonLikeFill
|
||||
Else
|
||||
BtnStar.ToolTip = "收藏"
|
||||
ToolTipService.SetPlacement(BtnStar, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnStar, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnStar, 2)
|
||||
BtnStar.LogoScale = 1.1
|
||||
BtnStar.Logo = Logo.IconButtonLikeLine
|
||||
End If
|
||||
@@ -141,16 +135,10 @@
|
||||
End Sub
|
||||
Dim BtnDel As New MyIconButton With {.LogoScale = 1.1, .Logo = Logo.IconButtonDelete}
|
||||
BtnDel.ToolTip = "删除"
|
||||
ToolTipService.SetPlacement(BtnDel, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnDel, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnDel, 2)
|
||||
AddHandler BtnDel.Click, Sub() DeleteInstance(sender, Instance)
|
||||
If Instance.State <> McInstanceState.Error Then
|
||||
Dim BtnCont As New MyIconButton With {.LogoScale = 1.1, .Logo = Logo.IconButtonSetup}
|
||||
BtnCont.ToolTip = "设置"
|
||||
ToolTipService.SetPlacement(BtnCont, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnCont, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnCont, 2)
|
||||
AddHandler BtnCont.Click,
|
||||
Sub()
|
||||
PageInstanceLeft.Instance = Instance
|
||||
@@ -165,9 +153,6 @@
|
||||
Else
|
||||
Dim BtnCont As New MyIconButton With {.LogoScale = 1.15, .Logo = Logo.IconButtonOpen}
|
||||
BtnCont.ToolTip = "打开文件夹"
|
||||
ToolTipService.SetPlacement(BtnCont, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnCont, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnCont, 2)
|
||||
AddHandler BtnCont.Click, Sub() PageInstanceOverall.OpenInstanceFolder(Instance)
|
||||
AddHandler sender.MouseRightButtonUp, Sub() PageInstanceOverall.OpenInstanceFolder(Instance)
|
||||
sender.Buttons = {BtnStar, BtnDel, BtnCont}
|
||||
@@ -204,7 +189,7 @@
|
||||
If(IsHintIndie, vbCrLf & "由于该版本开启了版本隔离,删除版本时该版本对应的存档、资源包、Mod 等文件也将被一并删除!", ""),
|
||||
"版本删除确认", , "取消",, True)
|
||||
Case 1
|
||||
Instance.ResetIniCache()
|
||||
Instance.ResetSettingsCache()
|
||||
DirectoryUtils.Delete(Instance.PathVersion, Not IsShiftPressed)
|
||||
Hint("版本 " & Instance.Name & " 已删除!", HintType.Green)
|
||||
Case 2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -27,8 +27,6 @@
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="9" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="9" />
|
||||
<RowDefinition Height="28" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left" Text="默认版本隔离" Margin="0,0,25,0" />
|
||||
<local:MyComboBox local:SettingService.Key="LaunchArgumentIndieV2" x:Name="ComboArgumentIndieV2"
|
||||
@@ -39,8 +37,9 @@
|
||||
<local:MyComboBoxItem Content="隔离可安装 Mod 的版本"
|
||||
ToolTip="可安装 Mod 的版本(例如 Forge、Fabric)均互相独立以避免 Mod 冲突,其他版本(例如原版)则不会被隔离。" />
|
||||
<local:MyComboBoxItem Content="隔离非正式版"
|
||||
ToolTip="将 Minecraft 快照、预发布版、远古版本、愚人节版本与其他版本进行隔离" />
|
||||
<local:MyComboBoxItem Content="隔离可安装 Mod 的版本与非正式版" />
|
||||
ToolTip="将 Minecraft 快照、预发布版、远古版本、愚人节版本与其他版本进行隔离。" />
|
||||
<local:MyComboBoxItem Content="隔离可安装 Mod 的版本与非正式版"
|
||||
ToolTip="将可安装 Mod 的版本、Minecraft 快照、预发布版、远古版本、愚人节版本与其他版本进行隔离。" />
|
||||
<local:MyComboBoxItem Content="隔离所有版本"
|
||||
ToolTip="不同版本之间的存档、Mod、资源包等均不互通。
这会导致不同原版版本间的存档不能共用,所以一般不推荐。" />
|
||||
</local:MyComboBox>
|
||||
@@ -99,37 +98,17 @@
|
||||
<TextBlock x:Name="LabArgumentWindowMiddle" Visibility="Collapsed" Grid.Column="2" Text=" × " VerticalAlignment="Center" FontSize="18" />
|
||||
<local:MyTextBox local:SettingService.Key="LaunchArgumentWindowHeight" x:Name="TextArgumentWindowHeight"
|
||||
Padding="0,0,5,0" Visibility="Collapsed" Grid.Column="3" Width="60" HorizontalContentAlignment="Center" Text="480"
|
||||
ToolTip="Forge 1.12.2 等个别版本存在 Bug,会导致高度设定无效" ToolTipService.Placement="Right" ToolTipService.HorizontalOffset="5">
|
||||
ToolTip="Forge 1.12.2 等个别版本存在 Bug,会导致高度设定无效">
|
||||
<local:MyTextBox.ValidateRules>
|
||||
<local:ValidateInteger Min="1" Max="99999" />
|
||||
</local:MyTextBox.ValidateRules>
|
||||
</local:MyTextBox>
|
||||
</Grid>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Row="12" HorizontalAlignment="Left" Text="Java" Margin="0,0,25,0" />
|
||||
<Grid Grid.ColumnSpan="2" Grid.Row="12" Grid.Column="1" HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<local:MyComboBox
|
||||
x:Name="ComboArgumentJava" Grid.Column="0" ToolTip="若将 Java 放在游戏文件夹或 PCL 文件夹,在进行自动选择时 PCL 会尽量优先选择它">
|
||||
<ComboBoxItem Content="加载中……" IsSelected="True" />
|
||||
<!--<local:MyComboBoxItem Content="Java 8 (1.8.0_171),64 位:C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe" ToolTipService.Placement="Right" ToolTipService.HorizontalOffset="5" IsSelected="True" ToolTip="C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe" />-->
|
||||
</local:MyComboBox>
|
||||
<local:MyIconTextButton Margin="5,0,0,0"
|
||||
x:Name="BtnArgumentJavaSearch" Text="搜索" Grid.Column="1"
|
||||
Logo="F1 M 20,17L 43.25,17L 56,29.75L 56,40L 52,37.5L 52,34L 39,34L 39,21L 24,21L 24,55L 36,55L 32,59L 20,59L 20,17 Z M 43,22.25L 43,30L 50.75,30L 43,22.25 Z M 48,38C 53.5228,38 58,42.4772 58,48C 58,53.5229 53.5228,58 48,58C 46.1455,58 44.4089,57.4952 42.9201,56.6155L 36.1213,63.4142C 35.3403,64.1953 34.0739,64.1953 33.2929,63.4142L 32.5858,62.7071C 31.8047,61.9261 31.8047,60.6597 32.5858,59.8787L 39.3845,53.0799C 38.5048,51.5911 38,49.8545 38,48C 38,42.4772 42.4771,38 48,38 Z M 48,42C 44.6863,42 42,44.6863 42,48C 42,51.3137 44.6863,54 48,54C 51.3137,54 54,51.3137 54,48C 54,44.6863 51.3137,42 48,42 Z" />
|
||||
<local:MyIconTextButton
|
||||
x:Name="BtnArgumentJavaSelect" Text="导入" Grid.Column="2"
|
||||
Logo="M827.4 589.1l-30.7-50.7V151.3c0-29.9-25.2-54.3-56.1-54.3h-527c-9.9 0-24.8 6.3-24.8 24.8v700.5c0 20.2 12.1 37 31.7 43.8l169.1 58.6c4.4 1.5 9.1 2.3 13.8 2.3 10.2 0 20.7-3.4 29.9-10 12.9-9.2 20.3-22.4 20.3-36.2l-0.1-16.6h325.7c30.9 0 56.1-24.3 56.1-54.3v-193c0-9.8-2.7-19.4-7.9-27.8z m-423.5 288l-165.6-54.8V153.8l201.5 51.4v439.2c-0.1 0.5-0.8 2.6-3.2 5.3l-20.9 23.4c-7.6 8.4-11.7 18.7-11.7 28.9v175.1zM785.7 810c0 2.2-2.6 4.6-6.4 4.6h-326l-0.6-108.4 20.9-23.4c10.2-11.4 15.9-25 15.9-38.2V205.2c0-21.6-14-39.3-35.7-45.1l-50.4-13.4h337.3c3.8 0 6.4 2.4 6.4 4.6v387.1c0 9.7 2.7 19.4 8 27.9l30.7 50.7v193z" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</local:MyCard>
|
||||
<local:MyCard Margin="0,0,0,15" Title="内存分配">
|
||||
<StackPanel Margin="25,40,25,15">
|
||||
<local:MyHint x:Name="LabRamWarn" Visibility="Visible" Text="32 位 Java 只能分配最多 1 GB 的内存。强烈建议换用 64 位的 Java!" Theme="Yellow" Margin="0,0,0,12" />
|
||||
<Grid Margin="0,0,0,3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -144,13 +123,12 @@
|
||||
</Grid.RowDefinitions>
|
||||
<local:MyRadioBox local:SettingService.Key="LaunchRamType" local:SettingService.Value="0"
|
||||
Text="自动配置" Width="110" Checked="True" x:Name="RadioRamType0" Margin="0,0,20,0"
|
||||
ToolTip="根据安装的 Mod 量与电脑剩余内存,动态调整为游戏分配的内存" ToolTipService.Placement="Right" ToolTipService.HorizontalOffset="-10" ToolTipService.VerticalOffset="-3" />
|
||||
ToolTip="根据安装的 Mod 量与电脑剩余内存,动态调整为游戏分配的内存" />
|
||||
<local:MyRadioBox local:SettingService.Key="LaunchRamType" local:SettingService.Value="1"
|
||||
Grid.Row="2" Text="自定义" x:Name="RadioRamType1" Margin="0,0,20,0" />
|
||||
<local:MySlider Grid.Row="2" Grid.Column="1" IsEnabled="False" x:Name="SliderRamCustom" local:SettingService.Key="LaunchRamCustom" MaxValue="49" Value="13" />
|
||||
<local:MyCheckBox local:SettingService.Key="LaunchArgumentRam"
|
||||
Grid.Row="4" Grid.ColumnSpan="3" Text="启动游戏前进行内存优化" Height="22" x:Name="CheckArgumentRam"
|
||||
ToolTipService.Placement="Left" ToolTipService.HorizontalOffset="525" ToolTipService.VerticalOffset="-30"
|
||||
ToolTip="内存优化能将当前物理内存占用降低约 1/3,不仅限于 MC!
如果使用机械硬盘,这还可能会导致一小段时间的严重卡顿。
使用 --memory 参数启动 PCL 可以静默执行内存优化。" />
|
||||
<!--<local:MyTextBox Grid.Row="2" Grid.Column="3" Width="100" VerticalAlignment="Center" Margin="30,0,0,0" Text="2048 MB" />-->
|
||||
</Grid>
|
||||
@@ -257,13 +235,15 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="9" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="9" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,25,0">
|
||||
<TextBlock Text="Java 虚拟机参数" VerticalAlignment="Center" />
|
||||
<local:MyIconButton Height="23" Margin="0,1,0,0" x:Name="BtnAdvanceJvmReset" VerticalAlignment="Center"
|
||||
ToolTip="还原" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1"
|
||||
ToolTip="还原" ToolTipService.InitialShowDelay="200"
|
||||
Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
</StackPanel>
|
||||
<local:MyTextBox local:SettingService.Key="LaunchAdvanceJvm" x:Name="TextAdvanceJvm" Grid.ColumnSpan="2" Grid.Column="1"
|
||||
@@ -276,28 +256,38 @@
|
||||
ToolTip="在 MC 启动前执行特定命令或程序,语法与 Windows 的命令提示符一致。

你可以用替换标记来动态改变其内容或实现相对路径,在 更多 → 帮助 中搜索 “替换标记” 以了解用法。例如:
 · "{verpath}test.exe" :运行版本文件夹下的 test.exe 程序
 · "{java}java.exe" -jar "{verpath}test.jar" :用 Java 运行版本文件夹下的 test.jar
 · notepad "{verindie}options.txt" :使用记事本打开该版本的设置文件

涉及路径的操作最好都打上双引号,以避免路径中的空格导致运行失败。
执行命令时,命令行所在的目录是当前的 .minecraft 文件夹。" />
|
||||
<local:MyCheckBox local:SettingService.Key="LaunchAdvanceRunWait" x:Name="CheckAdvanceRunWait" Grid.Row="5" Grid.Column="1" Visibility="Collapsed"
|
||||
Text="等待命令执行完成后再继续启动" Margin="0,8,0,7" />
|
||||
<TextBlock VerticalAlignment="Center" Grid.Row="7" HorizontalAlignment="Left" Text="内存管理" Margin="0,0,25,0" />
|
||||
<local:MyComboBox local:SettingService.Key="LaunchAdvanceGC" Grid.Row="7" Grid.ColumnSpan="2" Grid.Column="1">
|
||||
<local:MyComboBoxItem Content="尽量使用 ZGC"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="在 Java 21+ 使用分代 ZGC,20~15 使用非分代的 ZGC,14- 使用 G1GC。
ZGC 的内存占用比 G1GC 更高,不过在回收内存时不会导致卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="尽量使用分代 ZGC"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="在 Java 21+ 使用分代 ZGC,20- 使用 G1GC。
ZGC 的内存占用比 G1GC 更高,不过在回收内存时不会导致卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="标准 G1GC"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="总是使用 G1GC,附带 Mojang 官方的优化参数。
G1GC 的内存占用比 ZGC 更低,但在回收内存时会导致突然的卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="调优 G1GC" local:SettingService.Value="4"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="总是使用 G1GC,附带 PCL 调优过的优化参数。
G1GC 的内存占用比 ZGC 更低,但在回收内存时会导致突然的卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="不指定(可自定义)" local:SettingService.Value="3"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="不自动添加 GC 参数。
仅当选择此项时,你可以在 “Java 虚拟机参数” 设置中手动添加 GC 参数。" />
|
||||
</local:MyComboBox>
|
||||
<StackPanel Margin="0,12,0,4" Grid.Row="8" Grid.ColumnSpan="2" HorizontalAlignment="Left">
|
||||
<local:MyCheckBox Height="28" Text="禁用 Java Launch Wrapper" local:SettingService.Key="LaunchAdvanceDisableJLW"
|
||||
ToolTipService.Placement="Right" ToolTip="是否使用 Java Launch Wrapper 修复 Java 18- 在中文路径下可能无法正常启动的问题。
详见:https://github.com/00ll00/java_launch_wrapper" />
|
||||
<local:MyCheckBox Height="28" Text="禁用 LWJGL Unsafe Agent" local:SettingService.Key="LaunchAdvanceDisableLUA"
|
||||
ToolTipService.Placement="Right" ToolTip="是否使用 LWJGL Unsafe Agent 修复 LWJGL 3.4.1 的一个性能问题。
详见:https://github.com/HMCL-dev/lwjgl-unsafe-agent" />
|
||||
<local:MyCheckBox Height="28" Text="使用高性能显卡" local:SettingService.Key="LaunchAdvanceGraphicCard"
|
||||
ToolTipService.Placement="Right" ToolTip="自动在 Windows 设置 → 系统 → 屏幕 → 显示卡 中将 PCL 和 Java 改为使用高性能显卡。
如果同时有集成显卡和独立显卡,这能确保 MC 使用独立显卡进行渲染,以大幅提高帧率。" />
|
||||
<StackPanel VerticalAlignment="Center" Grid.Row="7" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,25,0">
|
||||
<TextBlock Text="Java 列表" VerticalAlignment="Center" />
|
||||
<local:MyIconButton Height="23" Margin="0,1,0,0" VerticalAlignment="Center" Theme="Black" CanClick="False"
|
||||
ToolTip="启动游戏时,PCL 会选择列表中第一个兼容当前 Minecraft 的 Java。
点击选项右侧的箭头可以进行排序,以控制优先选择哪个 Java。
若想无视兼容性,强制使用某个 Java,请在版本独立设置中修改。" ToolTipService.InitialShowDelay="0" Opacity="0.3"
|
||||
Logo="M512 1008C238.7 1008 16 785.2 16 512S238.7 16 512 16 1008 238.7 1008 512 785.2 1008 512 1008z m0-896c-220.8 0-400 179.2-400 400s179.2 400 400 400 400-179.2 400-400S732.8 112 512 112z M514.5 638.7c-26.2 0-48-21.7-48-48 0-52.4 32-100.4 81.9-120.9 26.8-11.5 51.2-39.6 44.8-76.8-5.1-27.5-32-51.8-62.7-56.9-26.2-4.4-51.8 2.5-70.4 18.5-16 13.4-24.3 32-24.3 51.2 0 26.2-21.7 48-48 48s-48-21.7-48-48c0-47.3 21.1-92.8 58.2-124.1a182.4 182.4 0 0 1 147.8-39.6c71.0 11.5 129.2 66.5 142.0 133.7 14.0 76.8-27.5 151.6-101.7 183.0-14.0 5.7-23.0 18.5-23.0 32.6 0 26.2-21.7 48-48 48zM514.5 793.6c-15.3 0-30.0-6.4-40.9-16.6-10.8-10.8-16.6-25.6-16.6-40.9s5.7-30.0 16.6-40.9c2.5-2.5 5.7-5.1 8.9-7.0s6.4-3.8 9.6-5.1a57.7 57.7 0 0 1 80 53.1 57.6 57.6 0 0 1-57.6 57.6z" />
|
||||
</StackPanel>
|
||||
<local:MyHint Text="版本独立设置中还有更多高级选项可供调整。" Margin="0,5,0,10" Theme="Blue" Grid.Row="9" Grid.ColumnSpan="2"
|
||||
<Grid x:Name="PanAdvanceJava" Grid.ColumnSpan="2" Grid.Row="7" Grid.Column="1" HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<local:MyComboBox x:Name="ComboAdvanceJava" Grid.Column="0">
|
||||
<!--<local:MyComboBoxItem Content="Java 8 (1.8.0_171),64 位:C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe" IsSelected="True" ToolTip="C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe" />-->
|
||||
</local:MyComboBox>
|
||||
<TextBlock x:Name="LabAdvanceJava" Grid.Column="0" Margin="8.5,0,21.5,0" IsHitTestVisible="False" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
<local:MyIconButton Margin="5,2,0,2" Grid.Column="1" x:Name="BtnAdvanceJavaSearch"
|
||||
Logo="M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z" />
|
||||
</Grid>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Row="9" HorizontalAlignment="Left" Text="内存管理" Margin="0,0,25,0" />
|
||||
<local:MyComboBox local:SettingService.Key="LaunchAdvanceGC" Grid.Row="9" Grid.ColumnSpan="2" Grid.Column="1">
|
||||
<local:MyComboBoxItem Content="尽量使用 ZGC" ToolTip="在 Java 21+ 使用分代 ZGC,20~15 使用非分代的 ZGC,14- 使用 G1GC。
ZGC 的内存占用比 G1GC 更高,不过在回收内存时不会导致卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="尽量使用分代 ZGC" ToolTip="在 Java 21+ 使用分代 ZGC,20- 使用 G1GC。
ZGC 的内存占用比 G1GC 更高,不过在回收内存时不会导致卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="标准 G1GC" ToolTip="总是使用 G1GC,附带 Mojang 官方的优化参数。
G1GC 的内存占用比 ZGC 更低,但在回收内存时会导致突然的卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="调优 G1GC" local:SettingService.Value="4" ToolTip="总是使用 G1GC,附带 PCL 调优过的优化参数。
G1GC 的内存占用比 ZGC 更低,但在回收内存时会导致突然的卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="不指定(可自定义)" local:SettingService.Value="3" ToolTip="不自动添加 GC 参数。
仅当选择此项时,你可以在 “Java 虚拟机参数” 设置中手动添加 GC 参数。" />
|
||||
</local:MyComboBox>
|
||||
<StackPanel Margin="0,12,0,4" Grid.Row="10" Grid.ColumnSpan="2" HorizontalAlignment="Left">
|
||||
<local:MyCheckBox Height="28" Text="禁用 Java Launch Wrapper" local:SettingService.Key="LaunchAdvanceDisableJLW" ToolTip="是否使用 Java Launch Wrapper 修复 Java 18- 在中文路径下可能无法正常启动的问题。
详见:https://github.com/00ll00/java_launch_wrapper" />
|
||||
<local:MyCheckBox Height="28" Text="禁用 LWJGL Unsafe Agent" local:SettingService.Key="LaunchAdvanceDisableLUA" ToolTip="是否使用 LWJGL Unsafe Agent 修复 LWJGL 3.4.1 的一个性能问题。
详见:https://github.com/HMCL-dev/lwjgl-unsafe-agent" />
|
||||
<local:MyCheckBox Height="28" Text="使用高性能显卡" local:SettingService.Key="LaunchAdvanceGraphicCard" ToolTip="自动在 Windows 设置 → 系统 → 屏幕 → 显示卡 中将 PCL 和 Java 改为使用高性能显卡。
如果同时有集成显卡和独立显卡,这能确保 MC 使用独立显卡进行渲染,以大幅提高帧率。" />
|
||||
</StackPanel>
|
||||
<local:MyHint Text="版本独立设置中还有更多高级选项可供调整。" Margin="0,5,0,10" Theme="Blue" Grid.Row="11" Grid.ColumnSpan="2"
|
||||
CanClose="True" RelativeSetup="HintMoreAdvancedSetup" />
|
||||
</Grid>
|
||||
</local:MyCard>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageSetupLaunch
|
||||
Public Class PageSetupLaunch
|
||||
|
||||
Private Sub PageSetupLaunch_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
'重复加载部分
|
||||
@@ -6,15 +6,16 @@
|
||||
RefreshRam(False)
|
||||
BtnSwitch.Visibility = If(McInstanceSelected Is Nothing, Visibility.Collapsed, Visibility.Visible)
|
||||
|
||||
'Java 可能在版本设置被修改,所以总是重新加载(反正其他的 Refresh 也不太吃性能)
|
||||
AniControlEnabled += 1
|
||||
Refresh()
|
||||
AniControlEnabled -= 1
|
||||
|
||||
'非重复加载部分
|
||||
Static Reloaded As Boolean = False
|
||||
If Reloaded Then Return
|
||||
Reloaded = True
|
||||
|
||||
AniControlEnabled += 1
|
||||
Refresh()
|
||||
AniControlEnabled -= 1
|
||||
|
||||
'内存自动刷新
|
||||
Dim timer As New Threading.DispatcherTimer With {.Interval = New TimeSpan(0, 0, 0, 1)}
|
||||
AddHandler timer.Tick, AddressOf RefreshRam
|
||||
@@ -25,7 +26,7 @@
|
||||
SettingService.RefreshSettings(Me)
|
||||
UpdateSkinType()
|
||||
UpdateRamType()
|
||||
UpdateJavaComboBox()
|
||||
UpdateJavaList()
|
||||
Catch ex As NullReferenceException
|
||||
Logger.Error(ex, "启动设置项存在异常,已被自动重置", LogBehavior.Alert)
|
||||
Reset()
|
||||
@@ -37,9 +38,9 @@
|
||||
Try
|
||||
SettingService.ResetSettings(Me)
|
||||
Settings.Set("LaunchArgumentIndieV2", Settings.GetDefault("LaunchArgumentIndieV2"))
|
||||
Settings.Reset("LaunchArgumentJavaAll")
|
||||
Settings.Reset("LaunchArgumentJavaSelect")
|
||||
JavaSearchLoader.Start(IsForceRestart:=True)
|
||||
Configs.JavaList.Reset()
|
||||
Configs.JavaRemovedList.Reset()
|
||||
JavaListRefreshWorker.Start()
|
||||
Hint("已初始化启动设置!", HintType.Green)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, "初始化启动设置失败", LogBehavior.Alert)
|
||||
@@ -57,7 +58,7 @@
|
||||
Private Sub RadioSkinType3_Check(sender As Object, e As RouteEventArgs) Handles RadioSkinType4.PreviewCheck
|
||||
If Not (AniControlEnabled = 0 AndAlso e.RaiseByMouse) Then Return
|
||||
'已有图片则不再选择
|
||||
If FileUtils.Exists(PathAppdata & "CustomSkin.png") Then Return
|
||||
If FileUtils.Exists(Paths.AppDataThenName & "CustomSkin.png") Then Return
|
||||
'没有图片则要求选择
|
||||
Dim SkinInfo As McSkinInfo = McSkinSelect()
|
||||
If Not SkinInfo.IsVaild Then
|
||||
@@ -71,17 +72,17 @@
|
||||
Private Function ChangeSkin(SkinInfo As McSkinInfo) As Boolean
|
||||
Try
|
||||
'复制文件
|
||||
FileUtils.Copy(SkinInfo.LocalFile, PathAppdata & "CustomSkin.png")
|
||||
FileUtils.Copy(SkinInfo.LocalFile, Paths.AppDataThenName & "CustomSkin.png")
|
||||
'将单层皮肤扩展到双层
|
||||
Dim Bitmap As New MyBitmap(PathAppdata & "CustomSkin.png")
|
||||
Dim Bitmap As New MyBitmap(Paths.AppDataThenName & "CustomSkin.png")
|
||||
If Bitmap.Pic.Width = 64 AndAlso Bitmap.Pic.Height = 32 Then
|
||||
Dim Img As System.Drawing.Image = Bitmap
|
||||
Dim NewBitmap As New System.Drawing.Bitmap(64, 64)
|
||||
Using g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(NewBitmap)
|
||||
g.DrawImageUnscaled(Img, New System.Drawing.Point(0, 0))
|
||||
End Using
|
||||
FileUtils.Delete(PathAppdata & "CustomSkin.png")
|
||||
NewBitmap.Save(PathAppdata & "CustomSkin.png")
|
||||
FileUtils.Delete(Paths.AppDataThenName & "CustomSkin.png")
|
||||
NewBitmap.Save(Paths.AppDataThenName & "CustomSkin.png")
|
||||
End If
|
||||
'更新设置
|
||||
Settings.Set("LaunchSkinSlim", SkinInfo.IsSlim)
|
||||
@@ -96,7 +97,7 @@
|
||||
End Function
|
||||
Private Sub BtnSkinDelete_Click(sender As Object, e As EventArgs) Handles BtnSkinDelete.Click
|
||||
Try
|
||||
FileUtils.Delete(PathAppdata & "CustomSkin.png")
|
||||
FileUtils.Delete(Paths.AppDataThenName & "CustomSkin.png")
|
||||
RadioSkinType0.SetChecked(True, True)
|
||||
Hint("离线皮肤已清空!", HintType.Green)
|
||||
Catch ex As Exception
|
||||
@@ -164,7 +165,6 @@
|
||||
If(RamGame <> RamGameActual, " (可用 " & If(RamGameActual = Math.Floor(RamGameActual), RamGameActual & ".0", RamGameActual) & " GB)", "")
|
||||
LabRamUsed.Text = If(RamUsed = Math.Floor(RamUsed), RamUsed & ".0", RamUsed) & " GB"
|
||||
LabRamTotal.Text = " / " & If(RamTotal = Math.Floor(RamTotal), RamTotal & ".0", RamTotal) & " GB"
|
||||
LabRamWarn.Visibility = If(RamGame = 1 AndAlso Not JavaIs64Bit() AndAlso Not Is32BitSystem AndAlso JavaList.Any, Visibility.Visible, Visibility.Collapsed)
|
||||
If ShowAnim Then
|
||||
'宽度动画
|
||||
AniStart({
|
||||
@@ -270,7 +270,7 @@
|
||||
''' <summary>
|
||||
''' 获取当前设置的 RAM 值。单位为 GB。
|
||||
''' </summary>
|
||||
Public Shared Function GetRam(Instance As McInstance, UseVersionJavaSetup As Boolean, Optional Is32BitJava As Boolean? = Nothing) As Double
|
||||
Public Shared Function GetRam(Instance As McInstance, UseVersionJavaSetup As Boolean) As Double
|
||||
|
||||
'------------------------------------------
|
||||
' 修改下方代码时需要一并修改 PageInstanceSetup
|
||||
@@ -344,119 +344,97 @@ PreFin:
|
||||
RamGive = (Value - 33) * 2 + 16
|
||||
End If
|
||||
End If
|
||||
'若使用 32 位 Java,则限制为 1G
|
||||
If If(Is32BitJava, Not JavaIs64Bit(If(UseVersionJavaSetup, Instance, Nothing))) Then RamGive = Math.Min(1, RamGive)
|
||||
Return RamGive
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Java 选择"
|
||||
'注意:修改此处代码时需要同时修改 PageInstanceSetup.xaml.vb
|
||||
|
||||
'刷新 Java 下拉框显示
|
||||
Public Sub UpdateJavaComboBox()
|
||||
If ComboArgumentJava Is Nothing Then Return
|
||||
'初始化列表
|
||||
ComboArgumentJava.Items.Clear()
|
||||
ComboArgumentJava.Items.Add(New MyComboBoxItem With {.Content = "自动选择(推荐)", .Tag = "自动选择"})
|
||||
Public Sub UpdateJavaList()
|
||||
If ComboAdvanceJava Is Nothing OrElse LabAdvanceJava Is Nothing OrElse Not ComboAdvanceJava.IsLoaded Then Return
|
||||
ComboAdvanceJava.Items.Clear()
|
||||
'还需要等待搜索结束
|
||||
If JavaListRefreshWorker.Running Then
|
||||
BtnAdvanceJavaSearch.IsEnabled = False
|
||||
ComboAdvanceJava.IsEnabled = False
|
||||
LabAdvanceJava.Text = "搜索中 …"
|
||||
Return
|
||||
End If
|
||||
'========================================== 显示结果 ==========================================
|
||||
BtnAdvanceJavaSearch.IsEnabled = True
|
||||
ComboAdvanceJava.IsEnabled = True
|
||||
'更新下拉框文本
|
||||
Dim Count = Configs.JavaList.Get().Count
|
||||
LabAdvanceJava.Text = If(Count > 0, $"共有 {Count} 个 Java …", "未找到 Java,点击以导入已有的 Java")
|
||||
'更新列表
|
||||
Dim SelectedItem As MyComboBoxItem = Nothing
|
||||
Dim SelectedBySetup As String = Settings.Get(Of String)("LaunchArgumentJavaSelect")
|
||||
Try
|
||||
For Each Java In JavaList.ToList().OrderByDescending(Function(v) v.MajorVersion)
|
||||
Dim ListItem = New MyComboBoxItem With {.Content = Java.ToString, .ToolTip = Java.PathFolder, .Tag = Java}
|
||||
ToolTipService.SetHorizontalOffset(ListItem, 400)
|
||||
ComboArgumentJava.Items.Add(ListItem)
|
||||
'判断人为选中
|
||||
If SelectedBySetup = "" Then Continue For
|
||||
If JavaEntry.FromJson(GetJson(SelectedBySetup)).PathFolder = Java.PathFolder Then SelectedItem = ListItem
|
||||
Dim JavaEntries = Configs.JavaList.Get()
|
||||
For i = 0 To JavaEntries.Count - 1
|
||||
Dim JavaEntry = JavaEntries(i)
|
||||
Dim JavaItem As New MyListItem With {
|
||||
.FontSize = 13, .Height = 24, .IsScaleAnimationEnabled = False, .Type = MyListItem.CheckType.Clickable,
|
||||
.Tag = JavaEntry, .Title = JavaEntry.ToString}
|
||||
AddHandler JavaItem.MouseLeftButtonUp, Sub(sender As Object, e As MouseButtonEventArgs) e.Handled = True
|
||||
AddHandler JavaItem.Click, Sub() Hint("点击选项右侧的箭头可以进行排序,以控制 PCL 优先选择哪个 Java!")
|
||||
ComboAdvanceJava.Items.Add(JavaItem)
|
||||
Dim Buttons As New List(Of MyIconButton)
|
||||
'向上移动按钮
|
||||
Dim UpButton As New MyIconButton With {.Logo = Logo.IconButtonArrowUp, .LogoScale = 0.95, .Height = 24, .Width = 24}
|
||||
UpButton.IsEnabled = i > 0
|
||||
UpButton.ToolTip = "提高优先级"
|
||||
ToolTipService.SetShowOnDisabled(UpButton, True)
|
||||
AddHandler UpButton.Click, Sub() MoveJavaInList(JavaEntry, -1)
|
||||
Buttons.Add(UpButton)
|
||||
'向下移动按钮
|
||||
Dim DownButton As New MyIconButton With {.Logo = Logo.IconButtonArrowDown, .LogoScale = 0.95, .Height = 24, .Width = 24}
|
||||
DownButton.IsEnabled = i < JavaEntries.Count - 1
|
||||
DownButton.ToolTip = "降低优先级"
|
||||
ToolTipService.SetShowOnDisabled(DownButton, True)
|
||||
AddHandler DownButton.Click, Sub() MoveJavaInList(JavaEntry, 1)
|
||||
Buttons.Add(DownButton)
|
||||
'从列表中移除按钮
|
||||
Dim IsOfficial As Boolean = JavaEntry.Folder.StartsWithF($"{Paths.AppData}.minecraft\runtime\")
|
||||
Dim DeleteButton As New MyIconButton With {.Logo = Logo.IconButtonStop, .Height = 24, .Width = 24}
|
||||
DeleteButton.IsEnabled = Not IsOfficial
|
||||
DeleteButton.ToolTip = If(DeleteButton.IsEnabled, "从列表中移除", "无法移除官方 Java")
|
||||
AddHandler DeleteButton.Click, Sub() ManuallyRemoveJava(JavaEntry)
|
||||
ToolTipService.SetShowOnDisabled(DeleteButton, True)
|
||||
Buttons.Add(DeleteButton)
|
||||
'打开文件夹按钮
|
||||
Dim OpenButton As New MyIconButton With {.Logo = Logo.IconButtonOpen, .LogoScale = 1.1, .Height = 24, .Width = 24}
|
||||
OpenButton.ToolTip = "打开文件夹"
|
||||
AddHandler OpenButton.Click, Sub() OpenExplorer(JavaEntry.JavaExePath)
|
||||
Buttons.Add(OpenButton)
|
||||
JavaItem.Buttons = Buttons
|
||||
Next
|
||||
Dim ImportItem As New MyListItem With {
|
||||
.FontSize = 13, .Height = 24, .IsScaleAnimationEnabled = False, .Title = "导入电脑中已有的 Java…", .Type = MyListItem.CheckType.Clickable}
|
||||
AddHandler ImportItem.MouseLeftButtonUp,
|
||||
Sub(sender As Object, e As MouseButtonEventArgs)
|
||||
e.Handled = True
|
||||
ManuallyImportJava()
|
||||
End Sub
|
||||
ComboAdvanceJava.Items.Add(ImportItem)
|
||||
Catch ex As Exception
|
||||
Settings.Set("LaunchArgumentJavaSelect", "")
|
||||
Logger.Error(ex, "更新设置 Java 下拉框失败")
|
||||
End Try
|
||||
'更新选择项
|
||||
If SelectedItem Is Nothing AndAlso JavaList.Any Then SelectedItem = ComboArgumentJava.Items(0) '选中 “自动选择”
|
||||
ComboArgumentJava.SelectedItem = SelectedItem
|
||||
'结束处理
|
||||
If SelectedItem Is Nothing Then
|
||||
ComboArgumentJava.Items.Clear()
|
||||
ComboArgumentJava.Items.Add(New ComboBoxItem With {.Content = "未找到可用的 Java", .IsSelected = True})
|
||||
End If
|
||||
RefreshRam(True)
|
||||
End Sub
|
||||
'阻止在特定情况下展开下拉框
|
||||
Private Sub ComboArgumentJava_DropDownOpened(sender As Object, e As EventArgs) Handles ComboArgumentJava.DropDownOpened
|
||||
If ComboArgumentJava.SelectedItem Is Nothing OrElse ComboArgumentJava.Items(0).Content = "未找到可用的 Java" OrElse ComboArgumentJava.Items(0).Content = "加载中……" Then
|
||||
ComboArgumentJava.IsDropDownOpen = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'下拉框选择更改
|
||||
Private Sub JavaSelectionUpdate() Handles ComboArgumentJava.SelectionChanged
|
||||
If AniControlEnabled <> 0 Then Return
|
||||
'Java 不可用时也不清空,会导致刷新时找不到对象
|
||||
If ComboArgumentJava.SelectedItem Is Nothing OrElse ComboArgumentJava.SelectedItem.Tag Is Nothing Then Return
|
||||
'设置新的 Java
|
||||
Dim SelectedJava = ComboArgumentJava.SelectedItem.Tag
|
||||
If "自动选择".Equals(SelectedJava) Then
|
||||
'选择 “自动”
|
||||
Settings.Set("LaunchArgumentJavaSelect", "")
|
||||
Logger.Info("修改 Java 选择设置:自动选择")
|
||||
Else
|
||||
'选择指定项
|
||||
Settings.Set("LaunchArgumentJavaSelect", CType(SelectedJava.ToJson(), JObject).ToString(Newtonsoft.Json.Formatting.None))
|
||||
Logger.Info($"修改 Java 选择设置:{SelectedJava}")
|
||||
End If
|
||||
RefreshRam(True)
|
||||
End Sub
|
||||
|
||||
'手动选择
|
||||
Private Sub BtnArgumentJavaSelect_Click(sender As Object, e As EventArgs) Handles BtnArgumentJavaSelect.Click
|
||||
If JavaSearchLoader.State = LoadState.Loading Then
|
||||
Hint("正在搜索 Java,请稍候!", HintType.Red)
|
||||
Return
|
||||
End If
|
||||
'选择 Java
|
||||
Dim JavaSelected As String = Dialogs.SelectFile("选择 bin 文件夹中的 javaw.exe 文件", False, filter:={({"exe"}, "javaw.exe")}).FirstOrDefault()
|
||||
If String.IsNullOrEmpty(JavaSelected) Then Return
|
||||
JavaSelected = PathUtils.AddSlashSuffix(PathUtils.RemoveLastPart(JavaSelected))
|
||||
Try
|
||||
'验证 Java 可用
|
||||
Dim NewEntry As New JavaEntry(JavaSelected, True)
|
||||
NewEntry.Check()
|
||||
'加入列表
|
||||
Dim JavaNewList As New JArray From {NewEntry.ToJson}
|
||||
For Each JsonEntry In GetJson(Settings.Get(Of String)("LaunchArgumentJavaAll"))
|
||||
Dim Entry = JavaEntry.FromJson(JsonEntry)
|
||||
If Entry.PathFolder = NewEntry.PathFolder Then Continue For
|
||||
JavaNewList.Add(JsonEntry)
|
||||
Next
|
||||
Settings.Set("LaunchArgumentJavaAll", JavaNewList.ToString(Newtonsoft.Json.Formatting.None))
|
||||
'重新加载列表
|
||||
JavaSearchLoader.Start(IsForceRestart:=True)
|
||||
Hint("已将该 Java 加入 Java 列表!", HintType.Green)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, "该 Java 存在异常,无法使用", LogBehavior.Alert)
|
||||
Return
|
||||
Logger.Error(ex, "更新 Java 列表下拉框失败")
|
||||
End Try
|
||||
End Sub
|
||||
'自动查找
|
||||
Private Sub BtnArgumentJavaSearch_Click(sender As Object, e As EventArgs) Handles BtnArgumentJavaSearch.Click
|
||||
If JavaSearchLoader.State = LoadState.Loading Then
|
||||
Hint("正在搜索 Java,请稍候!", HintType.Red)
|
||||
Return
|
||||
End If
|
||||
RunInThread(
|
||||
Sub()
|
||||
Hint("正在搜索 Java!")
|
||||
JavaSearchLoader.WaitForExit(IsForceRestart:=True)
|
||||
If Not JavaList.Any() Then
|
||||
Hint("未找到可用的 Java!", HintType.Red)
|
||||
Else
|
||||
Hint("已找到 " & JavaList.Count & " 个 Java,请检查下拉框查看列表!", HintType.Green)
|
||||
End If
|
||||
Private Sub MoveJavaInList(JavaEntry As Java, Offset As Integer)
|
||||
Configs.JavaList.Edit(
|
||||
Sub(ByRef List)
|
||||
Dim Index = List.IndexOf(JavaEntry)
|
||||
Dim NewIndex = Index + Offset
|
||||
If Index < 0 OrElse NewIndex < 0 OrElse NewIndex >= List.Count Then Return
|
||||
List.RemoveAt(Index)
|
||||
List.Insert(NewIndex, JavaEntry)
|
||||
End Sub)
|
||||
UpdateJavaLists()
|
||||
End Sub
|
||||
Private Sub BtnAdvanceJavaSearch_Click() Handles BtnAdvanceJavaSearch.Click
|
||||
ManuallySearchJava()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
@@ -476,7 +454,7 @@ PreFin:
|
||||
If ComboArgumentVisibie.SelectedIndex = 0 Then
|
||||
If MyMsgBox("若在游戏启动后立即关闭启动器,崩溃检测、更改游戏标题等功能将失效。" & vbCrLf &
|
||||
"如果想保留这些功能,可以选择让启动器在游戏启动后隐藏,游戏退出后自动关闭。", "提醒", "继续", "取消") = 2 Then
|
||||
ComboArgumentVisibie.SelectedItem = e.RemovedItems(0)
|
||||
If e.RemovedItems.Count > 0 Then ComboArgumentVisibie.SelectedItem = e.RemovedItems(0)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
@@ -487,7 +465,7 @@ PreFin:
|
||||
If Not CheckArgumentRam.Checked Then Return
|
||||
If MyMsgBox("内存优化会显著延长启动耗时,建议仅在内存不足时开启。" & vbCrLf &
|
||||
"如果你在使用机械硬盘,这还可能导致一小段时间的严重卡顿。" &
|
||||
If(SystemUtils.HasAdminRole(), "", $"{vbCrLf}{vbCrLf}每次启动游戏,PCL 都需要申请管理员权限以进行内存优化。{vbCrLf}若想自动授予权限,可以右键 PCL,打开 属性 → 兼容性 → 以管理员身份运行此程序。"),
|
||||
If(WindowsUtils.HasAdminRole(), "", $"{vbCrLf}{vbCrLf}每次启动游戏,PCL 都需要申请管理员权限以进行内存优化。{vbCrLf}若想自动授予权限,可以右键 PCL,打开 属性 → 兼容性 → 以管理员身份运行此程序。"),
|
||||
"提醒", "确定", "取消") = 2 Then
|
||||
CheckArgumentRam.Checked = False
|
||||
End If
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageLeft
|
||||
<local:MyPageLeft
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="PageSetupLeft"
|
||||
@@ -8,7 +8,7 @@
|
||||
LogoScale="0.8" Logo="M52.1,164.5c-1.4,0-3.1-0.5-4.2-1.3c-2.6-1.7-4-4.2-4-7V43.8c0-2.9,1.6-5.8,4.1-7c1.2-0.8,2.7-1.2,4.1-1.2c1.5,0,2.9,0.4,4.2,1.2L153.1,93c0,0,0.1,0,0.1,0.1c2.6,1.7,4,4.2,4,7c0,3-1.7,5.8-4.2,7.1l-96.8,56.2C55.1,164,53.5,164.5,52.1,164.5z M60.4,142.1l72.1-42.1L60.4,58.2V142.1z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="0" ToolTip="初始化本页设置" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
<local:MyIconButton Tag="0" ToolTip="初始化本页设置" ToolTipService.InitialShowDelay="200" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
@@ -16,7 +16,7 @@
|
||||
LogoScale="0.77" Logo="M512 817c-48.601 0-88-39.399-88-88s39.399-88 88-88 88 39.399 88 88-39.399 88-88 88zM237.671 565.74C308.335 474.58 397.369 429 504.774 429c118.433 0 214.225 55.421 287.377 166.264l-53.407 30.369c-13.84 7.87-31.362 4.367-41.114-8.219-50.291-64.911-114.577-97.367-192.856-97.367-86.851 0-156.835 40.318-209.95 120.953l-47.995-28.02c-15.263-8.91-20.412-28.507-11.502-43.77a32 32 0 0 1 2.344-3.47zM107.691 419.47C205.24 278.491 337.805 208 505.379 208c178.77 0 317.694 80.224 416.772 240.672l-56.54 31.73c-13.686 7.68-30.922 4.303-40.697-7.975C735.581 360.213 629.07 303.009 505.38 300.815 373.997 298.485 261.637 362.88 168.3 494l-50.116-28.505c-15.362-8.738-20.732-28.275-11.994-43.637a32 32 0 0 1 1.5-2.387z" >
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="1" ToolTip="初始化本页设置" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
<local:MyIconButton Tag="1" ToolTip="初始化本页设置" ToolTipService.InitialShowDelay="200" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
@@ -24,7 +24,7 @@
|
||||
LogoScale="0.9" Logo="M764.0 0.0a215.4 215.4 0 0 0-76.2 13.9l-9.0 3.6c-49.1 20.7-88.5 30.5-115.4 30.5-27.0 0-66.4-9.8-116.6-31.0a217.5 217.5 0 0 0-72.1-16.7l-9.1-0.3-3.8-0.0-8.6 0.3-4.2 0.2A160.7 160.7 0 0 0 250.4 45.3l-219.3 212.4a102.3 102.3 0 0 0-11.2 134.2l106.3 144.5 3.3 4.3a102.4 102.4 0 0 0 112.8 31.6l5.6-2.1V883.2a140.7 140.7 0 0 0 140.7 140.7h372.1l5.6-0.1a140.7 140.7 0 0 0 135.1-140.6l-0.0-318.6 1.1 0.7a102.3 102.3 0 0 0 141.9-44.2l70.9-144.3a102.3 102.3 0 0 0-20.6-118.6L875.8 45.3A160.7 160.7 0 0 0 764.0 0.0z m-357.3 111.4C468.4 137.6 520.5 150.6 563.1 150.6c42.4 0 94.5-12.9 156.1-38.9A112.5 112.5 0 0 1 764.0 102.4c15.1 0 29.6 5.8 40.5 16.4L1023.9 331.4l-70.9 144.3-93.0-65.6a38.3 38.3 0 0 0-60.5 31.3V883.2a38.3 38.3 0 0 1-38.3 38.3H388.8a38.3 38.3 0 0 1-38.3-38.3V445.1a38.3 38.3 0 0 0-61.6-30.4l-80.0 61.2L102.3 331.3l219.3-212.4a58.3 58.3 0 0 1 35.5-16.2L362.1 102.4l6.3 0.1a115.1 115.1 0 0 1 38.2 8.8z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="2" ToolTip="初始化本页设置" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
<local:MyIconButton Tag="2" ToolTip="初始化本页设置" ToolTipService.InitialShowDelay="200" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
@@ -32,7 +32,7 @@
|
||||
LogoScale="0.8" Logo="M364 0h-273C40 0 0 40 0 91v273C0 414 40 455 91 455h273C414 455 455 414 455 364V91C455 40 414 0 364 0zM341 341H113V113h227v227zM933 0h-273C609 0 568 40 568 91v273c0 50 40 91 91 91h273C983 455 1024 414 1024 364V91c0-50-40-91-90-91zM910 341h-227V113h227v227zM364 568h-273C40 568 0 609 0 659v273c0 50 40 91 91 91h273C414 1024 455 983 455 932v-273C455 609 414 568 364 568zM341 910H113v-227h227v227zM933 568h-273c-50 0-91 40-91 91v273c0 50 40 91 91 91h273c50 0 90-40 90-91v-273c0-50-40-90-90-90zM910 910h-227v-227h227v227z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="3" ToolTip="初始化本页设置" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
<local:MyIconButton Tag="3" ToolTip="初始化本页设置" ToolTipService.InitialShowDelay="200" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageSetupLeft
|
||||
Public Class PageSetupLeft
|
||||
|
||||
Private IsLoad As Boolean = False
|
||||
Private IsPageSwitched As Boolean = False '如果在 Loaded 前切换到其他页面,会导致触发 Loaded 时再次切换一次
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageSetupLink
|
||||
Public Class PageSetupLink
|
||||
|
||||
Private Sub PageSetupLink_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Class PageSetupSystem
|
||||
Public Class PageSetupSystem
|
||||
|
||||
|
||||
Private Sub PageSetupSystem_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -65,30 +65,30 @@
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="4"
|
||||
Grid.Column="5" Grid.Row="0" Text="橡木棕" x:Name="RadioLauncherTheme4" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="5"
|
||||
Grid.Column="1" Grid.Row="1" Text="玄素黑" x:Name="RadioLauncherTheme5" Opacity="0" ToolTip="灰色是个谎言" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="1" Grid.Row="1" Text="玄素黑" x:Name="RadioLauncherTheme5" Opacity="0" ToolTip="灰色是个谎言" />
|
||||
<local:MyRadioBox Grid.Column="1" Grid.Row="1" Text="玄素黑" x:Name="RadioLauncherTheme5Gray" IsEnabled="False" Opacity="1" />
|
||||
<TextBlock Grid.Column="1" Grid.Row="1" x:Name="LabLauncherTheme5Unlock" Background="{StaticResource ColorBrushSemiTransparent}" ToolTip="灰色是个谎言" ToolTipService.Placement="Bottom" />
|
||||
<TextBlock Grid.Column="1" Grid.Row="1" x:Name="LabLauncherTheme5Unlock" Background="{StaticResource ColorBrushSemiTransparent}" ToolTip="灰色是个谎言" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="12"
|
||||
Grid.Column="2" Grid.Row="1" Text="滑稽彩" x:Name="RadioLauncherTheme12" IsEnabled="False" ToolTip="滑稽树上滑稽果,滑稽树下你和我,滑稽之日搞事情,欢乐多又多" ToolTipService.ShowOnDisabled="True" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="2" Grid.Row="1" Text="滑稽彩" x:Name="RadioLauncherTheme12" IsEnabled="False" ToolTip="滑稽树上滑稽果,滑稽树下你和我,滑稽之日搞事情,欢乐多又多" ToolTipService.ShowOnDisabled="True" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="6"
|
||||
Grid.Column="3" Grid.Row="1" Text="铁杆粉" x:Name="RadioLauncherTheme6" IsEnabled="False" ToolTip="99 次重逢的喜悦" ToolTipService.ShowOnDisabled="True" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="3" Grid.Row="1" Text="铁杆粉" x:Name="RadioLauncherTheme6" IsEnabled="False" ToolTip="99 次重逢的喜悦" ToolTipService.ShowOnDisabled="True" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="7"
|
||||
Grid.Column="4" Grid.Row="1" Text="神秘紫" x:Name="RadioLauncherTheme7" IsEnabled="False" ToolTip="072 101 108 112 032 068 101 118 032 048 046 052 046 052" ToolTipService.ShowOnDisabled="True" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="4" Grid.Row="1" Text="神秘紫" x:Name="RadioLauncherTheme7" IsEnabled="False" ToolTip="072 101 108 112 032 068 101 118 032 048 046 052 046 052" ToolTipService.ShowOnDisabled="True" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="13"
|
||||
Grid.Column="5" Grid.Row="1" Text="欧皇彩" x:Name="RadioLauncherTheme13" IsEnabled="False" ToolTip="这就是传说中的欧皇了吧" ToolTipService.ShowOnDisabled="True" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="5" Grid.Row="1" Text="欧皇彩" x:Name="RadioLauncherTheme13" IsEnabled="False" ToolTip="这就是传说中的欧皇了吧" ToolTipService.ShowOnDisabled="True" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="8"
|
||||
Grid.Column="1" Grid.Row="2" Text="秋仪金" x:Name="RadioLauncherTheme8" IsEnabled="False" ToolTipService.Placement="Bottom" />
|
||||
<TextBlock Grid.Column="1" Grid.Row="2" x:Name="LabLauncherTheme8Copy" Background="{StaticResource ColorBrushSemiTransparent}" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="1" Grid.Row="2" Text="秋仪金" x:Name="RadioLauncherTheme8" IsEnabled="False" />
|
||||
<TextBlock Grid.Column="1" Grid.Row="2" x:Name="LabLauncherTheme8Copy" Background="{StaticResource ColorBrushSemiTransparent}" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="9"
|
||||
Grid.Column="2" Grid.Row="2" Text="活跃橙" x:Name="RadioLauncherTheme9" IsEnabled="False" ToolTipService.Placement="Bottom" />
|
||||
<TextBlock Grid.Column="2" Grid.Row="2" x:Name="LabLauncherTheme9Copy" Background="{StaticResource ColorBrushSemiTransparent}" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="2" Grid.Row="2" Text="活跃橙" x:Name="RadioLauncherTheme9" IsEnabled="False" />
|
||||
<TextBlock Grid.Column="2" Grid.Row="2" x:Name="LabLauncherTheme9Copy" Background="{StaticResource ColorBrushSemiTransparent}" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="10"
|
||||
Grid.Column="3" Grid.Row="2" Text="跳票红" x:Name="RadioLauncherTheme10" IsEnabled="False" ToolTip="进行一次正版登录,支持正版游戏!" ToolTipService.ShowOnDisabled="True" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="3" Grid.Row="2" Text="跳票红" x:Name="RadioLauncherTheme10" IsEnabled="False" ToolTip="进行一次正版登录,支持正版游戏!" ToolTipService.ShowOnDisabled="True" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="11"
|
||||
Grid.Column="4" Grid.Row="2" Text="极客蓝" x:Name="RadioLauncherTheme11" IsEnabled="False" ToolTipService.Placement="Bottom" ToolTip="右键打开解密游戏入口" />
|
||||
<TextBlock Grid.Column="4" Grid.Row="2" x:Name="LabLauncherTheme11Click" Background="{StaticResource ColorBrushSemiTransparent}" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="4" Grid.Row="2" Text="极客蓝" x:Name="RadioLauncherTheme11" IsEnabled="False" ToolTip="右键打开解密游戏入口" />
|
||||
<TextBlock Grid.Column="4" Grid.Row="2" x:Name="LabLauncherTheme11Click" Background="{StaticResource ColorBrushSemiTransparent}" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="14"
|
||||
Grid.Column="5" Grid.Row="2" Text="自定义" x:Name="RadioLauncherTheme14" IsEnabled="False" ToolTipService.Placement="Bottom" ToolTip="需要解锁五个隐藏主题" ToolTipService.ShowOnDisabled="True" />
|
||||
Grid.Column="5" Grid.Row="2" Text="自定义" x:Name="RadioLauncherTheme14" IsEnabled="False" ToolTip="需要解锁五个隐藏主题" ToolTipService.ShowOnDisabled="True" />
|
||||
</Grid>
|
||||
<local:MyCheckBox local:SettingService.Key="UiLauncherLogo" Text="打开启动器时显示 PCL 图标" Margin="-1,0,0,1" Height="22" />
|
||||
</StackPanel>
|
||||
@@ -283,6 +283,7 @@
|
||||
<local:MyComboBoxItem local:SettingService.Value="14" Content="今日新闻热点(作者:EYicheng)" />
|
||||
<local:MyComboBoxItem local:SettingService.Value="15" Content="Minecraft 芝士站(作者:awaEric233)" />
|
||||
<local:MyComboBoxItem local:SettingService.Value="16" Content="整合包推荐引擎(作者:CHMYGZ)" />
|
||||
<local:MyComboBoxItem local:SettingService.Value="17" Content="Bangumi 番剧主页(作者:wzyaeu)" />
|
||||
</local:MyComboBox>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageSetupUI
|
||||
Public Class PageSetupUI
|
||||
|
||||
Private Sub PageSetupUI_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
'重复加载部分
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
'背景图片
|
||||
Private Sub BtnUIBgOpen_Click(sender As Object, e As EventArgs) Handles BtnBackgroundOpen.Click
|
||||
OpenExplorer(PathExeFolder & "PCL\Pictures\")
|
||||
OpenExplorer(Paths.Base & "PCL\Pictures\")
|
||||
End Sub
|
||||
Private Sub BtnBackgroundRefresh_Click(sender As Object, e As EventArgs) Handles BtnBackgroundRefresh.Click
|
||||
BackgroundRefresh(True, True)
|
||||
@@ -97,7 +97,7 @@
|
||||
End Sub
|
||||
Private Sub BtnBackgroundClear_Click(sender As Object, e As EventArgs) Handles BtnBackgroundClear.Click
|
||||
If MyMsgBox("即将删除背景图片文件夹中的所有文件。" & vbCrLf & "此操作不可撤销,是否确定?", "警告",, "取消", IsWarn:=True) = 1 Then
|
||||
DirectoryUtils.Delete(PathExeFolder & "PCL\Pictures")
|
||||
DirectoryUtils.Delete(Paths.Base & "PCL\Pictures")
|
||||
BackgroundRefresh(False, True)
|
||||
Hint("背景图片已清空!", HintType.Green)
|
||||
End If
|
||||
@@ -111,9 +111,9 @@
|
||||
Try
|
||||
|
||||
'获取可用的图片文件
|
||||
DirectoryUtils.Create(PathExeFolder & "PCL\Pictures\")
|
||||
DirectoryUtils.Create(Paths.Base & "PCL\Pictures\")
|
||||
Dim Pic As New List(Of String)
|
||||
For Each File In DirectoryUtils.GetFiles(PathExeFolder & "PCL\Pictures\")
|
||||
For Each File In DirectoryUtils.EnumerateFiles(Paths.Base & "PCL\Pictures\", True)
|
||||
Dim Extension As String = PathUtils.GetExtension(File)
|
||||
If Extension <> "ini" AndAlso Extension <> "db" Then Pic.Add(File) '文件夹可能会被加入 .ini 和 thumbs.db
|
||||
Next
|
||||
@@ -157,7 +157,7 @@
|
||||
Private Sub BtnLogoChange_Click(sender As Object, e As EventArgs) Handles BtnLogoChange.Click
|
||||
Dim FileName As String = Dialogs.SelectFile("选择图片", False, filter:={({"png", "jpg", "jpeg", "gif", "webp"}, "常用图片文件")}).FirstOrDefault()
|
||||
If String.IsNullOrEmpty(FileName) Then Return
|
||||
Dim TargetPath As String = PathExeFolder & "PCL\Logo.png"
|
||||
Dim TargetPath As String = Paths.Base & "PCL\Logo.png"
|
||||
Try
|
||||
'复制文件
|
||||
FileUtils.Copy(FileName, TargetPath)
|
||||
@@ -177,7 +177,7 @@
|
||||
If Not (AniControlEnabled = 0 AndAlso e.RaiseByMouse) Then Return
|
||||
Refresh:
|
||||
'已有图片则不再选择
|
||||
Dim TargetPath As String = PathExeFolder & "PCL\Logo.png"
|
||||
Dim TargetPath As String = Paths.Base & "PCL\Logo.png"
|
||||
If FileUtils.Exists(TargetPath) Then
|
||||
Try
|
||||
FrmMain.ImageTitleLogo.Source = Nothing '防止因为 Source 属性前后的值相同而不更新 (#5628)
|
||||
@@ -214,7 +214,7 @@ Refresh:
|
||||
End Sub
|
||||
Private Sub BtnLogoDelete_Click(sender As Object, e As EventArgs) Handles BtnLogoDelete.Click
|
||||
Try
|
||||
FileUtils.Delete(PathExeFolder & "PCL\Logo.png")
|
||||
FileUtils.Delete(Paths.Base & "PCL\Logo.png")
|
||||
RadioLogoType1.SetChecked(True, True)
|
||||
Hint("标题栏图片已清空!", HintType.Green)
|
||||
Catch ex As Exception
|
||||
@@ -224,7 +224,7 @@ Refresh:
|
||||
|
||||
'背景音乐
|
||||
Private Sub BtnMusicOpen_Click(sender As Object, e As EventArgs) Handles BtnMusicOpen.Click
|
||||
OpenExplorer(PathExeFolder & "PCL\Musics\")
|
||||
OpenExplorer(Paths.Base & "PCL\Musics\")
|
||||
End Sub
|
||||
Private Sub BtnMusicRefresh_Click(sender As Object, e As EventArgs) Handles BtnMusicRefresh.Click
|
||||
MusicRefreshPlay(True)
|
||||
@@ -236,7 +236,7 @@ Refresh:
|
||||
PanMusicDetail.Visibility = Visibility.Visible
|
||||
BtnMusicClear.Visibility = Visibility.Visible
|
||||
CardMusic.Title = "背景音乐(" &
|
||||
DirectoryUtils.GetFiles(PathExeFolder & "PCL\Musics\").Count(Function(f) Not {"ini", "jpg", "txt", "cfg", "lrc", "db", "png"}.Contains(PathUtils.GetExtension(f))) &
|
||||
DirectoryUtils.EnumerateFiles(Paths.Base & "PCL\Musics\", True).Count(Function(f) Not {"ini", "jpg", "txt", "cfg", "lrc", "db", "png"}.Contains(PathUtils.GetExtension(f))) &
|
||||
" 首)"
|
||||
Else
|
||||
PanMusicVolume.Visibility = Visibility.Collapsed
|
||||
@@ -258,13 +258,13 @@ Refresh:
|
||||
Thread.Sleep(200)
|
||||
'删除文件
|
||||
Try
|
||||
DirectoryUtils.Delete(PathExeFolder & "PCL\Musics")
|
||||
DirectoryUtils.Delete(Paths.Base & "PCL\Musics")
|
||||
Hint("背景音乐已删除!", HintType.Green)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, "删除背景音乐失败", LogBehavior.Alert)
|
||||
End Try
|
||||
Try
|
||||
DirectoryUtils.Create(PathExeFolder & "PCL\Musics\")
|
||||
DirectoryUtils.Create(Paths.Base & "PCL\Musics\")
|
||||
RunInUi(Sub() MusicRefreshPlay(False))
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, "重建背景音乐文件夹失败", LogBehavior.Alert)
|
||||
@@ -284,12 +284,12 @@ Refresh:
|
||||
'主页
|
||||
Private Sub BtnCustomFile_Click(sender As Object, e As EventArgs) Handles BtnCustomFile.Click
|
||||
Try
|
||||
If FileUtils.Exists(PathExeFolder & "PCL\Custom.xaml") Then
|
||||
If FileUtils.Exists(Paths.Base & "PCL\Custom.xaml") Then
|
||||
If MyMsgBox("当前已存在布局文件,继续生成教学文件将会覆盖现有布局文件!", "覆盖确认", "继续", "取消", IsWarn:=True) = 2 Then Return
|
||||
End If
|
||||
ExtractResources(PathExeFolder & "PCL\Custom.xaml", "Custom")
|
||||
ExtractResources(Paths.Base & "PCL\Custom.xaml", "Custom")
|
||||
Hint("教学文件已生成!", HintType.Green)
|
||||
OpenExplorer(PathExeFolder & "PCL\Custom.xaml")
|
||||
OpenExplorer(Paths.Base & "PCL\Custom.xaml")
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, "生成教学文件失败")
|
||||
End Try
|
||||
@@ -588,7 +588,7 @@ Refresh:
|
||||
SliderLauncherHue.GetHintText = Function(v) v & "°"
|
||||
SliderLauncherSat.GetHintText = Function(v) v & "%"
|
||||
SliderLauncherDelta.GetHintText =
|
||||
Function(Value As Integer)
|
||||
Function(Value As Integer) As String
|
||||
If Value > 90 Then
|
||||
Return "+" & (Value - 90)
|
||||
ElseIf Value = 90 Then
|
||||
@@ -598,7 +598,7 @@ Refresh:
|
||||
End If
|
||||
End Function
|
||||
SliderLauncherLight.GetHintText =
|
||||
Function(Value As Integer)
|
||||
Function(Value As Integer) As String
|
||||
If Value > 20 Then
|
||||
Return "+" & (Value - 20)
|
||||
ElseIf Value = 20 Then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class SettingService
|
||||
Public Class SettingService
|
||||
|
||||
#Region "属性"
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
Public Class Settings
|
||||
'TODO: 目前仅有此处在使用 DES 加密,后续考虑更换加密算法
|
||||
Imports System.Security.Cryptography
|
||||
|
||||
Public Class Settings
|
||||
|
||||
Public Shared ReadOnly Entries As Dictionary(Of String, Setting) = (New List(Of Setting) From {
|
||||
New Setting("Identify", "", Source:=Sources.Registry),
|
||||
New Setting("WindowHeight", 550),
|
||||
New Setting("WindowWidth", 900),
|
||||
New Setting("AprilDoneYear", 0, Source:=Sources.Registry),
|
||||
New Setting("AprilYear", 0, Source:=Sources.Registry, Encrypted:=True),
|
||||
New Setting("Potatoes", "", Source:=Sources.Registry, Encrypted:=True),
|
||||
New Setting("HintDownloadThread", False, Source:=Sources.Registry),
|
||||
New Setting("HintNotice", 0, Source:=Sources.Registry),
|
||||
@@ -171,7 +173,6 @@
|
||||
New Setting("VersionAdvanceGame", "", Source:=Sources.Instance),
|
||||
New Setting("VersionAdvanceAssets", 0, Source:=Sources.Instance),
|
||||
New Setting("VersionAdvanceAssetsV2", False, Source:=Sources.Instance),
|
||||
New Setting("VersionAdvanceJava", False, Source:=Sources.Instance),
|
||||
New Setting("VersionAdvanceRun", "", Source:=Sources.Instance),
|
||||
New Setting("VersionAdvanceRunWait", True, Source:=Sources.Instance),
|
||||
New Setting("VersionAdvanceDisableJLW", False, Source:=Sources.Instance),
|
||||
@@ -186,6 +187,8 @@
|
||||
New Setting("VersionArgumentIndie", -1, Source:=Sources.Instance),
|
||||
New Setting("VersionArgumentIndieV2", False, Source:=Sources.Instance),
|
||||
New Setting("VersionArgumentJavaSelect", "使用全局设置", Source:=Sources.Instance),
|
||||
New Setting("VersionArgumentJavaV2", 0, Source:=Sources.Instance),
|
||||
New Setting("VersionArgumentJavaRange", "", Source:=Sources.Instance),
|
||||
New Setting("VersionServerEnter", "", Source:=Sources.Instance),
|
||||
New Setting("VersionServerLogin", 0, Source:=Sources.Instance, OnChanged:=AddressOf PageInstanceSetup.OnVersionServerLoginChanged),
|
||||
New Setting("VersionServerNide", "", Source:=Sources.Instance),
|
||||
@@ -245,11 +248,11 @@
|
||||
''' </summary>
|
||||
Public Sub Save(Optional Instance As McInstance = Nothing)
|
||||
Dim Value As String = GetCache(Instance)
|
||||
Logger.Trace($"保存设置:{Key} = {Value}{If(Instance Is Nothing, "", $"(实例:{Instance?.PathVersion})")}")
|
||||
Logger.Trace($"保存设置:{Key} {If(Encrypted, "", "= " & Value)}{If(Instance Is Nothing, "", $"(实例:{Instance?.PathVersion})")}")
|
||||
If Encrypted Then
|
||||
Try
|
||||
If Value Is Nothing Then Value = ""
|
||||
Value = CryptographyUtils.DesEncrypt(Value, "PCL" & Identify)
|
||||
Value = DesEncrypt(Value, "PCL" & Identify)
|
||||
Catch ex As Exception
|
||||
Logger.Warn(ex, $"加密设置失败:{Key}")
|
||||
End Try
|
||||
@@ -319,7 +322,7 @@
|
||||
'正常读取
|
||||
Try
|
||||
Dim GotValue As String = Nothing '先用 String 储存,避免类型转换
|
||||
Dim DefaultValue As String = If(Entry.Encrypted, CryptographyUtils.DesEncrypt(Entry.DefaultValue, "PCL" & Identify), Entry.DefaultValue)
|
||||
Dim DefaultValue As String = If(Entry.Encrypted, DesEncrypt(Entry.DefaultValue, "PCL" & Identify), Entry.DefaultValue)
|
||||
Select Case Entry.Source
|
||||
Case Sources.Normal
|
||||
GotValue = ReadIni("Setup", Key, DefaultValue)
|
||||
@@ -337,7 +340,7 @@
|
||||
GotValue = Entry.DefaultValue
|
||||
Else
|
||||
Try
|
||||
GotValue = CryptographyUtils.DesDecrypt(GotValue, "PCL" & Identify)
|
||||
GotValue = DesDecrypt(GotValue, "PCL" & Identify)
|
||||
Catch ex As Exception
|
||||
Logger.Warn(ex, $"解密设置失败:{Key}")
|
||||
GotValue = Entry.DefaultValue
|
||||
@@ -418,4 +421,46 @@
|
||||
End Select
|
||||
End Function
|
||||
|
||||
#Region "DES 加密"
|
||||
|
||||
Private Shared ReadOnly desInitialVector As Byte() = Encoding.UTF8.GetBytes("95168702")
|
||||
|
||||
''' <summary>
|
||||
''' 使用 DES 对称加密算法加密字符串。
|
||||
''' </summary>
|
||||
Private Shared Function DesEncrypt(sourceString As String, Optional key As String = Nothing) As String
|
||||
key = If(key Is Nothing, "@;$ Abv2", key.GetStableHashCode().ToString().EnsureLength("X"c, 8).Substring(0, 8))
|
||||
Dim btKey As Byte() = Encoding.UTF8.GetBytes(key)
|
||||
Using des As New DESCryptoServiceProvider()
|
||||
Using ms As New MemoryStream()
|
||||
Using cs As New CryptoStream(ms, des.CreateEncryptor(btKey, desInitialVector), CryptoStreamMode.Write)
|
||||
Dim inData As Byte() = Encoding.UTF8.GetBytes(sourceString)
|
||||
cs.Write(inData, 0, inData.Length)
|
||||
cs.FlushFinalBlock()
|
||||
Return Convert.ToBase64String(ms.ToArray())
|
||||
End Using
|
||||
End Using
|
||||
End Using
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 使用 DES 对称加密算法解密字符串。
|
||||
''' </summary>
|
||||
Private Shared Function DesDecrypt(encryptedString As String, Optional key As String = Nothing) As String
|
||||
key = If(key Is Nothing, "@;$ Abv2", key.GetStableHashCode().ToString().EnsureLength("X"c, 8).Substring(0, 8))
|
||||
Dim btKey As Byte() = Encoding.UTF8.GetBytes(key)
|
||||
Using des As New DESCryptoServiceProvider()
|
||||
Using ms As New MemoryStream()
|
||||
Using cs As New CryptoStream(ms, des.CreateDecryptor(btKey, desInitialVector), CryptoStreamMode.Write)
|
||||
Dim inData As Byte() = Convert.FromBase64String(encryptedString)
|
||||
cs.Write(inData, 0, inData.Length)
|
||||
cs.FlushFinalBlock()
|
||||
Return Encoding.UTF8.GetString(ms.ToArray())
|
||||
End Using
|
||||
End Using
|
||||
End Using
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageLeft x:Class="PageSpeedLeft"
|
||||
<local:MyPageLeft x:Class="PageSpeedLeft"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageSpeedLeft
|
||||
Public Class PageSpeedLeft
|
||||
Private Const WatcherInterval As Integer = 300
|
||||
|
||||
'初始化
|
||||
@@ -48,7 +48,7 @@
|
||||
Dim RawPercent As Double = If(Tasks.Any, Tasks.Select(Function(l) l.Progress).Average().Clamp(0, 1), 1)
|
||||
Dim PredictText As String = Math.Floor(RawPercent * 100) & "." & Math.Floor((RawPercent * 100 - Math.Floor(RawPercent * 100)) * 100).ToString.EnsureLength("0", 2) & " %"
|
||||
LabProgress.Text = If(RawPercent > 0.999999, "100 %", PredictText)
|
||||
LabSpeed.Text = FormatFileSize(NetManager.Speed) & "/s"
|
||||
LabSpeed.Text = StringUtils.FormatByteSize(NetManager.Speed) & "/s"
|
||||
LabFile.Text = If(NetManager.FileRemain < 0, "0*", NetManager.FileRemain)
|
||||
LabThread.Text = NetTaskThreadCount & " / " & NetTaskThreadLimit
|
||||
End If
|
||||
@@ -98,7 +98,7 @@
|
||||
End Sub
|
||||
Card.Children.Add(Tb)
|
||||
#End Region
|
||||
Case LoadState.Finished, LoadState.Interrupted
|
||||
Case LoadState.Finished, LoadState.Canceled
|
||||
#Region "完成或中断,销毁卡片并返回"
|
||||
AniDispose(CType(Card.Parent, MyCard), True, AddressOf TryReturnToHome)
|
||||
#End Region
|
||||
@@ -140,12 +140,12 @@
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, $"更新下载管理显示失败({Loader.State})")
|
||||
End Try
|
||||
ElseIf Not (Loader.State = LoadState.Interrupted OrElse Loader.State = LoadState.Finished) Then
|
||||
ElseIf Not (Loader.State = LoadState.Canceled OrElse Loader.State = LoadState.Finished) Then
|
||||
Try
|
||||
#Region "没有卡片且未中断或完成,添加新的卡片"
|
||||
Dim CardXAML As String = "
|
||||
<local:MyCard xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" xmlns:local=""clr-namespace:PCL;assembly=Plain Craft Launcher 2""
|
||||
Tag=""" & (Loader.Progress + Loader.State) & """ Title=""" & EscapeUtils.XmlEscape(Loader.Name) & """ Margin=""0,0,0,15"">
|
||||
Tag=""" & (Loader.Progress + Loader.State) & """ Title=""" & StringUtils.XmlEscape(Loader.Name) & """ Margin=""0,0,0,15"">
|
||||
<Grid Margin=""14,40,15,10"">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width=""50""/>
|
||||
@@ -168,7 +168,7 @@
|
||||
Case Else
|
||||
CardXAML += "<Path Stretch=""Uniform"" Tag=""Failed"" Data=""F1 M2.5,0 L0,2.5 7.5,10 0,17.5 2.5,20 10,12.5 17.5,20 20,17.5 12.5,10 20,2.5 17.5,0 10,7.5 2.5,0Z"" Height=""15"" Width=""15"" HorizontalAlignment=""Center"" Grid.Column=""0"" Grid.Row=""" & Row & """ Fill=""{DynamicResource ColorBrush3}"" Margin=""0,1,0,0"" VerticalAlignment=""Top""/>"
|
||||
End Select
|
||||
CardXAML += "<TextBlock Text=""" & EscapeUtils.XmlEscape(SubTask.Name) & """ HorizontalAlignment=""Left"" Grid.Column=""1"" Grid.Row=""" & Row & """/>"
|
||||
CardXAML += "<TextBlock Text=""" & StringUtils.XmlEscape(SubTask.Name) & """ HorizontalAlignment=""Left"" Grid.Column=""1"" Grid.Row=""" & Row & """/>"
|
||||
Row += 1
|
||||
Next
|
||||
CardXAML += "</Grid></local:MyCard>"
|
||||
@@ -194,7 +194,7 @@
|
||||
RightCards.Remove(Loader.Name)
|
||||
LoaderTaskbar.Remove(Loader)
|
||||
Logger.Info($"关闭下载管理卡片:{Loader.Name},且移出任务列表")
|
||||
RunInThread(Sub() Loader.Interrupt())
|
||||
RunInThread(Sub() Loader.Cancel())
|
||||
End Sub
|
||||
'如果已经失败,再刷新一次,修改成失败的控件
|
||||
If Loader.State = LoadState.Failed Then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -33,7 +33,7 @@
|
||||
<Path Stretch="Uniform" Data="F1 M5,0 a5,5 360 1 0 0,0.0001 m15,0 a5,5 360 1 0 0,0.0001 m15,0 a5,5 360 1 0 0,0.0001 Z" Width="16" HorizontalAlignment="Center" Grid.Column="0" Grid.Row="5" Fill="{DynamicResource ColorBrush3}" Margin="0,7.5,14,0" VerticalAlignment="Top" Height="6" />
|
||||
<TextBlock Text="摸鱼一时爽,一直摸鱼一直爽" HorizontalAlignment="Left" Grid.Column="1" Grid.Row="5" />
|
||||
</Grid>
|
||||
<local:MyIconButton Logo="F1 M2,0 L0,2 8,10 0,18 2,20 10,12 18,20 20,18 12,10 20,2 18,0 10,8 2,0Z" Height="20" Margin="0,10,10,0" ToolTipService.Placement="Top" ToolTipService.HorizontalOffset="-10" ToolTip="取消" LogoScale="1.1" HorizontalAlignment="Right" VerticalAlignment="Top" />
|
||||
<local:MyIconButton Logo="F1 M2,0 L0,2 8,10 0,18 2,20 10,12 18,20 20,18 12,10 20,2 18,0 10,8 2,0Z" Height="20" Margin="0,10,10,0" ToolTip="取消" LogoScale="1.1" HorizontalAlignment="Right" VerticalAlignment="Top" />
|
||||
</local:MyCard> -->
|
||||
</StackPanel>
|
||||
</local:MyScrollViewer>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Class PageSpeedRight
|
||||
Public Class PageSpeedRight
|
||||
|
||||
Private Sub Init() Handles Me.Loaded
|
||||
PanBack.ScrollToHome()
|
||||
|
||||
Reference in New Issue
Block a user