Skip to content

Commit a674630

Browse files
committed
2.12.1
1 parent 1ecff91 commit a674630

File tree

14 files changed

+35
-27
lines changed

14 files changed

+35
-27
lines changed

Plain Craft Launcher 2/Controls/MyImage.vb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@
126126
Try
127127
'下载
128128
NetDownloadByLoader(
129-
If(FallbackSource?.StartsWithF("http") AndAlso Source <> FallbackSource, {Source, FallbackSource}, {Source}),
129+
If(FallbackSource IsNot Nothing AndAlso FallbackSource.StartsWithF("http") AndAlso Source <> FallbackSource,
130+
{Source, FallbackSource}, {Source}),
130131
TempPath, SimulateBrowserHeaders:=True)
131132
ActualSource = TempPath
132133
If Not EnableCache Then File.Delete(TempPath)

Plain Craft Launcher 2/FormMain.xaml.vb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,21 @@ Public Class FormMain
118118
'3:BUG+ IMP* FEAT-
119119
'2:BUG* IMP-
120120
'1:BUG-
121+
If LastVersion < 378 Then 'Snapshot 2.12.1
122+
If LastVersion >= 377 Then
123+
FeatureList.Add(New KeyValuePair(Of Integer, String)(1, "修复:在版本列表中存在 OptiFine 时可能无法加载版本列表"))
124+
BugCount += 2
125+
End If
126+
End If
121127
If LastVersion < 377 Then 'Snapshot 2.12.0
122128
If LastVersion >= 373 Then
123129
FeatureList.Add(New KeyValuePair(Of Integer, String)(5, "删除:暂时隐藏联机入口……不过只是暂时关闭,它还会回来的!"))
124130
End If
125131
FeatureList.Add(New KeyValuePair(Of Integer, String)(3, "新增:适配新的 Minecraft 版本号系统与 Unobfuscated 版本"))
126132
FeatureList.Add(New KeyValuePair(Of Integer, String)(2, "优化:巨幅优化各个下载页面和 Mod 管理页面的性能"))
127133
FeatureList.Add(New KeyValuePair(Of Integer, String)(1, "优化:更换披风时会显示当前使用的披风"))
128-
FeatureCount += 31
129-
BugCount += 27
134+
FeatureCount += 33
135+
BugCount += 29
130136
End If
131137
If LastVersion < 375 Then 'Snapshot 2.11.2
132138
'If LastVersion >= 373 Then

Plain Craft Launcher 2/Modules/Base/ModBase.vb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ Public Module ModBase
1414
#Region "声明"
1515

