2.7.3
This commit is contained in:
@@ -11,12 +11,12 @@ Public Module ModBase
|
||||
#Region "声明"
|
||||
|
||||
'下列版本信息由更新器自动修改
|
||||
Public Const VersionBaseName As String = "2.7.2" '不含分支前缀的显示用版本名
|
||||
Public Const VersionStandardCode As String = "2.7.2." & VersionBranchCode '标准格式的四段式版本号
|
||||
Public Const VersionBaseName As String = "2.7.3" '不含分支前缀的显示用版本名
|
||||
Public Const VersionStandardCode As String = "2.7.3." & VersionBranchCode '标准格式的四段式版本号
|
||||
#If BETA Then
|
||||
Public Const VersionCode As Integer = 321 'Release
|
||||
Public Const VersionCode As Integer = 323 'Release
|
||||
#Else
|
||||
Public Const VersionCode As Integer = 322 'Snapshot
|
||||
Public Const VersionCode As Integer = 324 'Snapshot
|
||||
#End If
|
||||
'自动生成的版本信息
|
||||
Public Const VersionDisplayName As String = VersionBranchName & " " & VersionBaseName
|
||||
@@ -1817,15 +1817,11 @@ Re:
|
||||
''' <summary>
|
||||
''' 数组去重。
|
||||
''' </summary>
|
||||
Public Function Distinct(Of T)(Arr As ICollection(Of T), Optional IsEqual As CompareThreadStart(Of T) = Nothing) As List(Of T)
|
||||
<Extension> Public Function Distinct(Of T)(Arr As ICollection(Of T), IsEqual As CompareThreadStart(Of T)) As List(Of T)
|
||||
Dim ResultArray As New List(Of T)
|
||||
For i = 0 To Arr.Count - 1
|
||||
For ii = i + 1 To Arr.Count - 1
|
||||
If IsEqual Is Nothing Then
|
||||
If Arr(i).Equals(Arr(ii)) Then GoTo NextElement
|
||||
Else
|
||||
If IsEqual(Arr(i), Arr(ii)) Then GoTo NextElement
|
||||
End If
|
||||
If IsEqual(Arr(i), Arr(ii)) Then GoTo NextElement
|
||||
Next
|
||||
ResultArray.Add(Arr(i))
|
||||
NextElement:
|
||||
@@ -2073,7 +2069,7 @@ NextElement:
|
||||
''' 按照既定的函数进行选择排序。
|
||||
''' </summary>
|
||||
''' <param name="SortRule">传入两个对象,若第一个对象应该排在前面,则返回 True。</param>
|
||||
Public Function Sort(Of T)(List As IList(Of T), SortRule As CompareThreadStart(Of T)) As List(Of T)
|
||||
<Extension> Public Function Sort(Of T)(List As IList(Of T), SortRule As CompareThreadStart(Of T)) As List(Of T)
|
||||
Dim NewList As New List(Of T)
|
||||
While List.Any
|
||||
Dim Highest = List(0)
|
||||
|
||||
@@ -517,7 +517,7 @@ RequestFinished:
|
||||
''' </summary>
|
||||
Finish = 6
|
||||
''' <summary>
|
||||
''' 已失败。
|
||||
''' 已失败或中断。
|
||||
''' </summary>
|
||||
[Error] = 7
|
||||
End Enum
|
||||
@@ -1035,6 +1035,7 @@ StartThread:
|
||||
SecretHeadersSign(Info.Source.Url, HttpRequest, UseBrowserUserAgent)
|
||||
Dim ContentLength As Long = 0
|
||||
Using HttpResponse As HttpWebResponse = HttpRequest.GetResponse()
|
||||
If State = NetState.Error Then GoTo SourceBreak '快速中断
|
||||
If ModeDebug AndAlso HttpResponse.ResponseUri.OriginalString <> Info.Source.Url Then
|
||||
Log($"[Download] {LocalName} {Info.Uuid}#:重定向至 {HttpResponse.ResponseUri.OriginalString}")
|
||||
End If
|
||||
@@ -1379,14 +1380,7 @@ Retry:
|
||||
'凉凉
|
||||
State = NetState.Error
|
||||
End SyncLock
|
||||
Try
|
||||
If File.Exists(LocalPath) Then File.Delete(LocalPath)
|
||||
Catch
|
||||
End Try
|
||||
SyncLock NetManager.LockRemain
|
||||
NetManager.FileRemain -= 1
|
||||
Log("[Download] " & LocalName & ":已失败,剩余文件 " & NetManager.FileRemain)
|
||||
End SyncLock
|
||||
InterruptAndDelete()
|
||||
For Each Task In Tasks
|
||||
Task.OnFileFail(Me)
|
||||
Next
|
||||
@@ -1395,7 +1389,7 @@ Retry:
|
||||
''' 下载中断。
|
||||
''' </summary>
|
||||
Public Sub Abort(CausedByTask As LoaderDownload)
|
||||
'确认任务移除
|
||||
'从特定任务中移除,如果它还属于其他任务,则继续下载
|
||||
SyncLock LockTasks
|
||||
Tasks.Remove(CausedByTask)
|
||||
If Tasks.Any Then Exit Sub
|
||||
@@ -1405,9 +1399,14 @@ Retry:
|
||||
If State >= NetState.Finish Then Exit Sub
|
||||
State = NetState.Error
|
||||
End SyncLock
|
||||
InterruptAndDelete()
|
||||
End Sub
|
||||
Private Sub InterruptAndDelete()
|
||||
On Error Resume Next
|
||||
If File.Exists(LocalPath) Then File.Delete(LocalPath)
|
||||
SyncLock NetManager.LockRemain
|
||||
NetManager.FileRemain -= 1
|
||||
If ModeDebug Then Log("[Download] " & LocalName & ":已取消,剩余文件 " & NetManager.FileRemain)
|
||||
Log($"[Download] {LocalName}:状态 {State},剩余文件 {NetManager.FileRemain}")
|
||||
End SyncLock
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user