2.12.4
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
Dim FileAddress As String = SelectSaveFile("选取保存皮肤的位置", GetFileNameFromPath(Address), "皮肤图片文件(*.png)|*.png")
|
||||
If FileAddress.Contains("\") Then
|
||||
File.Delete(FileAddress)
|
||||
If Address.StartsWith(PathImage) Then
|
||||
If Address.StartsWithF(PathImage) Then
|
||||
Dim Image As New MyBitmap(Address)
|
||||
Image.Save(FileAddress)
|
||||
Else
|
||||
@@ -79,7 +79,7 @@
|
||||
'检查文件存在
|
||||
Address = Loader.Output
|
||||
If String.IsNullOrEmpty(Address) Then Throw New Exception("皮肤加载器 " & Loader.Name & " 没有输出")
|
||||
If Not Address.StartsWith(PathImage) AndAlso Not File.Exists(Address) Then Throw New FileNotFoundException("皮肤文件未找到", Address)
|
||||
If Not Address.StartsWithF(PathImage) AndAlso Not File.Exists(Address) Then Throw New FileNotFoundException("皮肤文件未找到", Address)
|
||||
'加载
|
||||
Dim Image As MyBitmap
|
||||
Try
|
||||
@@ -142,7 +142,7 @@
|
||||
End If
|
||||
Next
|
||||
If FrmLaunchLeft IsNot Nothing AndAlso HasLoaderRunning Then
|
||||
'由于 Abort 不是实时的,暂时不会释放文件,会导致删除报错,故只能取消执行
|
||||
'由于 Interrupt 不是实时的,暂时不会释放文件,会导致删除报错,故只能取消执行
|
||||
Hint("有正在获取中的皮肤,请稍后再试!", HintType.Blue)
|
||||
Else
|
||||
RunInThread(
|
||||
@@ -177,8 +177,8 @@
|
||||
Sub()
|
||||
Try
|
||||
'更新缓存
|
||||
WriteIni(PathTemp & "Cache\Skin\IndexMs.ini", Setup.Get("CacheMsV2Uuid"), SkinAddress)
|
||||
Log($"[Skin] 已写入皮肤地址缓存 {Setup.Get("CacheMsV2Uuid")} -> {SkinAddress}")
|
||||
WriteIni(PathTemp & "Cache\Skin\IndexMs.ini", Settings.Get("CacheMsV2Uuid"), SkinAddress)
|
||||
Log($"[Skin] 已写入皮肤地址缓存 {Settings.Get("CacheMsV2Uuid")} -> {SkinAddress}")
|
||||
'刷新控件
|
||||
For Each SkinLoader In {PageLaunchLeft.SkinMs, PageLaunchLeft.SkinLegacy}
|
||||
SkinLoader.WaitForExit(IsForceRestart:=True)
|
||||
|
||||
@@ -27,17 +27,10 @@
|
||||
If File.Exists(Path & "modpack.mrpack") Then PackInstallPath = Path & "modpack.mrpack"
|
||||
If PackInstallPath IsNot Nothing Then
|
||||
Log("[Launch] 需自动安装整合包:" & PackInstallPath, LogLevel.Debug)
|
||||
Setup.Set("LaunchFolderSelect", "$.minecraft\")
|
||||
If Not Directory.Exists(Path & ".minecraft\") Then
|
||||
Directory.CreateDirectory(Path & ".minecraft\")
|
||||
Directory.CreateDirectory(Path & ".minecraft\versions\")
|
||||
McFolderLauncherProfilesJsonCreate(Path & ".minecraft\")
|
||||
End If
|
||||
PageSelectLeft.AddFolder(Path & ".minecraft\", GetFolderNameFromPath(Path), False)
|
||||
PageSelectLeft.CreateMcFolderInCurrentPath()
|
||||
McFolderListLoader.WaitForExit()
|
||||
End If
|
||||
'确认 Minecraft 文件夹存在
|
||||
McFolderSelected = Setup.Get("LaunchFolderSelect").ToString.Replace("$", Path)
|
||||
If McFolderSelected = "" OrElse Not Directory.Exists(McFolderSelected) Then
|
||||
'无效的文件夹
|
||||
If McFolderSelected = "" Then
|
||||
@@ -46,10 +39,9 @@
|
||||
Log("[Launch] Minecraft 文件夹无效,该文件夹已不存在:" & McFolderSelected, LogLevel.Debug)
|
||||
End If
|
||||
McFolderListLoader.WaitForExit(IsForceRestart:=True)
|
||||
Setup.Set("LaunchFolderSelect", McFolderList(0).Location.Replace(Path, "$"))
|
||||
McFolderSelected = McFolderList.First.Location
|
||||
End If
|
||||
Log("[Launch] Minecraft 文件夹:" & McFolderSelected)
|
||||
If Setup.Get("SystemDebugDelay") Then Thread.Sleep(RandomInteger(500, 3000))
|
||||
If Settings.Get("SystemDebugDelay") Then Thread.Sleep(RandomInteger(500, 3000))
|
||||
'自动整合包安装
|
||||
If PackInstallPath IsNot Nothing Then
|
||||
Try
|
||||
@@ -67,7 +59,7 @@
|
||||
End Try
|
||||
End If
|
||||
'确认 Minecraft 版本存在
|
||||
Dim Selection As String = Setup.Get("LaunchVersionSelect")
|
||||
Dim Selection As String = ReadIni(McFolderSelected & "PCL.ini", "Version")
|
||||
Dim Instance As McInstance = If(Selection = "", Nothing, New McInstance(Selection))
|
||||
If Instance Is Nothing OrElse Not Instance.PathVersion.StartsWithF(McFolderSelected) OrElse Not Instance.Check() Then
|
||||
'无效的版本
|
||||
@@ -75,11 +67,9 @@
|
||||
If Not McInstanceListLoader.State = LoadState.Finished Then LoaderFolderRun(McInstanceListLoader, McFolderSelected, LoaderFolderRunType.ForceRun, MaxDepth:=1, ExtraPath:="versions\", WaitForExit:=True)
|
||||
If Not McInstanceList.Any() OrElse McInstanceList.First.Value(0).Logo.Contains("RedstoneBlock") Then
|
||||
Instance = Nothing
|
||||
Setup.Set("LaunchVersionSelect", "")
|
||||
Log("[Launch] 无可用 Minecraft 版本")
|
||||
Else
|
||||
Instance = McInstanceList.First.Value(0)
|
||||
Setup.Set("LaunchVersionSelect", Instance.Name)
|
||||
Log("[Launch] 自动选择 Minecraft 版本:" & Instance.PathVersion)
|
||||
End If
|
||||
End If
|
||||
@@ -94,7 +84,7 @@
|
||||
End Sub, "Version Check", ThreadPriority.AboveNormal)
|
||||
|
||||
'改变页面
|
||||
Dim LoginType As McLoginType = Setup.Get("LoginType")
|
||||
Dim LoginType As McLoginType = Settings.Get("LoginType")
|
||||
If LoginType = McLoginType.Legacy OrElse LoginType = McLoginType.Ms Then CType(FindName("RadioLoginType" & LoginType), MyRadioButton).Checked = True
|
||||
RefreshPage(False, False)
|
||||
|
||||
@@ -108,7 +98,7 @@
|
||||
''' </summary>
|
||||
Public Sub PageChangeToLaunching()
|
||||
'修改登陆方式
|
||||
Select Case Setup.Get("LoginType")
|
||||
Select Case Settings.Get("LoginType")
|
||||
Case McLoginType.Legacy
|
||||
LabLaunchingMethod.Text = "离线登录"
|
||||
Case McLoginType.Ms
|
||||
@@ -279,37 +269,37 @@
|
||||
Dim Type As PageType
|
||||
Dim LoginPageType As Integer
|
||||
If McInstanceSelected IsNot Nothing Then
|
||||
LoginPageType = Setup.Get("VersionServerLogin", Instance:=McInstanceSelected)
|
||||
LoginPageType = Settings.Get("VersionServerLogin", Instance:=McInstanceSelected)
|
||||
'缓存当前版本的页面种类,下一次打开 McInstanceSelected 为空时才能加载出正确的页面
|
||||
Setup.Set("LoginPageType", LoginPageType)
|
||||
Settings.Set("LoginPageType", LoginPageType)
|
||||
Else
|
||||
LoginPageType = Setup.Get("LoginPageType")
|
||||
LoginPageType = Settings.Get("LoginPageType")
|
||||
End If
|
||||
Select Case LoginPageType
|
||||
Case 0 '正版或离线
|
||||
UnknownType:
|
||||
If RadioLoginType5.Checked Then
|
||||
If Setup.Get("CacheMsV2Access") = "" Then
|
||||
If Settings.Get("CacheMsV2Access") = "" Then
|
||||
Type = PageType.Ms
|
||||
Else
|
||||
Type = PageType.MsSkin
|
||||
End If
|
||||
Setup.Set("LoginType", McLoginType.Ms)
|
||||
Settings.Set("LoginType", McLoginType.Ms)
|
||||
Else
|
||||
Type = PageType.Legacy
|
||||
Setup.Set("LoginType", McLoginType.Legacy)
|
||||
Settings.Set("LoginType", McLoginType.Legacy)
|
||||
End If
|
||||
PanType.Visibility = Visibility.Visible
|
||||
PanTypeOne.Visibility = Visibility.Collapsed
|
||||
RadioLoginType5.Visibility = Visibility.Visible
|
||||
RadioLoginType0.Visibility = Visibility.Visible
|
||||
Case 1 '仅正版
|
||||
If Setup.Get("CacheMsV2Access") = "" Then
|
||||
If Settings.Get("CacheMsV2Access") = "" Then
|
||||
Type = PageType.Ms
|
||||
Else
|
||||
Type = PageType.MsSkin
|
||||
End If
|
||||
Setup.Set("LoginType", McLoginType.Ms)
|
||||
Settings.Set("LoginType", McLoginType.Ms)
|
||||
PanType.Visibility = Visibility.Collapsed
|
||||
PanTypeOne.Visibility = Visibility.Visible
|
||||
PathTypeOne.Data = (New GeometryConverter).ConvertFromString(Logo.IconButtonShield)
|
||||
@@ -318,33 +308,33 @@ UnknownType:
|
||||
RadioLoginType0.Visibility = Visibility.Collapsed
|
||||
Case 2 '仅离线
|
||||
Type = PageType.Legacy
|
||||
Setup.Set("LoginType", McLoginType.Legacy)
|
||||
Settings.Set("LoginType", McLoginType.Legacy)
|
||||
PanType.Visibility = Visibility.Collapsed
|
||||
PanTypeOne.Visibility = Visibility.Visible
|
||||
PathTypeOne.Data = (New GeometryConverter).ConvertFromString(Logo.IconButtonOffline)
|
||||
LabTypeOne.Text = "离线登录"
|
||||
Case 3 '统一通行证
|
||||
If Setup.Get("CacheNideAccess") = "" Then
|
||||
If Settings.Get("CacheNideAccess") = "" Then
|
||||
Type = PageType.Nide
|
||||
Else
|
||||
Type = PageType.NideSkin
|
||||
End If
|
||||
Setup.Set("LoginType", McLoginType.Nide)
|
||||
Settings.Set("LoginType", McLoginType.Nide)
|
||||
PanType.Visibility = Visibility.Collapsed
|
||||
PanTypeOne.Visibility = Visibility.Visible
|
||||
PathTypeOne.Data = (New GeometryConverter).ConvertFromString(Logo.IconButtonCard)
|
||||
LabTypeOne.Text = "统一通行证登录"
|
||||
Case 4 'Authlib-Injector
|
||||
If Setup.Get("CacheAuthAccess") = "" Then
|
||||
If Settings.Get("CacheAuthAccess") = "" Then
|
||||
Type = PageType.Auth
|
||||
Else
|
||||
Type = PageType.AuthSkin
|
||||
End If
|
||||
Setup.Set("LoginType", McLoginType.Auth)
|
||||
Settings.Set("LoginType", McLoginType.Auth)
|
||||
PanType.Visibility = Visibility.Collapsed
|
||||
PanTypeOne.Visibility = Visibility.Visible
|
||||
PathTypeOne.Data = (New GeometryConverter).ConvertFromString(Logo.IconButtonCard)
|
||||
LabTypeOne.Text = If(McInstanceSelected Is Nothing, Setup.Get("CacheAuthServerName"), Setup.Get("VersionServerAuthName", Instance:=McInstanceSelected))
|
||||
LabTypeOne.Text = If(McInstanceSelected Is Nothing, Settings.Get("CacheAuthServerName"), Settings.Get("VersionServerAuthName", Instance:=McInstanceSelected))
|
||||
If LabTypeOne.Text = "" Then LabTypeOne.Text = "第三方登录"
|
||||
Case Else
|
||||
Log("[Control] 未知的登录页面:" & LoginPageType, LogLevel.Hint)
|
||||
@@ -353,7 +343,7 @@ UnknownType:
|
||||
'刷新页面
|
||||
If PageCurrent = Type Then Return
|
||||
PageChange(Type, Anim).Reload(KeepInput)
|
||||
Dim Control As MyRadioButton = FindName("RadioLoginType" & Setup.Get("LoginType"))
|
||||
Dim Control As MyRadioButton = FindName("RadioLoginType" & Settings.Get("LoginType"))
|
||||
If Control IsNot Nothing Then Control.Checked = True
|
||||
End Sub
|
||||
Private Sub RadioLoginType_Change(sender As Object, raiseByMouse As Boolean) Handles RadioLoginType0.Check, RadioLoginType5.Check
|
||||
@@ -368,7 +358,7 @@ UnknownType:
|
||||
Public Shared SkinMs As New LoaderTask(Of EqualableList(Of String), String)("Loader Skin Ms", AddressOf SkinMsLoad, AddressOf SkinMsInput, ThreadPriority.AboveNormal)
|
||||
Private Shared Function SkinMsInput() As EqualableList(Of String)
|
||||
'获取名称
|
||||
Return New EqualableList(Of String) From {Setup.Get("CacheMsV2Name"), Setup.Get("CacheMsV2Uuid")}
|
||||
Return New EqualableList(Of String) From {Settings.Get("CacheMsV2Name"), Settings.Get("CacheMsV2Uuid")}
|
||||
End Function
|
||||
Private Shared Sub SkinMsLoad(Data As LoaderTask(Of EqualableList(Of String), String))
|
||||
'清空已有皮肤
|
||||
@@ -384,9 +374,9 @@ UnknownType:
|
||||
End If
|
||||
Try
|
||||
Dim Result As String = McSkinGetAddress(Uuid, "Ms")
|
||||
If Data.IsAborted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
Result = McSkinDownload(Result)
|
||||
If Data.IsAborted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
Data.Output = Result
|
||||
Catch ex As ThreadInterruptedException
|
||||
Data.Output = ""
|
||||
@@ -407,7 +397,7 @@ Finish:
|
||||
'刷新显示
|
||||
If FrmLoginMsSkin IsNot Nothing Then
|
||||
RunInUi(AddressOf FrmLoginMsSkin.Skin.Load)
|
||||
ElseIf Not Data.IsAborted Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
ElseIf Not Data.IsInterrupted Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
Data.Input = Nothing '清空输入,因为皮肤实际上没有被渲染,如果不清空切换到页面的 Start 会由于输入相同而不渲染
|
||||
End If
|
||||
End Sub
|
||||
@@ -416,18 +406,18 @@ Finish:
|
||||
Public Shared SkinLegacy As New LoaderTask(Of EqualableList(Of String), String)("Loader Skin Legacy", AddressOf SkinLegacyLoad, AddressOf SkinLegacyInput, ThreadPriority.AboveNormal)
|
||||
Private Shared Function SkinLegacyInput() As EqualableList(Of String)
|
||||
'根据类型判断输入
|
||||
Dim Type As Integer = Setup.Get("LaunchSkinType")
|
||||
Dim Type As Integer = Settings.Get("LaunchSkinType")
|
||||
Select Case Type
|
||||
Case 0
|
||||
If FrmLoginLegacy IsNot Nothing AndAlso FrmLoginLegacy.IsReloaded Then
|
||||
Return New EqualableList(Of String) From {0, If(FrmLoginLegacy.ComboName.Text.Trim, "")}
|
||||
ElseIf Setup.Get("LoginLegacyName") = "" Then
|
||||
ElseIf Settings.Get("LoginLegacyName") = "" Then
|
||||
Return New EqualableList(Of String) From {0, ""}
|
||||
Else
|
||||
Return New EqualableList(Of String) From {0, If(Setup.Get("LoginLegacyName").ToString.BeforeFirst("¨"), "")}
|
||||
Return New EqualableList(Of String) From {0, If(Settings.Get("LoginLegacyName").ToString.BeforeFirst("¨"), "")}
|
||||
End If
|
||||
Case 3
|
||||
Return New EqualableList(Of String) From {3, Setup.Get("LaunchSkinID")}
|
||||
Return New EqualableList(Of String) From {3, Settings.Get("LaunchSkinID")}
|
||||
Case Else
|
||||
Return New EqualableList(Of String) From {Type}
|
||||
End Select
|
||||
@@ -451,11 +441,11 @@ UseDefault:
|
||||
Data.Output = PathImage & "Skins/Steve.png"
|
||||
Else
|
||||
Dim Result As String = McLoginMojangUuid(ID, True)
|
||||
If Data.IsAborted Then Throw New ThreadInterruptedException("当前任务已取消:" & ID)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & ID)
|
||||
Result = McSkinGetAddress(Result, "Mojang")
|
||||
If Data.IsAborted Then Throw New ThreadInterruptedException("当前任务已取消:" & ID)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & ID)
|
||||
Result = McSkinDownload(Result)
|
||||
If Data.IsAborted Then Throw New ThreadInterruptedException("当前任务已取消:" & ID)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & ID)
|
||||
Data.Output = Result
|
||||
End If
|
||||
Catch ex As ThreadInterruptedException
|
||||
@@ -473,7 +463,7 @@ UseDefault:
|
||||
Case 4 '自定义
|
||||
If Not File.Exists(PathAppdata & "CustomSkin.png") Then
|
||||
Hint("未找到离线皮肤自定义文件,可能它已被删除。PCL 将使用默认的 Steve 皮肤!")
|
||||
Setup.Set("LaunchSkinType", 1)
|
||||
Settings.Set("LaunchSkinType", 1)
|
||||
GoTo UseDefault
|
||||
End If
|
||||
Data.Output = PathAppdata & "CustomSkin.png"
|
||||
@@ -481,7 +471,7 @@ UseDefault:
|
||||
'刷新显示
|
||||
If FrmLoginLegacy IsNot Nothing Then
|
||||
RunInUi(AddressOf FrmLoginLegacy.Skin.Load)
|
||||
ElseIf Not Data.IsAborted Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
ElseIf Not Data.IsInterrupted Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
Data.Input = Nothing '清空输入,因为皮肤实际上没有被渲染,如果不清空切换到页面的 Start 会由于输入相同而不渲染
|
||||
End If
|
||||
End Sub
|
||||
@@ -490,7 +480,7 @@ UseDefault:
|
||||
Public Shared SkinNide As New LoaderTask(Of EqualableList(Of String), String)("Loader Skin Nide", AddressOf SkinNideLoad, AddressOf SkinNideInput, ThreadPriority.AboveNormal)
|
||||
Private Shared Function SkinNideInput() As EqualableList(Of String)
|
||||
'获取名称
|
||||
Return New EqualableList(Of String) From {Setup.Get("CacheNideName"), Setup.Get("CacheNideUuid")}
|
||||
Return New EqualableList(Of String) From {Settings.Get("CacheNideName"), Settings.Get("CacheNideUuid")}
|
||||
End Function
|
||||
Private Shared Sub SkinNideLoad(Data As LoaderTask(Of EqualableList(Of String), String))
|
||||
'清空已有皮肤
|
||||
@@ -506,9 +496,9 @@ UseDefault:
|
||||
End If
|
||||
Try
|
||||
Dim Result As String = McSkinGetAddress(Uuid, "Nide")
|
||||
If Data.IsAborted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
Result = McSkinDownload(Result)
|
||||
If Data.IsAborted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
Data.Output = Result
|
||||
Catch ex As ThreadInterruptedException
|
||||
Data.Output = ""
|
||||
@@ -529,7 +519,7 @@ Finish:
|
||||
'刷新显示
|
||||
If FrmLoginNideSkin IsNot Nothing Then
|
||||
RunInUi(AddressOf FrmLoginNideSkin.Skin.Load)
|
||||
ElseIf Not Data.IsAborted Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
ElseIf Not Data.IsInterrupted Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
Data.Input = Nothing '清空输入,因为皮肤实际上没有被渲染,如果不清空切换到页面的 Start 会由于输入相同而不渲染
|
||||
End If
|
||||
End Sub
|
||||
@@ -538,7 +528,7 @@ Finish:
|
||||
Public Shared SkinAuth As New LoaderTask(Of EqualableList(Of String), String)("Loader Skin Auth", AddressOf SkinAuthLoad, AddressOf SkinAuthInput, ThreadPriority.AboveNormal)
|
||||
Private Shared Function SkinAuthInput() As EqualableList(Of String)
|
||||
'获取名称
|
||||
Return New EqualableList(Of String) From {Setup.Get("CacheAuthName"), Setup.Get("CacheAuthUuid")}
|
||||
Return New EqualableList(Of String) From {Settings.Get("CacheAuthName"), Settings.Get("CacheAuthUuid")}
|
||||
End Function
|
||||
Private Shared Sub SkinAuthLoad(Data As LoaderTask(Of EqualableList(Of String), String))
|
||||
'清空已有皮肤
|
||||
@@ -554,9 +544,9 @@ Finish:
|
||||
End If
|
||||
Try
|
||||
Dim Result As String = McSkinGetAddress(UUID, "Auth")
|
||||
If Data.IsAborted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
Result = McSkinDownload(Result)
|
||||
If Data.IsAborted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
If Data.IsInterrupted Then Throw New ThreadInterruptedException("当前任务已取消:" & UserName)
|
||||
Data.Output = Result
|
||||
Catch ex As ThreadInterruptedException
|
||||
Data.Output = ""
|
||||
@@ -577,7 +567,7 @@ Finish:
|
||||
'刷新显示
|
||||
If FrmLoginAuthSkin IsNot Nothing Then
|
||||
RunInUi(AddressOf FrmLoginAuthSkin.Skin.Load)
|
||||
ElseIf Not Data.IsAborted Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
ElseIf Not Data.IsInterrupted Then '如果已经中断,Input 也被清空,就不会再次刷新
|
||||
Data.Input = Nothing '清空输入,因为皮肤实际上没有被渲染,如果不清空切换到页面的 Start 会由于输入相同而不渲染
|
||||
End If
|
||||
End Sub
|
||||
@@ -601,6 +591,7 @@ Finish:
|
||||
If IsAprilEnabled AndAlso Not IsAprilGiveup Then
|
||||
ThemeUnlock(12, False, "隐藏主题 滑稽彩 已解锁!")
|
||||
IsAprilGiveup = True
|
||||
Settings.Set("AprilDoneYear", Date.Now.Year)
|
||||
FrmLaunchLeft.AprilScaleTrans.ScaleX = 1
|
||||
FrmLaunchLeft.AprilScaleTrans.ScaleY = 1
|
||||
FrmLaunchLeft.AprilPosTrans.X = 0
|
||||
@@ -624,7 +615,7 @@ Finish:
|
||||
CurrentState = 0
|
||||
Else
|
||||
If McInstanceSelected Is Nothing Then
|
||||
If Setup.Get("UiHiddenPageDownload") AndAlso Not PageSetupUI.HiddenForceShow Then
|
||||
If Settings.Get("UiHiddenPageDownload") AndAlso Not PageSetupUI.HiddenForceShow Then
|
||||
CurrentState = 1
|
||||
Else
|
||||
CurrentState = 2
|
||||
@@ -670,7 +661,7 @@ Finish:
|
||||
End Select
|
||||
ExitRefresh:
|
||||
'功能隐藏
|
||||
FrmLaunchLeft.BtnVersion.Visibility = If(Not PageSetupUI.HiddenForceShow AndAlso Setup.Get("UiHiddenFunctionSelect"), Visibility.Collapsed, Visibility.Visible)
|
||||
FrmLaunchLeft.BtnVersion.Visibility = If(Not PageSetupUI.HiddenForceShow AndAlso Settings.Get("UiHiddenFunctionSelect"), Visibility.Collapsed, Visibility.Visible)
|
||||
If CurrentState = 3 Then
|
||||
FrmLaunchLeft.BtnMore.Visibility = FrmLaunchLeft.BtnVersion.Visibility
|
||||
End If
|
||||
@@ -678,7 +669,7 @@ ExitRefresh:
|
||||
'取消按钮
|
||||
Private Sub BtnCancel_Click() Handles BtnCancel.Click
|
||||
If McLaunchLoaderReal IsNot Nothing Then
|
||||
McLaunchLoaderReal.Abort()
|
||||
McLaunchLoaderReal.Interrupt()
|
||||
McLaunchLog("已取消启动")
|
||||
Try
|
||||
If McLaunchWatcher IsNot Nothing Then
|
||||
@@ -703,7 +694,7 @@ ExitRefresh:
|
||||
''' </summary>
|
||||
Public Sub LaunchingRefresh()
|
||||
Try
|
||||
If McLaunchLoaderReal.State = LoadState.Aborted Then Return
|
||||
If McLaunchLoaderReal.State = LoadState.Interrupted Then Return
|
||||
'阶段状态获取
|
||||
Dim IsLaunched As Boolean = False '是否已经启动游戏,只是在等待窗口
|
||||
Try
|
||||
|
||||
@@ -42,17 +42,17 @@ Public Class PageLaunchRight
|
||||
End Sub
|
||||
Private Sub RefreshReal()
|
||||
Dim Content As String = Nothing, Url As String = Nothing
|
||||
Select Case Setup.Get("UiCustomType")
|
||||
Select Case Settings.Get("UiCustomType")
|
||||
Case 1
|
||||
'加载本地文件
|
||||
Log("[Page] 主页自定义数据来源:本地文件")
|
||||
Content = ReadFile(Path & "PCL\Custom.xaml") 'ReadFile 会进行存在检测
|
||||
Case 2
|
||||
'联网下载
|
||||
Url = Setup.Get("UiCustomNet")
|
||||
Url = Settings.Get("UiCustomNet")
|
||||
Case 3
|
||||
'预设
|
||||
Select Case Setup.Get("UiCustomPreset")
|
||||
Select Case Settings.Get("UiCustomPreset")
|
||||
Case 0
|
||||
Log("[Page] 主页预设:你知道吗")
|
||||
Content = "
|
||||
@@ -117,7 +117,7 @@ Public Class PageLaunchRight
|
||||
End Select
|
||||
'联网下载
|
||||
If Not String.IsNullOrWhiteSpace(Url) Then
|
||||
If Url = Setup.Get("CacheSavedPageUrl") AndAlso File.Exists(PathTemp & "Cache\Custom.xaml") Then
|
||||
If Url = Settings.Get("CacheSavedPageUrl") AndAlso File.Exists(PathTemp & "Cache\Custom.xaml") Then
|
||||
'缓存可用
|
||||
Log("[Page] 主页自定义数据来源:联网缓存文件")
|
||||
Content = ReadFile(PathTemp & "Cache\Custom.xaml")
|
||||
@@ -128,7 +128,7 @@ Public Class PageLaunchRight
|
||||
Log("[Page] 主页自定义数据来源:联网全新下载")
|
||||
Hint("正在加载主页……")
|
||||
RunInUiWait(Sub() LoadContent(Nothing)) '在加载结束前清空页面
|
||||
Setup.Set("CacheSavedPageVersion", "")
|
||||
Settings.Set("CacheSavedPageVersion", "")
|
||||
OnlineLoader.Start(New Tuple(Of String, Boolean)(Url, True)) '下载完成后将会再次触发更新
|
||||
Return
|
||||
End If
|
||||
@@ -152,7 +152,7 @@ Public Class PageLaunchRight
|
||||
VersionAddress = Address.Replace(".xaml", ".xaml.ini")
|
||||
Else
|
||||
VersionAddress = Address.BeforeFirst("?")
|
||||
If Not VersionAddress.EndsWith("/") Then VersionAddress += "/"
|
||||
If Not VersionAddress.EndsWithF("/") Then VersionAddress += "/"
|
||||
VersionAddress += "version"
|
||||
If Address.Contains("?") Then VersionAddress += "?" & Address.AfterFirst("?")
|
||||
End If
|
||||
@@ -161,7 +161,7 @@ Public Class PageLaunchRight
|
||||
Try
|
||||
Version = NetRequestByClientRetry(VersionAddress)
|
||||
If Version.Length > 1000 Then Throw New Exception($"获取的主页版本过长({Version.Length} 字符)")
|
||||
Dim CurrentVersion As String = Setup.Get("CacheSavedPageVersion")
|
||||
Dim CurrentVersion As String = Settings.Get("CacheSavedPageVersion")
|
||||
If Version <> "" AndAlso CurrentVersion <> "" AndAlso Version = CurrentVersion Then
|
||||
Log($"[Page] 当前缓存的主页已为最新,当前版本:{Version},检查源:{VersionAddress}")
|
||||
Return
|
||||
@@ -174,8 +174,8 @@ Public Class PageLaunchRight
|
||||
'实际下载
|
||||
Dim FileContent As String = NetRequestByClientRetry(Address)
|
||||
Log($"[Page] 已联网下载主页,内容长度:{FileContent.Length},来源:{Address}")
|
||||
Setup.Set("CacheSavedPageUrl", Address)
|
||||
Setup.Set("CacheSavedPageVersion", Version)
|
||||
Settings.Set("CacheSavedPageUrl", Address)
|
||||
Settings.Set("CacheSavedPageVersion", Version)
|
||||
WriteFile(PathTemp & "Cache\Custom.xaml", FileContent)
|
||||
'若内容变更则要求刷新
|
||||
If LoadedContentHash <> FileContent.GetHashCode() AndAlso ShouldRefresh Then Refresh()
|
||||
@@ -206,8 +206,8 @@ Public Class PageLaunchRight
|
||||
Private Sub ClearCache()
|
||||
LoadedContentHash = -1
|
||||
OnlineLoader.Input = New Tuple(Of String, Boolean)("", True)
|
||||
Setup.Set("CacheSavedPageUrl", "")
|
||||
Setup.Set("CacheSavedPageVersion", "")
|
||||
Settings.Set("CacheSavedPageUrl", "")
|
||||
Settings.Set("CacheSavedPageVersion", "")
|
||||
Log("[Page] 已清空主页缓存")
|
||||
End Sub
|
||||
|
||||
@@ -251,7 +251,7 @@ Public Class PageLaunchRight
|
||||
''' 加载主页失败时调用。
|
||||
''' </summary>
|
||||
Private Sub OnLoadContentFailed(ex As Exception)
|
||||
If ModeDebug OrElse Setup.Get("UiCustomType") = 1 Then
|
||||
If ModeDebug OrElse Settings.Get("UiCustomType") = 1 Then
|
||||
Log(ex, "加载主页失败")
|
||||
If MyMsgBox(If(TypeOf ex Is UnauthorizedAccessException, ex.Message, $"主页内容编写有误,请根据下列错误信息进行检查:{vbCrLf}{ex.GetBrief}"),
|
||||
"加载主页失败", "重试", "取消") = 1 Then ForceRefresh()
|
||||
|
||||
@@ -5,20 +5,20 @@
|
||||
''' </summary>
|
||||
Public Sub Reload(KeepInput As Boolean)
|
||||
'记住密码
|
||||
CheckRemember.Checked = Setup.Get("LoginRemember")
|
||||
CheckRemember.Checked = Settings.Get("LoginRemember")
|
||||
If KeepInput AndAlso Not IsFirstLoad Then '避免第一次就以 KeepInput 的方式加载,导致文本框里没东西
|
||||
'保留输入,只刷新下拉框列表
|
||||
Dim Input As String = ComboName.Text
|
||||
ComboName.ItemsSource = If(Setup.Get("LoginAuthEmail") = "", Nothing, Setup.Get("LoginAuthEmail").ToString.Split("¨"))
|
||||
ComboName.ItemsSource = If(Settings.Get("LoginAuthEmail") = "", Nothing, Settings.Get("LoginAuthEmail").ToString.Split("¨"))
|
||||
ComboName.Text = Input
|
||||
Else
|
||||
'不保留输入,刷新列表后自动选择第一项
|
||||
If Setup.Get("LoginAuthEmail") = "" Then
|
||||
If Settings.Get("LoginAuthEmail") = "" Then
|
||||
ComboName.ItemsSource = Nothing
|
||||
Else
|
||||
ComboName.ItemsSource = Setup.Get("LoginAuthEmail").ToString.Split("¨")
|
||||
ComboName.Text = Setup.Get("LoginAuthEmail").ToString.BeforeFirst("¨")
|
||||
If Setup.Get("LoginRemember") Then TextPass.Password = Setup.Get("LoginAuthPass").ToString.BeforeFirst("¨").Trim
|
||||
ComboName.ItemsSource = Settings.Get("LoginAuthEmail").ToString.Split("¨")
|
||||
ComboName.Text = Settings.Get("LoginAuthEmail").ToString.BeforeFirst("¨")
|
||||
If Settings.Get("LoginRemember") Then TextPass.Password = Settings.Get("LoginAuthPass").ToString.BeforeFirst("¨").Trim
|
||||
End If
|
||||
End If
|
||||
IsFirstLoad = False
|
||||
@@ -27,7 +27,7 @@
|
||||
''' 获取当前页面的登录信息。
|
||||
''' </summary>
|
||||
Public Shared Function GetLoginData() As McLoginServer
|
||||
Dim Server As String = If(IsNothing(McInstanceSelected), Setup.Get("CacheAuthServerServer"), Setup.Get("VersionServerAuthServer", Instance:=McInstanceSelected)) & "/authserver"
|
||||
Dim Server As String = If(IsNothing(McInstanceSelected), Settings.Get("CacheAuthServerServer"), Settings.Get("VersionServerAuthServer", Instance:=McInstanceSelected)) & "/authserver"
|
||||
If FrmLoginAuth Is Nothing Then
|
||||
Return New McLoginServer(McLoginType.Auth) With {.Token = "Auth", .BaseUrl = Server, .UserName = "", .Password = "", .Description = "Authlib-Injector", .Type = McLoginType.Auth}
|
||||
Else
|
||||
@@ -49,20 +49,20 @@
|
||||
'保存输入信息
|
||||
Private Sub ComboName_TextChanged(sender As Object, e As TextChangedEventArgs) Handles ComboName.TextChanged
|
||||
If sender.Text = "" Then TextPass.Password = ""
|
||||
If AniControlEnabled = 0 Then Setup.Set("CacheAuthAccess", "") '迫使其不进行 Validate
|
||||
If AniControlEnabled = 0 Then Settings.Set("CacheAuthAccess", "") '迫使其不进行 Validate
|
||||
End Sub
|
||||
Private Sub TextPass_PasswordChanged(sender As Object, e As RoutedEventArgs) Handles TextPass.PasswordChanged
|
||||
If AniControlEnabled = 0 Then Setup.Set("CacheAuthAccess", "")
|
||||
If AniControlEnabled = 0 Then Settings.Set("CacheAuthAccess", "")
|
||||
End Sub
|
||||
Private Sub ComboName_SelectionChanged(sender As MyComboBox, e As SelectionChangedEventArgs) Handles ComboName.SelectionChanged
|
||||
If sender.SelectedIndex = -1 OrElse Not Setup.Get("LoginRemember") Then
|
||||
If sender.SelectedIndex = -1 OrElse Not Settings.Get("LoginRemember") Then
|
||||
TextPass.Password = ""
|
||||
Else
|
||||
TextPass.Password = Setup.Get("LoginAuthPass").ToString.Split("¨")(sender.SelectedIndex).Trim
|
||||
TextPass.Password = Settings.Get("LoginAuthPass").ToString.Split("¨")(sender.SelectedIndex).Trim
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CheckBoxChange(sender As MyCheckBox, e As Object) Handles CheckRemember.Change
|
||||
If AniControlEnabled = 0 Then Setup.Set(sender.Tag, sender.Checked)
|
||||
If AniControlEnabled = 0 Then Settings.Set(sender.Tag, sender.Checked)
|
||||
End Sub
|
||||
|
||||
'链接处理
|
||||
@@ -71,15 +71,15 @@
|
||||
End Sub
|
||||
Private Sub Btn_Click(sender As Object, e As EventArgs) Handles BtnLink.Click
|
||||
If BtnLink.Content = "注册账号" Then
|
||||
OpenWebsite(If(McInstanceSelected IsNot Nothing, Setup.Get("VersionServerAuthRegister", Instance:=McInstanceSelected), Setup.Get("CacheAuthServerRegister")))
|
||||
OpenWebsite(If(McInstanceSelected IsNot Nothing, Settings.Get("VersionServerAuthRegister", Instance:=McInstanceSelected), Settings.Get("CacheAuthServerRegister")))
|
||||
Else
|
||||
Dim Website As String = If(McInstanceSelected IsNot Nothing, Setup.Get("VersionServerAuthRegister", Instance:=McInstanceSelected), Setup.Get("CacheAuthServerRegister"))
|
||||
Dim Website As String = If(McInstanceSelected IsNot Nothing, Settings.Get("VersionServerAuthRegister", Instance:=McInstanceSelected), Settings.Get("CacheAuthServerRegister"))
|
||||
OpenWebsite(Website.Replace("/auth/register", "/auth/forgot"))
|
||||
End If
|
||||
End Sub
|
||||
'切换注册按钮可见性
|
||||
Private Sub ReloadRegisterButton() Handles Me.Loaded
|
||||
Dim Address As String = If(McInstanceSelected IsNot Nothing, Setup.Get("VersionServerAuthRegister", Instance:=McInstanceSelected), Setup.Get("CacheAuthServerRegister"))
|
||||
Dim Address As String = If(McInstanceSelected IsNot Nothing, Settings.Get("VersionServerAuthRegister", Instance:=McInstanceSelected), Settings.Get("CacheAuthServerRegister"))
|
||||
BtnLink.Visibility = If(String.IsNullOrEmpty(New ValidateHttp().Validate(Address)), Visibility.Visible, Visibility.Collapsed)
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
''' 刷新页面显示的所有信息。
|
||||
''' </summary>
|
||||
Public Sub Reload(KeepInput As Boolean)
|
||||
TextName.Text = Setup.Get("CacheAuthName")
|
||||
TextEmail.Text = Setup.Get("CacheAuthUsername")
|
||||
TextEmail.Visibility = If(Setup.Get("UiLauncherEmail"), Visibility.Collapsed, Visibility.Visible)
|
||||
TextName.Text = Settings.Get("CacheAuthName")
|
||||
TextEmail.Text = Settings.Get("CacheAuthUsername")
|
||||
TextEmail.Visibility = If(Settings.Get("UiLauncherEmail"), Visibility.Collapsed, Visibility.Visible)
|
||||
PageLoginLegacy_Loaded()
|
||||
End Sub
|
||||
''' <summary>
|
||||
''' 获取当前页面的登录信息。
|
||||
''' </summary>
|
||||
Public Shared Function GetLoginData() As McLoginServer
|
||||
Dim Server As String = If(IsNothing(McInstanceSelected), Setup.Get("CacheAuthServerServer"), Setup.Get("VersionServerAuthServer", Instance:=McInstanceSelected)) & "/authserver"
|
||||
Return New McLoginServer(McLoginType.Auth) With {.Token = "Auth", .BaseUrl = Server, .UserName = Setup.Get("CacheAuthUsername"), .Password = Setup.Get("CacheAuthPass"), .Description = "Authlib-Injector", .Type = McLoginType.Auth}
|
||||
Dim Server As String = If(IsNothing(McInstanceSelected), Settings.Get("CacheAuthServerServer"), Settings.Get("VersionServerAuthServer", Instance:=McInstanceSelected)) & "/authserver"
|
||||
Return New McLoginServer(McLoginType.Auth) With {.Token = "Auth", .BaseUrl = Server, .UserName = Settings.Get("CacheAuthUsername"), .Password = Settings.Get("CacheAuthPass"), .Description = "Authlib-Injector", .Type = McLoginType.Auth}
|
||||
End Function
|
||||
|
||||
Private Sub PageLoginAuthSkin_MouseEnter(sender As Object, e As MouseEventArgs) Handles PanData.MouseEnter
|
||||
@@ -55,8 +55,8 @@
|
||||
Return
|
||||
End If
|
||||
Hint("正在尝试更换,请稍候!")
|
||||
Setup.Set("CacheAuthUuid", "") '清空选择缓存
|
||||
Setup.Set("CacheAuthName", "")
|
||||
Settings.Set("CacheAuthUuid", "") '清空选择缓存
|
||||
Settings.Set("CacheAuthName", "")
|
||||
RunInThread(
|
||||
Sub()
|
||||
Try
|
||||
@@ -70,15 +70,15 @@
|
||||
End Sub)
|
||||
End Sub
|
||||
Public Shared Sub ExitLogin() Handles BtnExit.Click
|
||||
Setup.Set("CacheAuthAccess", "")
|
||||
Setup.Set("CacheAuthUuid", "")
|
||||
Setup.Set("CacheAuthName", "")
|
||||
Settings.Set("CacheAuthAccess", "")
|
||||
Settings.Set("CacheAuthUuid", "")
|
||||
Settings.Set("CacheAuthName", "")
|
||||
McLoginAuthLoader.Input = Nothing '防止因为输入的用户名密码相同,直接使用了上次登录的加载器结果
|
||||
FrmLaunchLeft.RefreshPage(False, True)
|
||||
End Sub
|
||||
|
||||
Private Sub Skin_Click(sender As Object, e As MouseButtonEventArgs) Handles Skin.Click
|
||||
Dim Address As String = If(McInstanceSelected IsNot Nothing, Setup.Get("VersionServerAuthRegister", Instance:=McInstanceSelected), Setup.Get("CacheAuthServerRegister"))
|
||||
Dim Address As String = If(McInstanceSelected IsNot Nothing, Settings.Get("VersionServerAuthRegister", Instance:=McInstanceSelected), Settings.Get("CacheAuthServerRegister"))
|
||||
If String.IsNullOrEmpty(New ValidateHttp().Validate(Address)) Then OpenWebsite(Address.Replace("/auth/register", "/user/closet"))
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -18,15 +18,15 @@ Public Class PageLoginLegacy
|
||||
If KeepInput AndAlso IsReloaded Then '避免第一次就以 KeepInput 的方式加载,导致文本框里没东西
|
||||
'保留输入,只刷新下拉框列表
|
||||
Dim Input As String = ComboName.Text.Trim
|
||||
ComboName.ItemsSource = If(Setup.Get("LoginLegacyName") = "", Nothing, Setup.Get("LoginLegacyName").ToString.Split("¨"))
|
||||
ComboName.ItemsSource = If(Settings.Get("LoginLegacyName") = "", Nothing, Settings.Get("LoginLegacyName").ToString.Split("¨"))
|
||||
ComboName.Text = Input
|
||||
Else
|
||||
'不保留输入,刷新列表后自动选择第一项
|
||||
If Setup.Get("LoginLegacyName") = "" Then
|
||||
If Settings.Get("LoginLegacyName") = "" Then
|
||||
ComboName.ItemsSource = Nothing
|
||||
Else
|
||||
ComboName.ItemsSource = Setup.Get("LoginLegacyName").ToString.Split("¨")
|
||||
ComboName.Text = Setup.Get("LoginLegacyName").ToString.BeforeFirst("¨").Trim
|
||||
ComboName.ItemsSource = Settings.Get("LoginLegacyName").ToString.Split("¨")
|
||||
ComboName.Text = Settings.Get("LoginLegacyName").ToString.BeforeFirst("¨").Trim
|
||||
End If
|
||||
End If
|
||||
IsReloaded = True
|
||||
@@ -36,7 +36,7 @@ Public Class PageLoginLegacy
|
||||
''' </summary>
|
||||
Public Shared Function GetLoginData() As McLoginData
|
||||
Dim UserName As String = If(FrmLoginLegacy Is Nothing, "", FrmLoginLegacy.ComboName.Text.Replace("¨", "").Trim)
|
||||
Return New McLoginLegacy With {.UserName = UserName, .SkinType = Setup.Get("LaunchSkinType"), .SkinName = Setup.Get("LaunchSkinID")}
|
||||
Return New McLoginLegacy With {.UserName = UserName, .SkinType = Settings.Get("LaunchSkinType"), .SkinName = Settings.Get("LaunchSkinID")}
|
||||
End Function
|
||||
''' <summary>
|
||||
''' 当前页面的登录信息是否有效。
|
||||
@@ -62,12 +62,12 @@ Public Class PageLoginLegacy
|
||||
End If
|
||||
End Sub
|
||||
Private Sub ComboLegacy_TextChanged(sender As Object, e As TextChangedEventArgs) Handles ComboName.TextChanged
|
||||
If Setup.Get("LaunchSkinType") = 0 Then PageLaunchLeft.SkinLegacy.Start(IsForceRestart:=True)
|
||||
If Settings.Get("LaunchSkinType") = 0 Then PageLaunchLeft.SkinLegacy.Start(IsForceRestart:=True)
|
||||
HintChinese.Visibility = If(RegexCheck(ComboName.Text, "^[0-9A-Za-z_]*$"), Visibility.Collapsed, Visibility.Visible)
|
||||
RunInUi(Sub() PanMain.InvalidateMeasure(), True) '由于 WPF 的 Bug,它不一定会自动更新 HintChinese 的大小(#6627)
|
||||
End Sub
|
||||
Private Sub Skin_Click() Handles Skin.Click
|
||||
If (Setup.Get("UiHiddenPageSetup") OrElse Setup.Get("UiHiddenSetupLaunch")) AndAlso Not PageSetupUI.HiddenForceShow Then
|
||||
If (Settings.Get("UiHiddenPageSetup") OrElse Settings.Get("UiHiddenSetupLaunch")) AndAlso Not PageSetupUI.HiddenForceShow Then
|
||||
Hint("启动设置已被禁用!", HintType.Red)
|
||||
Else
|
||||
FrmMain.PageChange(FormMain.PageType.Setup, FormMain.PageSubType.SetupLaunch) '切换到皮肤设置页面
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
ComboAccounts.Items.Clear()
|
||||
ComboAccounts.Items.Add(New MyComboBoxItem With {.Content = "添加新账号"})
|
||||
Try
|
||||
Dim MsJson As JObject = GetJson(Setup.Get("LoginMsJson"))
|
||||
Dim MsJson As JObject = GetJson(Settings.Get("LoginMsJson"))
|
||||
For Each Account In MsJson
|
||||
Dim Item As MyListItem = CType(FindResource("ComboBoxItemTemplateWithDelete"), DataTemplate).LoadContent()
|
||||
Item.Tag = Account.Value.ToString
|
||||
@@ -18,8 +18,8 @@
|
||||
ComboAccounts.Items.Add(Item)
|
||||
Next
|
||||
Catch ex As Exception
|
||||
Log(ex, $"微软登录信息出错,登录信息已被重置({Setup.Get("LoginMsJson")})", LogLevel.Hint)
|
||||
Setup.Set("LoginMsJson", "{}")
|
||||
Log(ex, $"微软登录信息出错,登录信息已被重置({Settings.Get("LoginMsJson")})", LogLevel.Hint)
|
||||
Settings.Set("LoginMsJson", "{}")
|
||||
End Try
|
||||
'如果不保留输入,刷新列表后自动选择第一项
|
||||
ComboAccounts.SelectedIndex = If(KeepInput, Math.Max(0, IndexBefore), 0)
|
||||
@@ -37,7 +37,7 @@
|
||||
''' 获取当前页面的登录信息。
|
||||
''' </summary>
|
||||
Public Shared Function GetLoginData() As McLoginMs
|
||||
If FrmLoginMs Is Nothing Then Return New McLoginMs With {.OAuthRefreshToken = Setup.Get("CacheMsV2OAuthRefresh"), .UserName = Setup.Get("CacheMsV2Name")}
|
||||
If FrmLoginMs Is Nothing Then Return New McLoginMs With {.OAuthRefreshToken = Settings.Get("CacheMsV2OAuthRefresh"), .UserName = Settings.Get("CacheMsV2Name")}
|
||||
Dim Result As McLoginMs = Nothing
|
||||
RunInUiWait(
|
||||
Sub()
|
||||
@@ -78,7 +78,7 @@
|
||||
Loop
|
||||
If McLoginMsLoader.State = LoadState.Finished Then
|
||||
RunInUi(Sub() FrmLaunchLeft.RefreshPage(False, True))
|
||||
ElseIf McLoginMsLoader.State = LoadState.Aborted Then
|
||||
ElseIf McLoginMsLoader.State = LoadState.Interrupted Then
|
||||
Throw New ThreadInterruptedException
|
||||
ElseIf McLoginMsLoader.Error Is Nothing Then
|
||||
Throw New Exception("未知错误!")
|
||||
@@ -89,7 +89,7 @@
|
||||
Hint("已取消登录!")
|
||||
Catch ex As Exception
|
||||
If ex.Message = "$$" Then
|
||||
ElseIf ex.Message.StartsWith("$") Then
|
||||
ElseIf ex.Message.StartsWithF("$") Then
|
||||
Hint(ex.Message.TrimStart("$"), HintType.Red)
|
||||
ElseIf TypeOf ex Is Security.Authentication.AuthenticationException AndAlso ex.Message.ContainsF("SSL/TLS") Then
|
||||
Log(ex, "正版登录验证失败,请考虑在 [设置 → 其他] 中关闭 [在正版登录时验证 SSL 证书],然后再试。" & vbCrLf & vbCrLf & "原始错误信息:", LogLevel.Msgbox)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
''' 刷新页面显示的所有信息。
|
||||
''' </summary>
|
||||
Public Sub Reload(KeepInput As Boolean)
|
||||
TextName.Text = Setup.Get("CacheMsV2Name")
|
||||
TextName.Text = Settings.Get("CacheMsV2Name")
|
||||
'皮肤在 Loaded 加载
|
||||
End Sub
|
||||
''' <summary>
|
||||
@@ -20,9 +20,9 @@
|
||||
''' </summary>
|
||||
Public Shared Function GetLoginData() As McLoginMs
|
||||
If McLoginMsLoader.State = LoadState.Finished Then
|
||||
Return New McLoginMs With {.OAuthRefreshToken = Setup.Get("CacheMsV2OAuthRefresh"), .UserName = Setup.Get("CacheMsV2Name"), .AccessToken = Setup.Get("CacheMsV2Access"), .Uuid = Setup.Get("CacheMsV2Uuid"), .ProfileJson = Setup.Get("CacheMsV2ProfileJson")}
|
||||
Return New McLoginMs With {.OAuthRefreshToken = Settings.Get("CacheMsV2OAuthRefresh"), .UserName = Settings.Get("CacheMsV2Name"), .AccessToken = Settings.Get("CacheMsV2Access"), .Uuid = Settings.Get("CacheMsV2Uuid"), .ProfileJson = Settings.Get("CacheMsV2ProfileJson")}
|
||||
Else
|
||||
Return New McLoginMs With {.OAuthRefreshToken = Setup.Get("CacheMsV2OAuthRefresh"), .UserName = Setup.Get("CacheMsV2Name")}
|
||||
Return New McLoginMs With {.OAuthRefreshToken = Settings.Get("CacheMsV2OAuthRefresh"), .UserName = Settings.Get("CacheMsV2Name")}
|
||||
End If
|
||||
End Function
|
||||
|
||||
@@ -50,12 +50,12 @@
|
||||
|
||||
'退出登录
|
||||
Private Sub BtnExit_Click() Handles BtnExit.Click
|
||||
Setup.Set("CacheMsV2OAuthRefresh", "")
|
||||
Setup.Set("CacheMsV2Access", "")
|
||||
Setup.Set("CacheMsV2ProfileJson", "")
|
||||
Setup.Set("CacheMsV2Uuid", "")
|
||||
Setup.Set("CacheMsV2Name", "")
|
||||
McLoginMsLoader.Abort()
|
||||
Settings.Set("CacheMsV2OAuthRefresh", "")
|
||||
Settings.Set("CacheMsV2Access", "")
|
||||
Settings.Set("CacheMsV2ProfileJson", "")
|
||||
Settings.Set("CacheMsV2Uuid", "")
|
||||
Settings.Set("CacheMsV2Name", "")
|
||||
McLoginMsLoader.Interrupt()
|
||||
FrmLaunchLeft.RefreshPage(False, True)
|
||||
End Sub
|
||||
|
||||
@@ -93,8 +93,8 @@ Retry:
|
||||
Thread.Sleep(10)
|
||||
Loop
|
||||
If McLoginMsLoader.State = LoadState.Failed Then Throw New Exception("登录失败", McLoginMsLoader.Error)
|
||||
Dim AccessToken As String = Setup.Get("CacheMsV2Access")
|
||||
Dim Uuid As String = Setup.Get("CacheMsV2Uuid")
|
||||
Dim AccessToken As String = Settings.Get("CacheMsV2Access")
|
||||
Dim Uuid As String = Settings.Get("CacheMsV2Uuid")
|
||||
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"},
|
||||
|
||||
@@ -5,20 +5,20 @@
|
||||
''' </summary>
|
||||
Public Sub Reload(KeepInput As Boolean)
|
||||
'记住密码
|
||||
CheckRemember.Checked = Setup.Get("LoginRemember")
|
||||
CheckRemember.Checked = Settings.Get("LoginRemember")
|
||||
If KeepInput AndAlso Not IsFirstLoad Then '避免第一次就以 KeepInput 的方式加载,导致文本框里没东西
|
||||
'保留输入,只刷新下拉框列表
|
||||
Dim Input As String = ComboName.Text
|
||||
ComboName.ItemsSource = If(Setup.Get("LoginNideEmail") = "", Nothing, Setup.Get("LoginNideEmail").ToString.Split("¨"))
|
||||
ComboName.ItemsSource = If(Settings.Get("LoginNideEmail") = "", Nothing, Settings.Get("LoginNideEmail").ToString.Split("¨"))
|
||||
ComboName.Text = Input
|
||||
Else
|
||||
'不保留输入,刷新列表后自动选择第一项
|
||||
If Setup.Get("LoginNideEmail") = "" Then
|
||||
If Settings.Get("LoginNideEmail") = "" Then
|
||||
ComboName.ItemsSource = Nothing
|
||||
Else
|
||||
ComboName.ItemsSource = Setup.Get("LoginNideEmail").ToString.Split("¨")
|
||||
ComboName.Text = Setup.Get("LoginNideEmail").ToString.BeforeFirst("¨")
|
||||
If Setup.Get("LoginRemember") Then TextPass.Password = Setup.Get("LoginNidePass").ToString.BeforeFirst("¨").Trim
|
||||
ComboName.ItemsSource = Settings.Get("LoginNideEmail").ToString.Split("¨")
|
||||
ComboName.Text = Settings.Get("LoginNideEmail").ToString.BeforeFirst("¨")
|
||||
If Settings.Get("LoginRemember") Then TextPass.Password = Settings.Get("LoginNidePass").ToString.BeforeFirst("¨").Trim
|
||||
End If
|
||||
End If
|
||||
IsFirstLoad = False
|
||||
@@ -27,7 +27,7 @@
|
||||
''' 获取当前页面的登录信息。
|
||||
''' </summary>
|
||||
Public Shared Function GetLoginData() As McLoginServer
|
||||
Dim Server As String = If(IsNothing(McInstanceSelected), Setup.Get("CacheNideServer"), Setup.Get("VersionServerNide", Instance:=McInstanceSelected))
|
||||
Dim Server As String = If(IsNothing(McInstanceSelected), Settings.Get("CacheNideServer"), Settings.Get("VersionServerNide", Instance:=McInstanceSelected))
|
||||
If FrmLoginNide Is Nothing Then
|
||||
Return New McLoginServer(McLoginType.Nide) With {.Token = "Nide", .UserName = "", .Password = "", .Description = "统一通行证", .Type = McLoginType.Nide, .BaseUrl = "https://auth.mc-user.com:233/" & Server & "/authserver"}
|
||||
Else
|
||||
@@ -49,20 +49,20 @@
|
||||
'保存输入信息
|
||||
Private Sub ComboName_TextChanged(sender As Object, e As TextChangedEventArgs) Handles ComboName.TextChanged
|
||||
If sender.Text = "" Then TextPass.Password = ""
|
||||
If AniControlEnabled = 0 Then Setup.Set("CacheNideAccess", "") '迫使其不进行 Validate
|
||||
If AniControlEnabled = 0 Then Settings.Set("CacheNideAccess", "") '迫使其不进行 Validate
|
||||
End Sub
|
||||
Private Sub TextPass_PasswordChanged(sender As Object, e As RoutedEventArgs) Handles TextPass.PasswordChanged
|
||||
If AniControlEnabled = 0 Then Setup.Set("CacheNideAccess", "")
|
||||
If AniControlEnabled = 0 Then Settings.Set("CacheNideAccess", "")
|
||||
End Sub
|
||||
Private Sub ComboName_SelectionChanged(sender As MyComboBox, e As SelectionChangedEventArgs) Handles ComboName.SelectionChanged
|
||||
If sender.SelectedIndex = -1 OrElse Not Setup.Get("LoginRemember") Then
|
||||
If sender.SelectedIndex = -1 OrElse Not Settings.Get("LoginRemember") Then
|
||||
TextPass.Password = ""
|
||||
Else
|
||||
TextPass.Password = Setup.Get("LoginNidePass").ToString.Split("¨")(sender.SelectedIndex).Trim
|
||||
TextPass.Password = Settings.Get("LoginNidePass").ToString.Split("¨")(sender.SelectedIndex).Trim
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CheckBoxChange(sender As MyCheckBox, e As Object) Handles CheckRemember.Change
|
||||
If AniControlEnabled = 0 Then Setup.Set(sender.Tag, sender.Checked)
|
||||
If AniControlEnabled = 0 Then Settings.Set(sender.Tag, sender.Checked)
|
||||
End Sub
|
||||
|
||||
'链接处理
|
||||
@@ -71,7 +71,7 @@
|
||||
End Sub
|
||||
Private Sub Btn_Click(sender As Object, e As EventArgs) Handles BtnLink.Click
|
||||
If BtnLink.Content = "注册账号" Then
|
||||
OpenWebsite("https://login.mc-user.com:233/" & Setup.Get("VersionServerNide", Instance:=McInstanceSelected) & "/register")
|
||||
OpenWebsite("https://login.mc-user.com:233/" & Settings.Get("VersionServerNide", Instance:=McInstanceSelected) & "/register")
|
||||
Else
|
||||
OpenWebsite("https://login.mc-user.com:233/account/login")
|
||||
End If
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
''' 刷新页面显示的所有信息。
|
||||
''' </summary>
|
||||
Public Sub Reload(KeepInput As Boolean)
|
||||
TextName.Text = Setup.Get("CacheNideName")
|
||||
TextEmail.Text = Setup.Get("CacheNideUsername")
|
||||
TextEmail.Visibility = If(Setup.Get("UiLauncherEmail"), Visibility.Collapsed, Visibility.Visible)
|
||||
TextName.Text = Settings.Get("CacheNideName")
|
||||
TextEmail.Text = Settings.Get("CacheNideUsername")
|
||||
TextEmail.Visibility = If(Settings.Get("UiLauncherEmail"), Visibility.Collapsed, Visibility.Visible)
|
||||
'皮肤在 Loaded 加载
|
||||
End Sub
|
||||
''' <summary>
|
||||
''' 获取当前页面的登录信息。
|
||||
''' </summary>
|
||||
Public Shared Function GetLoginData() As McLoginServer
|
||||
Dim Server As String = If(IsNothing(McInstanceSelected), Setup.Get("CacheNideServer"), Setup.Get("VersionServerNide", Instance:=McInstanceSelected))
|
||||
Return New McLoginServer(McLoginType.Nide) With {.Token = "Nide", .UserName = Setup.Get("CacheNideUsername"), .Password = Setup.Get("CacheNidePass"), .Description = "统一通行证", .Type = McLoginType.Nide, .BaseUrl = "https://auth.mc-user.com:233/" & Server & "/authserver"}
|
||||
Dim Server As String = If(IsNothing(McInstanceSelected), Settings.Get("CacheNideServer"), Settings.Get("VersionServerNide", Instance:=McInstanceSelected))
|
||||
Return New McLoginServer(McLoginType.Nide) With {.Token = "Nide", .UserName = Settings.Get("CacheNideUsername"), .Password = Settings.Get("CacheNidePass"), .Description = "统一通行证", .Type = McLoginType.Nide, .BaseUrl = "https://auth.mc-user.com:233/" & Server & "/authserver"}
|
||||
End Function
|
||||
|
||||
Private Sub PageLoginNideSkin_MouseEnter(sender As Object, e As MouseEventArgs) Handles PanData.MouseEnter
|
||||
@@ -48,13 +48,13 @@
|
||||
OpenWebsite("https://login.mc-user.com:233/account/changepw")
|
||||
End Sub
|
||||
Public Shared Sub ExitLogin() Handles BtnExit.Click
|
||||
Setup.Set("CacheNideAccess", "")
|
||||
Settings.Set("CacheNideAccess", "")
|
||||
McLoginNideLoader.Input = Nothing '防止因为输入的用户名密码相同,直接使用了上次登录的加载器结果
|
||||
FrmLaunchLeft.RefreshPage(False, True)
|
||||
End Sub
|
||||
|
||||
Private Sub Skin_Click(sender As Object, e As MouseButtonEventArgs) Handles Skin.Click
|
||||
OpenWebsite("https://login.mc-user.com:233/" & If(IsNothing(McInstanceSelected), Setup.Get("CacheNideServer"), Setup.Get("VersionServerNide", Instance:=McInstanceSelected)) & "/skin")
|
||||
OpenWebsite("https://login.mc-user.com:233/" & If(IsNothing(McInstanceSelected), Settings.Get("CacheNideServer"), Settings.Get("VersionServerNide", Instance:=McInstanceSelected)) & "/skin")
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user