fix(ModDownload): 修复mc同一版本更新日志可能多次出现
This commit is contained in:
@@ -196,6 +196,7 @@
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
Public DlClientListMojangLoader As New LoaderTask(Of String, DlClientListResult)("DlClientList Mojang", AddressOf DlClientListMojangMain)
|
Public DlClientListMojangLoader As New LoaderTask(Of String, DlClientListResult)("DlClientList Mojang", AddressOf DlClientListMojangMain)
|
||||||
Private IsNewClientVersionHinted As Boolean = False
|
Private IsNewClientVersionHinted As Boolean = False
|
||||||
|
Private ReadOnly HintLock As New Object() ' 线程安全锁
|
||||||
Private Sub DlClientListMojangMain(Loader As LoaderTask(Of String, DlClientListResult))
|
Private Sub DlClientListMojangMain(Loader As LoaderTask(Of String, DlClientListResult))
|
||||||
Dim StartTime As Long = GetTimeTick()
|
Dim StartTime As Long = GetTimeTick()
|
||||||
Dim Json As JObject = GetJson(NetRequestByClientRetry("https://launchermeta.mojang.com/mc/game/version_manifest.json"))
|
Dim Json As JObject = GetJson(NetRequestByClientRetry("https://launchermeta.mojang.com/mc/game/version_manifest.json"))
|
||||||
@@ -215,15 +216,24 @@
|
|||||||
'解析更新提示(Release)
|
'解析更新提示(Release)
|
||||||
Dim Version As String = Json("latest")("release")
|
Dim Version As String = Json("latest")("release")
|
||||||
If Setup.Get("ToolUpdateRelease") AndAlso Not Setup.Get("ToolUpdateReleaseLast") = "" AndAlso Version IsNot Nothing AndAlso Not Setup.Get("ToolUpdateReleaseLast") = Version Then
|
If Setup.Get("ToolUpdateRelease") AndAlso Not Setup.Get("ToolUpdateReleaseLast") = "" AndAlso Version IsNot Nothing AndAlso Not Setup.Get("ToolUpdateReleaseLast") = Version Then
|
||||||
|
SyncLock HintLock
|
||||||
|
If Not IsNewClientVersionHinted Then ' 在锁内再次检查
|
||||||
McDownloadClientUpdateHint(Version, Json)
|
McDownloadClientUpdateHint(Version, Json)
|
||||||
IsNewClientVersionHinted = True
|
IsNewClientVersionHinted = True
|
||||||
End If
|
End If
|
||||||
|
End SyncLock
|
||||||
|
End If
|
||||||
McVersionHighest = Version.Split(".")(1)
|
McVersionHighest = Version.Split(".")(1)
|
||||||
Setup.Set("ToolUpdateReleaseLast", Version)
|
Setup.Set("ToolUpdateReleaseLast", Version)
|
||||||
'解析更新提示(Snapshot)
|
'解析更新提示(Snapshot)
|
||||||
Version = Json("latest")("snapshot")
|
Version = Json("latest")("snapshot")
|
||||||
If Setup.Get("ToolUpdateSnapshot") AndAlso Not Setup.Get("ToolUpdateSnapshotLast") = "" AndAlso Version IsNot Nothing AndAlso Not Setup.Get("ToolUpdateSnapshotLast") = Version AndAlso Not IsNewClientVersionHinted Then
|
If Setup.Get("ToolUpdateSnapshot") AndAlso Not Setup.Get("ToolUpdateSnapshotLast") = "" AndAlso Version IsNot Nothing AndAlso Not Setup.Get("ToolUpdateSnapshotLast") = Version Then
|
||||||
|
SyncLock HintLock
|
||||||
|
If Not IsNewClientVersionHinted Then ' 在锁内再次检查
|
||||||
McDownloadClientUpdateHint(Version, Json)
|
McDownloadClientUpdateHint(Version, Json)
|
||||||
|
IsNewClientVersionHinted = True
|
||||||
|
End If
|
||||||
|
End SyncLock
|
||||||
End If
|
End If
|
||||||
Setup.Set("ToolUpdateSnapshotLast", If(Version, "Nothing"))
|
Setup.Set("ToolUpdateSnapshotLast", If(Version, "Nothing"))
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|||||||
Reference in New Issue
Block a user