2.6.12
This commit is contained in:
@@ -181,13 +181,13 @@ Public Module ModDownloadLib
|
||||
Dim Logo As String
|
||||
Select Case Entry("type")
|
||||
Case "release"
|
||||
Logo = "pack://application:,,,/images/Blocks/Grass.png"
|
||||
Logo = PathImage & "Blocks/Grass.png"
|
||||
Case "snapshot"
|
||||
Logo = "pack://application:,,,/images/Blocks/CommandBlock.png"
|
||||
Logo = PathImage & "Blocks/CommandBlock.png"
|
||||
Case "special"
|
||||
Logo = "pack://application:,,,/images/Blocks/GoldBlock.png"
|
||||
Logo = PathImage & "Blocks/GoldBlock.png"
|
||||
Case Else
|
||||
Logo = "pack://application:,,,/images/Blocks/CobbleStone.png"
|
||||
Logo = PathImage & "Blocks/CobbleStone.png"
|
||||
End Select
|
||||
'建立控件
|
||||
Dim NewItem As New MyListItem With {.Logo = Logo, .SnapsToDevicePixels = True, .Title = Entry("id").ToString, .Height = 42, .Type = MyListItem.CheckType.Clickable, .Tag = Entry}
|
||||
@@ -722,7 +722,7 @@ Retry:
|
||||
.Info = If(Entry.IsPreview, "测试版", "正式版") &
|
||||
If(Entry.ReleaseTime = "", "", ",发布于 " & Entry.ReleaseTime) &
|
||||
If(Entry.RequiredForgeVersion Is Nothing, ",不兼容 Forge", If(Entry.RequiredForgeVersion = "", "", ",推荐 Forge 版本:" & Entry.RequiredForgeVersion)),
|
||||
.Logo = "pack://application:,,,/images/Blocks/GrassPath.png"
|
||||
.Logo = PathImage & "Blocks/GrassPath.png"
|
||||
}
|
||||
AddHandler NewItem.Click, OnClick
|
||||
'建立菜单
|
||||
@@ -951,7 +951,7 @@ Retry:
|
||||
Dim NewItem As New MyListItem With {
|
||||
.Title = Entry.Inherit, .SnapsToDevicePixels = True, .Height = 42, .Type = MyListItem.CheckType.Clickable, .Tag = Entry,
|
||||
.Info = If(Entry.IsPreview, "测试版", "稳定版") & If(Entry.ReleaseTime = "", "", ",发布于 " & Entry.ReleaseTime),
|
||||
.Logo = "pack://application:,,,/images/Blocks/Egg.png"
|
||||
.Logo = PathImage & "Blocks/Egg.png"
|
||||
}
|
||||
AddHandler NewItem.Click, OnClick
|
||||
'建立菜单
|
||||
@@ -1349,18 +1349,20 @@ Retry:
|
||||
If Json("data") IsNot Nothing AndAlso Json("data")("MOJMAPS") IsNot Nothing Then
|
||||
'下载原版 Json 文件
|
||||
Task.Progress = 0.4
|
||||
Log("[Download] 需要 Mappings 下载信息,开始获取原版 Json 文件")
|
||||
Dim RawJson As JObject = GetJson(NetGetCodeByDownload(DlSourceLauncherOrMetaGet(DlClientListGet(Inherit)), IsJson:=True))
|
||||
'[net.minecraft:client:1.17.1-20210706.113038:mappings@txt]
|
||||
'[net.minecraft:client:1.17.1-20210706.113038:mappings@txt] 或 @tsrg]
|
||||
Dim OriginalName As String = Json("data")("MOJMAPS")("client").ToString.Trim("[]".ToCharArray()).Split("@")(0)
|
||||
Dim Address = McLibGet(OriginalName).Replace(".jar", "-mappings.txt")
|
||||
Dim Address = McLibGet(OriginalName).Replace(".jar", "-mappings." & Json("data")("MOJMAPS")("client").ToString.Trim("[]".ToCharArray()).Split("@")(1))
|
||||
Libs.Add(New McLibToken With {.IsJumpLoader = False, .IsNatives = False, .LocalPath = Address, .OriginalName = OriginalName,
|
||||
.Url = RawJson("downloads")("client_mappings")("url"), .Size = RawJson("downloads")("client_mappings")("size"), .SHA1 = RawJson("downloads")("client_mappings")("sha1")})
|
||||
Log("[Download] 需要下载 Mappings:" & Address)
|
||||
End If
|
||||
Task.Progress = 0.8
|
||||
'去除其中的原始 Forge 项
|
||||
For i = 0 To Libs.Count - 1
|
||||
If Libs(i).LocalPath.EndsWith("forge-" & Inherit & "-" & Version & ".jar") Then
|
||||
If Libs(i).LocalPath.EndsWith("forge-" & Inherit & "-" & Version & ".jar") OrElse
|
||||
Libs(i).LocalPath.EndsWith("forge-" & Inherit & "-" & Version & "-client.jar") Then
|
||||
Log("[Download] 已从待下载 Forge 支持库中移除:" & Libs(i).LocalPath, LogLevel.Debug)
|
||||
Libs.RemoveAt(i)
|
||||
Exit For
|
||||
End If
|
||||
@@ -1420,9 +1422,8 @@ Retry:
|
||||
Try
|
||||
Log("[Download] 开始进行新版方式 Forge 安装:" & InstallerAddress)
|
||||
'记录当前文件夹列表(在新建目标文件夹之前)
|
||||
Dim OldList = New DirectoryInfo(McFolder & "versions\").EnumerateDirectories.Select(Function(Info As DirectoryInfo) As String
|
||||
Return Info.FullName
|
||||
End Function).ToList()
|
||||
Dim OldList = New DirectoryInfo(McFolder & "versions\").EnumerateDirectories.
|
||||
Select(Function(i) i.FullName).ToList()
|
||||
'解压并获取信息
|
||||
Installer = New ZipArchive(New FileStream(InstallerAddress, FileMode.Open))
|
||||
Dim Json As JObject = GetJson(ReadFile(Installer.GetEntry("install_profile.json").Open))
|
||||
@@ -1452,11 +1453,12 @@ Retry:
|
||||
End If
|
||||
End Try
|
||||
'拷贝新增的版本 Json
|
||||
Dim DeltaList = New DirectoryInfo(McFolder & "versions\").EnumerateDirectories.SkipWhile(Function(Info As DirectoryInfo) As Boolean
|
||||
Return OldList.Contains(Info.FullName)
|
||||
End Function).ToList()
|
||||
If DeltaList.Count > 1 Then '它可能和 OptiFine 安装同时运行,导致增加的文件不止一个(这导致了 #151)
|
||||
DeltaList = New List(Of DirectoryInfo) From {DeltaList.Where(Function(l) l.Name.Contains("forge")).First}
|
||||
Dim DeltaList = New DirectoryInfo(McFolder & "versions\").EnumerateDirectories.
|
||||
SkipWhile(Function(i) OldList.Contains(i.FullName)).ToList()
|
||||
If DeltaList.Count > 1 Then
|
||||
'它可能和 OptiFine 安装同时运行,导致增加的文件不止一个(这导致了 #151)
|
||||
'也可能是因为 Forge 安装器的 Bug,生成了一个名字错误的文件夹,所以需要检查文件夹是否为空
|
||||
DeltaList = DeltaList.Where(Function(l) l.Name.Contains("forge") AndAlso l.EnumerateFiles.Any).ToList
|
||||
End If
|
||||
If DeltaList.Count = 1 Then '如果没有新增文件夹,那么预测的文件夹名就是正确的
|
||||
Dim JsonFile As FileInfo = DeltaList(0).EnumerateFiles.First()
|
||||
@@ -1580,7 +1582,7 @@ Retry:
|
||||
.Info = If(Entry.ReleaseTime = "",
|
||||
If(ModeDebug, "种类:" & Entry.Category & If(Entry.Branch Is Nothing, "", ",开发分支:" & Entry.Branch), ""),
|
||||
"发布于 " & Entry.ReleaseTime & If(ModeDebug, ",种类:" & Entry.Category & If(Entry.Branch Is Nothing, "", ",开发分支:" & Entry.Branch), "")),
|
||||
.Logo = "pack://application:,,,/images/Blocks/Anvil.png"
|
||||
.Logo = PathImage & "Blocks/Anvil.png"
|
||||
}
|
||||
AddHandler NewItem.Click, OnClick
|
||||
'建立菜单
|
||||
@@ -1785,7 +1787,7 @@ Retry:
|
||||
Dim NewItem As New MyListItem With {
|
||||
.Title = Entry("version").ToString.Replace("+build", ""), .SnapsToDevicePixels = True, .Height = 42, .Type = MyListItem.CheckType.Clickable, .Tag = Entry,
|
||||
.Info = If(Entry("stable").ToObject(Of Boolean), "稳定版", "测试版"),
|
||||
.Logo = "pack://application:,,,/images/Blocks/Fabric.png"
|
||||
.Logo = PathImage & "Blocks/Fabric.png"
|
||||
}
|
||||
AddHandler NewItem.Click, OnClick
|
||||
'结束
|
||||
@@ -1796,7 +1798,7 @@ Retry:
|
||||
Dim NewItem As New MyListItem With {
|
||||
.Title = Entry.DisplayName.Split("]")(1).Replace("Fabric API ", "").Replace(" build ", ".").Split("+").First.Trim, .SnapsToDevicePixels = True, .Height = 42, .Type = MyListItem.CheckType.Clickable, .Tag = Entry,
|
||||
.Info = Entry.StatusDescription & ",发布于 " & Entry.ReleaseDate.ToString("yyyy/MM/dd HH:mm"),
|
||||
.Logo = "pack://application:,,,/images/Blocks/Fabric.png"
|
||||
.Logo = PathImage & "Blocks/Fabric.png"
|
||||
}
|
||||
AddHandler NewItem.Click, OnClick
|
||||
'结束
|
||||
@@ -1807,7 +1809,7 @@ Retry:
|
||||
Dim NewItem As New MyListItem With {
|
||||
.Title = Entry.DisplayName.ToLower.Replace("optifabric-", "").Replace(".jar", "").Trim.TrimStart("v"), .SnapsToDevicePixels = True, .Height = 42, .Type = MyListItem.CheckType.Clickable, .Tag = Entry,
|
||||
.Info = Entry.StatusDescription & ",发布于 " & Entry.ReleaseDate.ToString("yyyy/MM/dd HH:mm"),
|
||||
.Logo = "pack://application:,,,/images/Blocks/OptiFabric.png"
|
||||
.Logo = PathImage & "Blocks/OptiFabric.png"
|
||||
}
|
||||
AddHandler NewItem.Click, OnClick
|
||||
'结束
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
TargetLoader = FrmMain.PageCurrent.Additional(3)
|
||||
PageLoaderInit(Load, PanLoad, PanMain, CardIntro, CompFileLoader, AddressOf Load_OnFinish)
|
||||
End Sub
|
||||
Private Sub PageDownloadCompDetail_Loaded(sender As Object, e As EventArgs) Handles Me.Loaded
|
||||
'Initialized 只会执行一次
|
||||
Project = FrmMain.PageCurrent.Additional(0)
|
||||
TargetVersion = FrmMain.PageCurrent.Additional(2)
|
||||
TargetLoader = FrmMain.PageCurrent.Additional(3)
|
||||
End Sub
|
||||
Private Project As CompProject
|
||||
Private TargetVersion As String, TargetLoader As CompModLoaderType
|
||||
'自动重试
|
||||
@@ -55,10 +61,10 @@
|
||||
TargetCard = "未知版本"
|
||||
ElseIf GameVersion.Contains("w") OrElse GameVersion.Contains("pre") OrElse GameVersion.Contains("rc") Then
|
||||
TargetCard = "快照版本"
|
||||
ElseIf GameVersion.Split(".").Count >= 2 Then
|
||||
TargetCard = GameVersion
|
||||
ElseIf GameVersion.StartsWith("1.0") Then
|
||||
TargetCard = "远古版本"
|
||||
Else
|
||||
TargetCard = "未知版本"
|
||||
TargetCard = GameVersion
|
||||
End If
|
||||
'实际进行添加
|
||||
If Not Dict.ContainsKey(TargetCard) Then Dict.Add(TargetCard, New List(Of CompFile))
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<TextBlock VerticalAlignment="Center" Grid.Row="2" HorizontalAlignment="Left" Text="版本" Margin="0,0,18,0" />
|
||||
<local:MyComboBox x:Name="TextSearchVersion" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" IsEditable="True" MaxDropDownHeight="320">
|
||||
<local:MyComboBoxItem Content="全部 (也可自行输入)" IsSelected="True" />
|
||||
<local:MyComboBoxItem Content="1.20.4" />
|
||||
<local:MyComboBoxItem Content="1.20.3" />
|
||||
<local:MyComboBoxItem Content="1.20.2" />
|
||||
<local:MyComboBoxItem Content="1.20.1" />
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<TextBlock VerticalAlignment="Center" Grid.Row="2" HorizontalAlignment="Left" Text="版本" Margin="0,0,18,0" />
|
||||
<local:MyComboBox x:Name="TextSearchVersion" Grid.Row="2" Grid.Column="1" IsEditable="True" MaxDropDownHeight="320">
|
||||
<local:MyComboBoxItem Content="全部 (也可自行输入)" IsSelected="True" />
|
||||
<local:MyComboBoxItem Content="1.20.4" />
|
||||
<local:MyComboBoxItem Content="1.20.3" />
|
||||
<local:MyComboBoxItem Content="1.20.2" />
|
||||
<local:MyComboBoxItem Content="1.20.1" />
|
||||
|
||||
@@ -237,7 +237,7 @@ Retry:
|
||||
{"Translator-Chinese", "Crowdin 中文翻译者披风"}, {"Translator", "Crowdin 翻译者披风"}, {"Cobalt", "Cobalt 披风"},
|
||||
{"Vanilla", "原版披风"}, {"Minecon2011", "Minecon 2011 参与者披风"}, {"Minecon2012", "Minecon 2012 参与者披风"},
|
||||
{"Minecon2013", "Minecon 2013 参与者披风"}, {"Minecon2015", "Minecon 2015 参与者披风"}, {"Minecon2016", "Minecon 2016 参与者披风"},
|
||||
{"Cherry Blossom Cape", "樱花披风"}, {"CherryBlossomCape", "樱花披风"}
|
||||
{"Cherry Blossom", "樱花披风"}
|
||||
}
|
||||
Dim SelectionControl As New List(Of IMyRadio) From {New MyRadioBox With {.Text = "无披风"}}
|
||||
For Each Cape In SkinData("capes")
|
||||
|
||||
@@ -90,7 +90,7 @@ Download:
|
||||
GoTo Download
|
||||
Case 3 '简单主页
|
||||
Log("[Page] 主页预设:简单主页")
|
||||
Url = "https://cdn.wearclub.online/PCL/Custom.xaml"
|
||||
Url = "https://gitee.com/mfn233/PCL-Mainpage/raw/main/Custom.xaml"
|
||||
GoTo Download
|
||||
Case 4 '历史上的今天
|
||||
Log("[Page] 主页预设:历史上的今天")
|
||||
|
||||
@@ -196,7 +196,7 @@
|
||||
Dim RamAvailable As Double = Math.Round(My.Computer.Info.AvailablePhysicalMemory / 1024 / 1024 / 1024 * 10) / 10
|
||||
Dim RamGameActual As Double = Math.Min(RamGame, RamAvailable)
|
||||
Dim RamUsed As Double = RamTotal - RamAvailable
|
||||
Dim RamEmpty As Double = Math.Round(MathRange(RamTotal - RamUsed - RamGame, 0, 1000) * 10) / 10
|
||||
Dim RamEmpty As Double = Math.Round(MathClamp(RamTotal - RamUsed - RamGame, 0, 1000) * 10) / 10
|
||||
'设置最大可用内存
|
||||
If RamTotal <= 1.5 Then
|
||||
SliderRamCustom.MaxValue = Math.Max(Math.Floor((RamTotal - 0.3) / 0.1), 1)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<Grid x:Name="PanAllBack">
|
||||
<local:MyScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" x:Name="PanBack">
|
||||
<StackPanel x:Name="PanMain" Margin="25,10,25,10" Grid.IsSharedSizeScope="True"> <!-- 若显示多选模块则为 92 -->
|
||||
<local:MySearchBox Margin="0,15" HintText="搜索 Mod" x:Name="SearchBox" />
|
||||
<local:MySearchBox Margin="0,15" HintText="搜索 Mod 名称 / 描述 / 标签" x:Name="SearchBox" />
|
||||
<local:MyCard Grid.Row="0" Margin="0,0,0,15" x:Name="PanManage">
|
||||
<Grid Margin="15,15,0,15" Height="35">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -19,7 +19,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<local:MyButton x:Name="BtnManageOpen" Grid.Column="0" MinWidth="140" Text="打开 Mod 文件夹" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" ColorType="Highlight" />
|
||||
<local:MyButton x:Name="BtnManageSelectAll" Grid.Column="1" MinWidth="140" Text="全选" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" />
|
||||
<local:MyButton x:Name="BtnManageInstall" Grid.Column="2" MinWidth="140" Text="安装 Mod" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" ToolTip="将 Mod 文件直接拖入 PCL 窗口即可快捷安装!" ToolTipService.InitialShowDelay="0" />
|
||||
<local:MyButton x:Name="BtnManageInstall" Grid.Column="2" MinWidth="140" Text="安装 Mod" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" />
|
||||
<local:MyButton x:Name="BtnManageCheck" Grid.Column="3" MinWidth="140" Text="检查 Mod" Padding="13,0" Margin="0,0,20,0" HorizontalAlignment="Left" ToolTip="快速检查 Mod 的版本要求、重复、前置缺失等问题。
结果仅供参考,由于部分 Mod 标注的信息有误,可能并不准确。" Visibility="Collapsed" />
|
||||
</Grid>
|
||||
</local:MyCard>
|
||||
@@ -35,7 +35,7 @@
|
||||
<StackPanel Margin="20,17">
|
||||
<TextBlock Margin="0,0,0,9" HorizontalAlignment="Center" Text="未找到 Mod" FontSize="19" UseLayoutRounding="True" SnapsToDevicePixels="True" Foreground="{DynamicResource ColorBrush3}" />
|
||||
<Rectangle HorizontalAlignment="Stretch" Height="2" Fill="{DynamicResource ColorBrush3}" />
|
||||
<TextBlock Margin="10,15,10,0" Text="要安装 Mod,请直接将 Mod 文件拖入 PCL 窗口。
如果你确定你已经安装了 Mod,但仍然看到了这条提示,那么你的版本隔离设置可能有误。请尝试在启动设置中调整版本隔离选项。" TextWrapping="Wrap" />
|
||||
<TextBlock Margin="10,15,10,0" Text="要安装 Mod,请直接将 Mod 文件拖入 PCL 窗口。
如果你确定你已经安装了 Mod,但仍然看到了这条提示,则是版本隔离设置有误,请在启动设置中调整版本隔离选项。" TextWrapping="Wrap" />
|
||||
<local:MyButton Height="35" HorizontalAlignment="Center" x:Name="BtnHintOpen" MinWidth="140" Text="打开 Mod 文件夹" Margin="0,15,0,0" Padding="13,0" ColorType="Highlight" />
|
||||
</StackPanel>
|
||||
</local:MyCard>
|
||||
@@ -53,7 +53,7 @@
|
||||
<local:MyIconTextButton x:Name="BtnSelectEnable" Text="启用"
|
||||
LogoScale="1.05" Logo="M512 0a512 512 0 1 0 512 512A512 512 0 0 0 512 0z m0 921.6a409.6 409.6 0 1 1 409.6-409.6 409.6 409.6 0 0 1-409.6 409.6z M716.8 339.968l-256 253.44L328.192 460.8A51.2 51.2 0 0 0 256 532.992l168.448 168.96a51.2 51.2 0 0 0 72.704 0l289.28-289.792A51.2 51.2 0 0 0 716.8 339.968z" />
|
||||
<local:MyIconTextButton x:Name="BtnSelectDisable" Text="禁用"
|
||||
LogoScale="0.98" Logo="M512 0a512 512 0 1 0 512 512A512 512 0 0 0 512 0z m409.6 512a404.48 404.48 0 0 1-86.528 250.88L261.12 188.928A404.48 404.48 0 0 1 512 102.4a409.6 409.6 0 0 1 409.6 409.6zM102.4 512a404.48 404.48 0 0 1 86.528-250.88L762.88 835.072A404.48 404.48 0 0 1 512 921.6a409.6 409.6 0 0 1-409.6-409.6z" />
|
||||
LogoScale="1" Logo="M508 990.4c-261.6 0-474.4-212-474.4-474.4S246.4 41.6 508 41.6s474.4 212 474.4 474.4S769.6 990.4 508 990.4zM508 136.8c-209.6 0-379.2 169.6-379.2 379.2 0 209.6 169.6 379.2 379.2 379.2s379.2-169.6 379.2-379.2C887.2 306.4 717.6 136.8 508 136.8zM697.6 563.2 318.4 563.2c-26.4 0-47.2-21.6-47.2-47.2 0-26.4 21.6-47.2 47.2-47.2l379.2 0c26.4 0 47.2 21.6 47.2 47.2C744.8 542.4 724 563.2 697.6 563.2z" />
|
||||
<local:MyIconTextButton x:Name="BtnSelectDelete" Text="删除"
|
||||
LogoScale="0.96" Logo="M520.192 0C408.43 0 317.44 82.87 313.563 186.734H52.736c-29.038 0-52.663 21.943-52.663 49.079s23.625 49.152 52.663 49.152h58.075v550.473c0 103.35 75.118 187.757 167.717 187.757h472.43c92.599 0 167.716-83.894 167.716-187.757V285.477h52.59c29.038 0 52.59-21.943 52.663-49.08-0.073-27.135-23.625-49.151-52.663-49.151H726.235C723.237 83.017 631.955 0 520.192 0zM404.846 177.957c3.803-50.03 50.176-89.015 107.447-89.015 57.197 0 103.57 38.985 106.788 89.015H404.92zM284.379 933.669c-33.353 0-69.997-39.351-69.997-95.525v-549.01H833.39v549.522c0 56.247-36.645 95.525-69.998 95.525H284.379v-0.512z M357.23 800.695a48.274 48.274 0 0 0 47.616-49.006V471.7a48.274 48.274 0 0 0-47.543-49.08 48.274 48.274 0 0 0-47.69 49.006V751.69c0 27.282 20.846 49.006 47.617 49.006z m166.62 0a48.274 48.274 0 0 0 47.688-49.006V471.7a48.274 48.274 0 0 0-47.689-49.08 48.274 48.274 0 0 0-47.543 49.006V751.69c0 27.282 21.431 49.006 47.543 49.006z m142.92 0a48.274 48.274 0 0 0 47.543-49.006V471.7a48.274 48.274 0 0 0-47.543-49.08 48.274 48.274 0 0 0-47.616 49.006V751.69c0 27.282 20.773 49.006 47.543 49.006z" />
|
||||
<local:MyIconTextButton x:Name="BtnSelectCancel" Text="取消选择"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Private IsLoad As Boolean = False
|
||||
Public Sub PageOther_Loaded() Handles Me.Loaded
|
||||
|
||||
PanBack.ScrollToHome()
|
||||
If FrmMain.PageLast.Page <> FormMain.PageType.CompDetail Then PanBack.ScrollToHome()
|
||||
AniControlEnabled += 1
|
||||
SelectedMods.Clear()
|
||||
RefreshList()
|
||||
@@ -122,7 +122,26 @@
|
||||
ToolTipService.SetHorizontalOffset(BtnCont, 2)
|
||||
AddHandler BtnCont.Click, AddressOf Info_Click
|
||||
AddHandler sender.MouseRightButtonDown, AddressOf Info_Click
|
||||
sender.Buttons = {BtnCont, BtnOpen}
|
||||
Dim BtnDelete As New MyIconButton With {.LogoScale = 1.1, .Logo = Logo.IconButtonDelete, .Tag = sender}
|
||||
BtnDelete.ToolTip = "删除"
|
||||
ToolTipService.SetPlacement(BtnDelete, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnDelete, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnDelete, 2)
|
||||
AddHandler BtnDelete.Click, AddressOf Delete_Click
|
||||
Dim BtnED As New MyIconButton With {.LogoScale = 1.1, .Logo = If(sender.Entry.State = McMod.McModState.Fine,
|
||||
"M508 990.4c-261.6 0-474.4-212-474.4-474.4S246.4 41.6 508 41.6s474.4 212 474.4 474.4S769.6 990.4 508 990.4zM508 136.8c-209.6 0-379.2 169.6-379.2 379.2 0 209.6 169.6 379.2 379.2 379.2s379.2-169.6 379.2-379.2C887.2 306.4 717.6 136.8 508 136.8zM697.6 563.2 318.4 563.2c-26.4 0-47.2-21.6-47.2-47.2 0-26.4 21.6-47.2 47.2-47.2l379.2 0c26.4 0 47.2 21.6 47.2 47.2C744.8 542.4 724 563.2 697.6 563.2z",
|
||||
"M512 0a512 512 0 1 0 512 512A512 512 0 0 0 512 0z m0 921.6a409.6 409.6 0 1 1 409.6-409.6 409.6 409.6 0 0 1-409.6 409.6z M716.8 339.968l-256 253.44L328.192 460.8A51.2 51.2 0 0 0 256 532.992l168.448 168.96a51.2 51.2 0 0 0 72.704 0l289.28-289.792A51.2 51.2 0 0 0 716.8 339.968z"),
|
||||
.Tag = sender}
|
||||
BtnED.ToolTip = If(sender.Entry.State = McMod.McModState.Fine, "禁用", "启用")
|
||||
ToolTipService.SetPlacement(BtnED, Primitives.PlacementMode.Center)
|
||||
ToolTipService.SetVerticalOffset(BtnED, 30)
|
||||
ToolTipService.SetHorizontalOffset(BtnED, 2)
|
||||
AddHandler BtnED.Click, AddressOf ED_Click
|
||||
If sender.Entry.State = McMod.McModState.Unavaliable Then
|
||||
sender.Buttons = {BtnCont, BtnOpen, BtnDelete}
|
||||
Else
|
||||
sender.Buttons = {BtnCont, BtnOpen, BtnED, BtnDelete}
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
@@ -170,6 +189,13 @@
|
||||
End If
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' 安装 Mod。
|
||||
''' </summary>
|
||||
Private Sub BtnManageInstall_Click(sender As Object, e As MouseButtonEventArgs) Handles BtnManageInstall.Click
|
||||
Hint("将 Mod 文件直接拖入 PCL 窗口即可安装!")
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "选择"
|
||||
@@ -304,17 +330,21 @@
|
||||
#Region "下边栏"
|
||||
|
||||
'启用 / 禁用
|
||||
Private Sub BtnSelectEorD_Click(sender As MyIconTextButton, e As RouteEventArgs) Handles BtnSelectEnable.Click, BtnSelectDisable.Click
|
||||
Private Sub BtnSelectED_Click(sender As MyIconTextButton, e As RouteEventArgs) Handles BtnSelectEnable.Click, BtnSelectDisable.Click
|
||||
EDMods(McModLoader.Output.Where(Function(m) SelectedMods.Contains(m.RawFileName)).ToList(),
|
||||
Not sender.Equals(BtnSelectDisable))
|
||||
ChangeAllSelected(False)
|
||||
End Sub
|
||||
Private Sub EDMods(ModList As List(Of McMod), IsEnable As Boolean)
|
||||
Dim IsSuccessful As Boolean = True
|
||||
Dim IsDisable As Boolean = sender.Equals(BtnSelectDisable)
|
||||
For Each ModEntity In McModLoader.Output.Where(Function(m) SelectedMods.Contains(m.RawFileName)).ToList()
|
||||
For Each ModEntity In ModList
|
||||
Dim NewPath As String = Nothing
|
||||
If ModEntity.State = McMod.McModState.Fine And IsDisable Then
|
||||
If ModEntity.State = McMod.McModState.Fine AndAlso Not IsEnable Then
|
||||
'禁用
|
||||
NewPath = ModEntity.Path & ".disabled"
|
||||
ElseIf ModEntity.State = McMod.McModState.Disabled AndAlso Not IsDisable Then
|
||||
ElseIf ModEntity.State = McMod.McModState.Disabled AndAlso IsEnable Then
|
||||
'启用
|
||||
NewPath = ModEntity.Path.Substring(0, ModEntity.Path.Count - ".disabled".Count)
|
||||
NewPath = ModEntity.Path.Replace(".disabled", "").Replace(".old", "")
|
||||
Else
|
||||
Continue For
|
||||
End If
|
||||
@@ -328,7 +358,7 @@
|
||||
RefreshList(True)
|
||||
Return
|
||||
Catch ex As Exception
|
||||
Log(ex, $"批量重命名 Mod 失败({If(ModEntity.Path, "null")})")
|
||||
Log(ex, $"重命名 Mod 失败({If(ModEntity.Path, "null")})")
|
||||
IsSuccessful = False
|
||||
End Try
|
||||
'更改 Loader 和 UI 中的列表
|
||||
@@ -350,61 +380,82 @@
|
||||
LoaderFolderRun(McModLoader, PageVersionLeft.Version.PathIndie & "mods\", LoaderFolderRunType.UpdateOnly)
|
||||
End If
|
||||
If Not IsSuccessful Then
|
||||
Hint("由于文件被占用,部分 Mod 的状态切换失败,请尝试关闭正在运行的游戏后再试!", HintType.Critical)
|
||||
Hint("由于文件被占用,Mod 的状态切换失败,请尝试关闭正在运行的游戏后再试!", HintType.Critical)
|
||||
RefreshList(True)
|
||||
Else
|
||||
ChangeAllSelected(False)
|
||||
RefreshBottomBar()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'删除
|
||||
Private Sub BtnSelectDelete_Click() Handles BtnSelectDelete.Click
|
||||
Dim IsSuccessful As Boolean = True
|
||||
Dim IsShiftPressed As Boolean = My.Computer.Keyboard.ShiftKeyDown
|
||||
Dim DeleteList As List(Of McMod) = McModLoader.Output.Where(Function(m) SelectedMods.Contains(m.RawFileName)).ToList()
|
||||
For Each ModEntity In DeleteList
|
||||
'删除
|
||||
Try
|
||||
If IsShiftPressed Then
|
||||
File.Delete(ModEntity.Path)
|
||||
Else
|
||||
My.Computer.FileSystem.DeleteFile(ModEntity.Path, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
|
||||
End If
|
||||
Catch ex As OperationCanceledException
|
||||
Log(ex, "批量删除 Mod 被主动取消")
|
||||
RefreshList(True)
|
||||
Return
|
||||
Catch ex As Exception
|
||||
Log(ex, $"批量删除 Mod 失败({ModEntity.Path})", LogLevel.Msgbox)
|
||||
IsSuccessful = False
|
||||
End Try
|
||||
'更改 Loader 和 UI 中的列表
|
||||
McModLoader.Output.Remove(ModEntity)
|
||||
Dim Parent As StackPanel = If(IsSearching, PanSearchList, PanItems)
|
||||
Dim IndexOfUi As Integer = Parent.Children.IndexOf(Parent.Children.OfType(Of MyLocalModItem).First(Function(i) i.Entry Is ModEntity))
|
||||
Parent.Children.RemoveAt(IndexOfUi)
|
||||
Next
|
||||
If Not IsSearching Then
|
||||
'改变禁用数量的显示
|
||||
CType(PanItems.Parent, MyCard).Title = McModGetTitle(McModLoader.Output)
|
||||
'更新加载器状态
|
||||
LoaderFolderRun(McModLoader, PageVersionLeft.Version.PathIndie & "mods\", LoaderFolderRunType.UpdateOnly)
|
||||
End If
|
||||
If Not IsSuccessful Then
|
||||
Hint("由于文件被占用,部分 Mod 删除失败,请尝试关闭正在运行的游戏后再试!", HintType.Critical)
|
||||
RefreshList(True)
|
||||
ElseIf If(IsSearching, PanSearchList, PanItems).Children.Count = 0 Then
|
||||
RefreshList(True)
|
||||
Else
|
||||
ChangeAllSelected(False)
|
||||
End If
|
||||
If IsSuccessful Then
|
||||
If IsShiftPressed Then
|
||||
Hint($"已彻底删除 {DeleteList.Count} 个文件!", HintType.Finish)
|
||||
Else
|
||||
Hint($"已将 {DeleteList.Count} 个文件删除到回收站!", HintType.Finish)
|
||||
DeleteMods(DeleteList)
|
||||
End Sub
|
||||
Private Sub DeleteMods(ModList As IEnumerable(Of McMod))
|
||||
Try
|
||||
Dim IsSuccessful As Boolean = True
|
||||
Dim IsShiftPressed As Boolean = My.Computer.Keyboard.ShiftKeyDown
|
||||
For Each ModEntity In ModList
|
||||
'删除
|
||||
Try
|
||||
If IsShiftPressed Then
|
||||
File.Delete(ModEntity.Path)
|
||||
Else
|
||||
My.Computer.FileSystem.DeleteFile(ModEntity.Path, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
|
||||
End If
|
||||
Catch ex As OperationCanceledException
|
||||
Log(ex, "删除 Mod 被主动取消")
|
||||
RefreshList(True)
|
||||
Return
|
||||
Catch ex As Exception
|
||||
Log(ex, $"删除 Mod 失败({ModEntity.Path})", LogLevel.Msgbox)
|
||||
IsSuccessful = False
|
||||
End Try
|
||||
'取消选中
|
||||
SelectedMods.Remove(ModEntity.RawFileName)
|
||||
'更改 Loader 和 UI 中的列表
|
||||
McModLoader.Output.Remove(ModEntity)
|
||||
Dim Parent As StackPanel = If(IsSearching, PanSearchList, PanItems)
|
||||
Dim IndexOfUi As Integer = Parent.Children.IndexOf(Parent.Children.OfType(Of MyLocalModItem).First(Function(i) i.Entry Is ModEntity))
|
||||
Parent.Children.RemoveAt(IndexOfUi)
|
||||
Next
|
||||
If Not IsSearching Then
|
||||
'改变禁用数量的显示
|
||||
CType(PanItems.Parent, MyCard).Title = McModGetTitle(McModLoader.Output)
|
||||
'更新加载器状态
|
||||
LoaderFolderRun(McModLoader, PageVersionLeft.Version.PathIndie & "mods\", LoaderFolderRunType.UpdateOnly)
|
||||
End If
|
||||
End If
|
||||
If Not IsSuccessful Then
|
||||
Hint("由于文件被占用,Mod 删除失败,请尝试关闭正在运行的游戏后再试!", HintType.Critical)
|
||||
RefreshList(True)
|
||||
ElseIf If(IsSearching, PanSearchList, PanItems).Children.Count = 0 Then
|
||||
RefreshList(True)
|
||||
Else
|
||||
RefreshBottomBar()
|
||||
End If
|
||||
'显示结果提示
|
||||
If Not IsSuccessful Then Exit Sub
|
||||
If IsShiftPressed Then
|
||||
If ModList.Count = 1 Then
|
||||
Hint($"已彻底删除 {ModList.Single.FileName}!", HintType.Finish)
|
||||
Else
|
||||
Hint($"已彻底删除 {ModList.Count} 个文件!", HintType.Finish)
|
||||
End If
|
||||
Else
|
||||
If ModList.Count = 1 Then
|
||||
Hint($"已将 {ModList.Single.FileName} 删除到回收站!", HintType.Finish)
|
||||
Else
|
||||
Hint($"已将 {ModList.Count} 个文件删除到回收站!", HintType.Finish)
|
||||
End If
|
||||
End If
|
||||
Catch ex As OperationCanceledException
|
||||
Log(ex, "删除 Mod 被主动取消")
|
||||
RefreshList(True)
|
||||
Catch ex As Exception
|
||||
Log(ex, "删除 Mod 出现未知错误", LogLevel.Feedback)
|
||||
RefreshList(True)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
'取消选择
|
||||
@@ -494,6 +545,16 @@
|
||||
Log(ex, "打开 Mod 文件位置失败", LogLevel.Feedback)
|
||||
End Try
|
||||
End Sub
|
||||
'删除
|
||||
Public Sub Delete_Click(sender As MyIconButton, e As EventArgs)
|
||||
Dim ListItem As MyLocalModItem = sender.Tag
|
||||
DeleteMods({ListItem.Entry})
|
||||
End Sub
|
||||
'启用 / 禁用
|
||||
Public Sub ED_Click(sender As MyIconButton, e As EventArgs)
|
||||
Dim ListItem As MyLocalModItem = sender.Tag
|
||||
EDMods(New List(Of McMod) From {ListItem.Entry}, ListItem.Entry.State = McMod.McModState.Disabled)
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
@@ -513,7 +574,9 @@
|
||||
Dim SearchSource As New List(Of KeyValuePair(Of String, Double))
|
||||
SearchSource.Add(New KeyValuePair(Of String, Double)(Entry.Name, 1))
|
||||
SearchSource.Add(New KeyValuePair(Of String, Double)(Entry.FileName, 1))
|
||||
If Entry.Version IsNot Nothing Then SearchSource.Add(New KeyValuePair(Of String, Double)(Entry.Version, 0.2))
|
||||
If Entry.Version IsNot Nothing Then
|
||||
SearchSource.Add(New KeyValuePair(Of String, Double)(Entry.Version, 0.2))
|
||||
End If
|
||||
If Entry.Description IsNot Nothing AndAlso Entry.Description <> "" Then
|
||||
SearchSource.Add(New KeyValuePair(Of String, Double)(Entry.Description, 0.4))
|
||||
End If
|
||||
@@ -521,6 +584,7 @@
|
||||
If Entry.Comp.RawName <> Entry.Name Then SearchSource.Add(New KeyValuePair(Of String, Double)(Entry.Comp.RawName, 1))
|
||||
If Entry.Comp.TranslatedName <> Entry.Comp.RawName Then SearchSource.Add(New KeyValuePair(Of String, Double)(Entry.Comp.TranslatedName, 1))
|
||||
If Entry.Comp.Description <> Entry.Description Then SearchSource.Add(New KeyValuePair(Of String, Double)(Entry.Comp.Description, 0.4))
|
||||
SearchSource.Add(New KeyValuePair(Of String, Double)(String.Join("", Entry.Comp.Tags), 0.2))
|
||||
End If
|
||||
QueryList.Add(New SearchEntry(Of McMod) With {.Item = Entry, .SearchSource = SearchSource})
|
||||
Next
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
Dim RamAvailable As Double = Math.Round(My.Computer.Info.AvailablePhysicalMemory / 1024 / 1024 / 1024 * 10) / 10
|
||||
Dim RamGameActual As Double = Math.Min(RamGame, RamAvailable)
|
||||
Dim RamUsed As Double = RamTotal - RamAvailable
|
||||
Dim RamEmpty As Double = Math.Round(MathRange(RamTotal - RamUsed - RamGame, 0, 1000) * 10) / 10
|
||||
Dim RamEmpty As Double = Math.Round(MathClamp(RamTotal - RamUsed - RamGame, 0, 1000) * 10) / 10
|
||||
'设置最大可用内存
|
||||
If RamTotal <= 1.5 Then
|
||||
SliderRamCustom.MaxValue = Math.Max(Math.Floor((RamTotal - 0.3) / 0.1), 1)
|
||||
|
||||
Reference in New Issue
Block a user