1616
'下列版本信息由更新器自动修改
17-
Public Const VersionBaseName As String = "2.12.0" '不含分支前缀的显示用版本名
18-
Public Const VersionStandardCode As String = "2.12.0." & VersionBranchCode '标准格式的四段式版本号
17+
Public Const VersionBaseName As String = "2.12.1" '不含分支前缀的显示用版本名
18+
Public Const VersionStandardCode As String = "2.12.1." & VersionBranchCode '标准格式的四段式版本号
1919
Public Const CommitHash As String = "" 'Commit Hash,由 GitHub Workflow 自动替换
2020
#If BETA Then
2121
Public Const VersionCode As Integer = 372 'Release
2222
#Else
23-
Public Const VersionCode As Integer = 377 'Snapshot
23+
Public Const VersionCode As Integer = 378 'Snapshot
2424
#End If
2525
'自动生成的版本信息
2626
Public Const VersionDisplayName As String = VersionBranchName & " " & VersionBaseName
@@ -589,8 +589,7 @@ Public Module ModBase
589589
''' </summary>
590590
Public Function ReadReg(Key As String, Optional DefaultValue As String = "") As String
591591
Try
592-
Dim SubKey = My.Computer.Registry.CurrentUser.OpenSubKey("Software\" & RegFolder, False)
593-
Return If(SubKey?.GetValue(Key), DefaultValue)
592+
Return If(My.Computer.Registry.CurrentUser.OpenSubKey("Software\" & RegFolder, False)?.GetValue(Key), DefaultValue)
594593
Catch ex As Exception
595594
Log(ex, "读取注册表出错:" & Key, LogLevel.Hint)
596595
Return DefaultValue

Plain Craft Launcher 2/Modules/Minecraft/ModComp.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@
561561
Dim EndName = McVersion.DropToVersion(EndDrop)
562562
If StartDrop = EndDrop Then
563563
Segments.Add(StartName)
564-
ElseIf AllDrops?.Any AndAlso StartDrop >= AllDrops.First Then
564+
ElseIf AllDrops IsNot Nothing AndAlso StartDrop >= AllDrops.First Then
565565
If EndDrop < 100 Then
566566
Segments.Clear()
567567
Segments.Add("全版本")

Plain Craft Launcher 2/Modules/Minecraft/ModDownload.vb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,16 @@
152152
#Region "DlClientList | Minecraft 客户端 版本列表"
153153

154154
''' <summary>
155-
''' 所有正式版的 Minecraft Drop 序数,按从高到低排列
156-
''' Nothing 代表从未完成过获取
155+
''' 所有正式版的 Minecraft Drop 序数。
156+
''' 若从未完成过获取,返回 Nothing;否则必定存在元素,且从高到低排列
157157
''' </summary>
158158
Public Property AllDrops As List(Of Integer)
159159
Get
160-
If _AllDrops Is Nothing Then _AllDrops = Setup.Get("CacheDrops").ToString.Split(","c).Select(Function(d) CInt(d)).ToList()
161-
If Not _AllDrops.Any Then _AllDrops = Nothing
162-
Return _AllDrops
160+
If _AllDrops Is Nothing Then
161+
_AllDrops = Setup.Get("CacheDrops").ToString.
162+
Split(",".ToCharArray, StringSplitOptions.RemoveEmptyEntries).Select(Function(d) CInt(Val(d))).ToList()
163+
End If
164+
Return If(_AllDrops.Any, _AllDrops, Nothing) '不要将 _AllDrops 再设为 Nothing,以防止反复获取设置尝试初始化
163165
End Get
164166
Set(value As List(Of Integer))
165167
_AllDrops = value

Plain Craft Launcher 2/Modules/Minecraft/ModJava.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ Wait:
730730
TargetEntry = Components.Property(Loader.Input)
731731
Else '模糊匹配
732732
TargetEntry = Components.Properties.FirstOrDefault(
733-
Function(c) c.Value?.ToArray.FirstOrDefault()?("version")("name").ToString.StartsWithF(Loader.Input))
733+
Function(c) c.Value IsNot Nothing AndAlso c.Value.ToArray.FirstOrDefault()?("version")("name").ToString.StartsWithF(Loader.Input))
734734
If TargetEntry Is Nothing Then Throw New Exception($"未能找到所需的 Java {Loader.Input}")
735735
End If
736736
Dim TargetComponent = TargetEntry.Value.ToArray.FirstOrDefault

Plain Craft Launcher 2/Modules/Minecraft/ModMinecraft.vb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Public Module ModMinecraft
158158

159159
#Region "版本处理"
160160

161-
Public Const McInstanceCacheVersion As Integer = 32
161+
Public Const McInstanceCacheVersion As Integer = 33
162162

163163
Private _McInstanceSelected As McInstance
164164
''' <summary>
@@ -1013,10 +1013,10 @@ ExitDataLoad:
10131013
'字母编号,如 G2 中的 G(7)
10141014
Dim Result As Integer = Asc(OptiFine.ToUpper.First) - Asc("A"c) + 1
10151015
'末尾数字,如 C5 beta4 中的 5
1016-
Result *= Result * 100
1016+
Result *= 100
10171017
Result += Val(RegexSeek(Right(OptiFine, OptiFine.Length - 1), "[0-9]+"))
10181018
'测试标记(正式版为 99,Pre[x] 为 50+x,Beta[x] 为 x)
1019-
Result *= Result * 100
1019+
Result *= 100
10201020
If OptiFine.ContainsF("pre", True) Then Result += 50
10211021
If OptiFine.ContainsF("pre", True) OrElse OptiFine.ContainsF("beta", True) Then
10221022
If Val(Right(OptiFine, 1)) = 0 AndAlso Right(OptiFine, 1) <> "0" Then

Plain Craft Launcher 2/Modules/Minecraft/ModMod.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Public Module ModMod
115115
End Get
116116
Set(value As String)
117117
If _Version IsNot Nothing AndAlso RegexCheck(_Version, "[0-9.\-]+") Then Return
118-
If value?.ContainsF("version", True) Then value = "version" '需要修改的标识
118+
If value IsNot Nothing AndAlso value.ContainsF("version", True) Then value = "version" '需要修改的标识
119119
_Version = value
120120
End Set
121121
End Property

Plain Craft Launcher 2/Modules/Minecraft/ModModpack.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ Retry:
278278
If ModJson("modules").Any Then 'modules 可能返回 null(#1006)
279279
Dim ModuleNames = CType(ModJson("modules"), JArray).Select(Function(l) l("name").ToString).ToList
280280
If ModuleNames.Contains("META-INF") OrElse ModuleNames.Contains("mcmod.info") OrElse
281-
ModJson?("FileName")?.ToString?.EndsWithF(".jar", True) Then
281+
ModJson?("FileName")?.ToString.EndsWithF(".jar", True) Then
282282
TargetFolder = "mods" : Type = CompType.Mod
283283
ElseIf ModuleNames.Contains("pack.mcmeta") Then
284284
TargetFolder = "resourcepacks" : Type = CompType.ResourcePack

Plain Craft Launcher 2/Modules/ModEvent.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ Public Class CustomEvent
175175
Public Shared Sub Raise(Type As EventType, Arg As String)
176176
If Type = EventType.None Then Return
177177
Log($"[Control] 执行自定义事件:{Type}, {Arg}")
178+
If Arg Is Nothing Then Arg = ""
179+
Dim Args As String() = Arg.Split("|")
178180
Try
179-
Dim Args As String() = If(Arg?.Split("|"), {""})
180181
Select Case Type
181-
182182
Case EventType.打开网页
183183
Arg = Arg.Replace("\", "/")
184184
If Not Arg.Contains("://") OrElse Arg.StartsWithF("file", True) Then '为了支持更多协议(#2200)

0 commit comments

Comments
 (0)