This commit is contained in:
龙腾猫跃
2022-11-03 22:29:41 +08:00
parent e9b34ad998
commit ef32179598
42 changed files with 4212 additions and 187 deletions
@@ -10,12 +10,12 @@ Public Module ModBase
#Region "声明"
'下列版本信息由更新器自动修改
Public Const VersionBaseName As String = "2.4.0" '不含分支前缀的显示用版本名
Public Const VersionStandardCode As String = "2.4.0." & VersionBranchCode '标准格式的四段式版本号
Public Const VersionBaseName As String = "2.4.1" '不含分支前缀的显示用版本名
Public Const VersionStandardCode As String = "2.4.1." & VersionBranchCode '标准格式的四段式版本号
#If BETA Then
Public Const VersionCode As Integer = 265 'Release
Public Const VersionCode As Integer = 268 'Release
#Else
Public Const VersionCode As Integer = 266 'Snapshot
Public Const VersionCode As Integer = 267 'Snapshot
#End If
'自动生成的版本信息
Public Const VersionDisplayName As String = VersionBranchName & " " & VersionBaseName
@@ -1236,7 +1236,7 @@ Re:
Directory.CreateDirectory(DestDirectory)
If CompressFilePath.EndsWith(".zip") OrElse CompressFilePath.EndsWith(".jar") Then
'以 zip 方式解压
ZipFile.ExtractToDirectory(CompressFilePath, DestDirectory, If(Encode, Encoding.Default))
ZipFile.ExtractToDirectory(CompressFilePath, DestDirectory, If(Encode, Encoding.GetEncoding("GB18030")))
Return True
ElseIf CompressFilePath.EndsWith(".gz") Then
'以 gz 方式解压
@@ -2301,7 +2301,7 @@ Retry:
RunInNewThread(Sub()
Dim IsInitSuccess As Boolean = True
Try
For i = 4 To 1
For i = 4 To 1 Step -1
If File.Exists(Path & "PCL\Log" & i & ".txt") Then
If File.Exists(Path & "PCL\Log" & (i + 1) & ".txt") Then File.Delete(Path & "PCL\Log" & (i + 1) & ".txt")
CopyFile(Path & "PCL\Log" & i & ".txt", Path & "PCL\Log" & (i + 1) & ".txt")
@@ -96,7 +96,9 @@ Retry:
''' </summary>
''' <param name="Url">网页的 Url。</param>
''' <param name="Encode">网页的编码,通常为 UTF-8。</param>
Public Function NetGetCodeByRequestRetry(Url As String, Optional Encode As Encoding = Nothing, Optional Accept As String = "", Optional IsJson As Boolean = False)
''' <param name="BackupUrl">如果第一次尝试失败,换用的备用 URL。</param>
Public Function NetGetCodeByRequestRetry(Url As String, Optional Encode As Encoding = Nothing, Optional Accept As String = "",
Optional IsJson As Boolean = False, Optional BackupUrl As String = Nothing)
Dim RetryCount As Integer = 0
Dim RetryException As Exception = Nothing
Dim StartTime As Long = GetTimeTick()
@@ -107,12 +109,12 @@ Retry:
Return NetGetCodeRequest(Url, Encode, 10000, IsJson, Accept)
Case 1 '慢速重试
Thread.Sleep(500)
Return NetGetCodeRequest(Url, Encode, 30000, IsJson, Accept)
Return NetGetCodeRequest(If(BackupUrl, Url), Encode, 30000, IsJson, Accept)
Case Else '快速重试
If GetTimeTick() - StartTime > 5500 Then
'若前两次加载耗费 5 秒以上,才进行重试
Thread.Sleep(500)
Return NetGetCodeRequest(Url, Encode, 4000, IsJson, Accept)
Return NetGetCodeRequest(If(BackupUrl, Url), Encode, 4000, IsJson, Accept)
Else
Throw RetryException
End If