2.13.0.0
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user