2.10.7
This commit is contained in:
@@ -106,6 +106,14 @@
|
||||
DefaultChecked="True" />
|
||||
</local:MyCheckBox.Tag>
|
||||
</local:MyCheckBox>
|
||||
<local:MyCheckBox>
|
||||
<local:MyCheckBox.Tag>
|
||||
<local:ExportOption
|
||||
Title="TaCZ 枪包"
|
||||
Rules="tacz/|config/tacz/custom/"
|
||||
DefaultChecked="True" />
|
||||
</local:MyCheckBox.Tag>
|
||||
</local:MyCheckBox>
|
||||
<local:MyCheckBox>
|
||||
<local:MyCheckBox.Tag>
|
||||
<local:ExportOption
|
||||
@@ -133,14 +141,6 @@
|
||||
DefaultChecked="False" />
|
||||
</local:MyCheckBox.Tag>
|
||||
</local:MyCheckBox>
|
||||
<local:MyCheckBox>
|
||||
<local:MyCheckBox.Tag>
|
||||
<local:ExportOption
|
||||
Title="TaCZ 枪包"
|
||||
Rules="tacz/|config/tacz/custom/"
|
||||
DefaultChecked="False" />
|
||||
</local:MyCheckBox.Tag>
|
||||
</local:MyCheckBox>
|
||||
<local:MyCheckBox>
|
||||
<local:MyCheckBox.Tag>
|
||||
<local:ExportOption
|
||||
|
||||
@@ -418,7 +418,7 @@ Public Class PageVersionExport
|
||||
Log($"[Export] 使用配置文件中指定的导出路径:{ConfigPackPath}")
|
||||
Catch ex As Exception
|
||||
Log(ex, $"无法使用配置文件中指定的导出路径({ConfigPackPath})", LogLevel.Debug)
|
||||
If MyMsgBox($"指定的路径:{ConfigPackPath}{vbCrLf}{vbCrLf}{GetExceptionDetail(ex)}", "无法使用配置文件中指定的导出路径", "确定", "取消") = 2 Then Return
|
||||
If MyMsgBox($"指定的路径:{ConfigPackPath}{vbCrLf}{vbCrLf}{ex.GetDetail}", "无法使用配置文件中指定的导出路径", "确定", "取消") = 2 Then Return
|
||||
End Try
|
||||
End If
|
||||
If PackPath Is Nothing Then
|
||||
@@ -530,6 +530,7 @@ Public Class PageVersionExport
|
||||
Loader.Progress = 0.97
|
||||
'复制 PCL 版本设置
|
||||
CopyDirectory(McVersion.Path & "PCL\", OverridesFolder & "PCL\")
|
||||
WriteIni(OverridesFolder & "PCL\Setup.ini", "IsStar", False)
|
||||
#If BETA Then
|
||||
'复制 PCL 本体
|
||||
If IncludePCL Then CopyFile(PathWithName, CacheFolder & "Plain Craft Launcher.exe")
|
||||
|
||||
@@ -681,7 +681,7 @@ Install:
|
||||
Hint($"已成功更新 {FinishedFileNames.Count} 个 Mod!", HintType.Finish)
|
||||
End Select
|
||||
Case LoadState.Failed
|
||||
Hint("Mod 更新失败:" & GetExceptionSummary(Loader.Error), HintType.Critical)
|
||||
Hint("Mod 更新失败:" & Loader.Error.GetBrief(), HintType.Critical)
|
||||
Case LoadState.Aborted
|
||||
Hint("Mod 更新已中止!", HintType.Info)
|
||||
Case Else
|
||||
@@ -808,7 +808,7 @@ Install:
|
||||
Dim ModEntry As McMod = CType(If(TypeOf sender Is MyIconButton, sender.Tag, sender), MyLocalModItem).Entry
|
||||
'加载失败信息
|
||||
If ModEntry.State = McMod.McModState.Unavailable Then
|
||||
MyMsgBox("无法读取此 Mod 的信息。" & vbCrLf & vbCrLf & "详细的错误信息:" & GetExceptionDetail(ModEntry.FileUnavailableReason), "Mod 读取失败")
|
||||
MyMsgBox("无法读取此 Mod 的信息。" & vbCrLf & vbCrLf & "详细的错误信息:" & ModEntry.FileUnavailableReason.GetDetail(), "Mod 读取失败")
|
||||
Return
|
||||
End If
|
||||
If ModEntry.Comp IsNot Nothing Then
|
||||
|
||||
@@ -109,25 +109,23 @@
|
||||
Dim OldName As String = PageVersionLeft.Version.Name
|
||||
Dim OldPath As String = PageVersionLeft.Version.Path
|
||||
'修改此部分的同时修改快速安装的版本名检测*
|
||||
Dim NewName As String = MyMsgBoxInput("重命名版本", "", OldName, New ObjectModel.Collection(Of Validate) From {New ValidateFolderName(PathMcFolder & "versions", IgnoreCase:=False)})
|
||||
Dim NewName As String = MyMsgBoxInput("重命名版本", "", OldName, New ObjectModel.Collection(Of Validate) From {
|
||||
New ValidateFolderName(PathMcFolder & "versions", IgnoreCase:=False), New ValidateExceptSame(OldName & "_temp", "不能使用该名称!")})
|
||||
If String.IsNullOrWhiteSpace(NewName) Then Return
|
||||
Dim NewPath As String = PathMcFolder & "versions\" & NewName & "\"
|
||||
'获取临时中间名,以防止仅修改大小写的重命名失败
|
||||
Dim TempName As String = NewName & "_temp"
|
||||
Dim TempPath As String = PathMcFolder & "versions\" & TempName & "\"
|
||||
Dim IsCaseChangedOnly As Boolean = NewName.ToLower = OldName.ToLower
|
||||
|
||||
'读取版本 JSON 信息
|
||||
Dim OnlyChangedCase As Boolean = NewName.ToLower = OldName.ToLower
|
||||
'重新读取版本 JSON 信息,避免 JsonObject 中已被合并的项被重新存储
|
||||
Dim JsonObject As JObject
|
||||
Dim OldJsonPath As String = ""
|
||||
Dim OldJsonPath As String = PageVersionLeft.Version.GetJsonPath()
|
||||
Try
|
||||
OldJsonPath = PageVersionLeft.Version.GetJsonPath()
|
||||
JsonObject = GetJson(ReadFile(OldJsonPath))
|
||||
Catch ex As Exception
|
||||
Log(ex, "在重命名读取 json 时失败")
|
||||
JsonObject = PageVersionLeft.Version.JsonObject
|
||||
End Try
|
||||
|
||||
'重命名主文件夹
|
||||
My.Computer.FileSystem.RenameDirectory(OldPath, TempName)
|
||||
My.Computer.FileSystem.RenameDirectory(TempPath, NewName)
|
||||
@@ -137,7 +135,7 @@
|
||||
'重命名 jar 文件与 natives 文件夹
|
||||
'不能进行遍历重命名,否则在版本名很短的时候容易误伤其他文件(#6443)
|
||||
If Directory.Exists($"{NewPath}{OldName}-natives") Then
|
||||
If IsCaseChangedOnly Then
|
||||
If OnlyChangedCase Then
|
||||
My.Computer.FileSystem.RenameDirectory($"{NewPath}{OldName}-natives", $"{OldName}natives_temp")
|
||||
My.Computer.FileSystem.RenameDirectory($"{NewPath}{OldName}-natives_temp", $"{NewName}-natives")
|
||||
Else
|
||||
@@ -146,7 +144,7 @@
|
||||
End If
|
||||
End If
|
||||
If File.Exists($"{NewPath}{OldName}.jar") Then
|
||||
If IsCaseChangedOnly Then
|
||||
If OnlyChangedCase Then
|
||||
My.Computer.FileSystem.RenameFile($"{NewPath}{OldName}.jar", $"{OldName}_temp.jar")
|
||||
My.Computer.FileSystem.RenameFile($"{NewPath}{OldName}_temp.jar", $"{NewName}.jar")
|
||||
Else
|
||||
@@ -162,48 +160,14 @@
|
||||
If ReadIni(PathMcFolder & "PCL.ini", "Version") = OldName Then
|
||||
WriteIni(PathMcFolder & "PCL.ini", "Version", NewName)
|
||||
End If
|
||||
|
||||
'处理JSON文件:先写入新文件,再删除旧文件
|
||||
'更新版本 Json
|
||||
Try
|
||||
'更新JSON内容中的id
|
||||
JsonObject("id") = NewName
|
||||
'写入新的JSON文件
|
||||
WriteFile(NewPath & NewName & ".json", JsonObject.ToString)
|
||||
|
||||
'删除旧的JSON文件(现在在新路径下)
|
||||
Dim OldJsonInNewPath As String = NewPath & OldName & ".json"
|
||||
If File.Exists(OldJsonInNewPath) Then
|
||||
File.Delete(OldJsonInNewPath)
|
||||
End If
|
||||
File.Delete(NewPath & GetFileNameFromPath(OldJsonPath))
|
||||
Catch ex As Exception
|
||||
Log(ex, "重命名版本 json 失败")
|
||||
'如果JSON处理失败,尝试回滚整个操作
|
||||
If Directory.Exists(NewPath) AndAlso Not Directory.Exists(OldPath) Then
|
||||
Try
|
||||
'还原jar文件名
|
||||
If File.Exists($"{NewPath}{NewName}.jar") Then
|
||||
My.Computer.FileSystem.RenameFile($"{NewPath}{NewName}.jar", $"{OldName}.jar")
|
||||
End If
|
||||
'还原natives文件夹名
|
||||
If Directory.Exists($"{NewPath}{NewName}-natives") Then
|
||||
My.Computer.FileSystem.RenameDirectory($"{NewPath}{NewName}-natives", $"{OldName}-natives")
|
||||
End If
|
||||
Catch
|
||||
' 忽略 jar 文件, natives 文件夹还原失败
|
||||
End Try
|
||||
End If
|
||||
Try
|
||||
'还原文件夹名
|
||||
My.Computer.FileSystem.RenameDirectory(NewPath, OldName)
|
||||
Hint("重命名失败:无法处理版本配置文件,已回滚更改", HintType.Critical)
|
||||
Return
|
||||
Catch rollbackEx As Exception
|
||||
Log(rollbackEx, "重命名失败后尝试回滚也失败")
|
||||
Hint("重命名失败:版本文件可能已损坏,请检查版本文件夹", HintType.Critical)
|
||||
Return
|
||||
End Try
|
||||
End Try
|
||||
|
||||
'刷新与提示
|
||||
Hint("重命名成功!", HintType.Finish)
|
||||
PageVersionLeft.Version = New McVersion(NewName).Load()
|
||||
@@ -337,7 +301,7 @@
|
||||
Case LoadState.Finished
|
||||
Hint(Loader.Name & "成功!", HintType.Finish)
|
||||
Case LoadState.Failed
|
||||
Hint(Loader.Name & "失败:" & GetExceptionSummary(Loader.Error), HintType.Critical)
|
||||
Hint(Loader.Name & "失败:" & Loader.Error.GetBrief(), HintType.Critical)
|
||||
Case LoadState.Aborted
|
||||
Hint(Loader.Name & "已取消!", HintType.Info)
|
||||
End Select
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
<local:MyButton x:Name="BtnServerAuthLittle" Height="35" MinWidth="150" Margin="0,12,0,0" Text="设置为 LittleSkin" HorizontalAlignment="Left" ColorType="Highlight" />
|
||||
</StackPanel>
|
||||
</local:MyCard>
|
||||
<local:MyCard x:Name="CardAdvance" Margin="0,0,0,15" Title="高级启动选项" IsSwapped="True" CanSwap="True">
|
||||
<local:MyCard x:Name="CardAdvance" Margin="0,0,0,15" Title="高级选项" IsSwapped="True" CanSwap="True">
|
||||
<Grid Margin="25,40,25,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="Name" />
|
||||
@@ -219,7 +219,8 @@
|
||||
<local:MyCheckBox Grid.Row="5" Grid.Column="1" x:Name="CheckAdvanceRunWait" Tag="VersionAdvanceRunWait" Visibility="Collapsed"
|
||||
Text="等待命令执行完成后再继续启动" Margin="0,5,0,0" />
|
||||
<StackPanel Margin="0,12,0,4" Grid.Row="6" Grid.ColumnSpan="2" HorizontalAlignment="Left">
|
||||
<local:MyCheckBox Height="28" Text="禁止 Mod 更新" x:Name="CheckAdvanceDisableModUpdate" Tag="VersionAdvanceDisableModUpdate"
|
||||
<local:MyCheckBox Height="28" Text="禁止更新 Mod" x:Name="CheckAdvanceDisableModUpdate" Tag="VersionAdvanceDisableModUpdate"
|
||||
ToolTip="禁止为此版本更新 Mod,以防止整合包玩家误操作"
|
||||
ToolTipService.Placement="Right" />
|
||||
<local:MyCheckBox Height="28" Text="忽略 Java 兼容性警告" x:Name="CheckAdvanceJava" Tag="VersionAdvanceJava"
|
||||
ToolTipService.Placement="Right"
|
||||
|
||||
@@ -517,4 +517,12 @@ PreFin:
|
||||
FrmMain.PageChange(FormMain.PageType.Setup, FormMain.PageSubType.SetupLaunch)
|
||||
End Sub
|
||||
|
||||
'去除参数中的回车
|
||||
Private Sub ReplaceEnter(sender As MyTextBox, e As TextChangedEventArgs) Handles TextAdvanceJvm.TextChanged, TextAdvanceGame.TextChanged
|
||||
Dim NewText = sender.Text.Replace(vbCrLf, vbCr).Replace(vbLf, vbCr).Replace(vbCr, " ")
|
||||
If NewText = sender.Text Then Return
|
||||
Dim CaretIndex = sender.CaretIndex
|
||||
sender.Text = NewText
|
||||
sender.CaretIndex = Math.Max(0, CaretIndex - 1)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user