2.13.0.0
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -27,8 +27,6 @@
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="9" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="9" />
|
||||
<RowDefinition Height="28" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left" Text="默认版本隔离" Margin="0,0,25,0" />
|
||||
<local:MyComboBox local:SettingService.Key="LaunchArgumentIndieV2" x:Name="ComboArgumentIndieV2"
|
||||
@@ -39,8 +37,9 @@
|
||||
<local:MyComboBoxItem Content="隔离可安装 Mod 的版本"
|
||||
ToolTip="可安装 Mod 的版本(例如 Forge、Fabric)均互相独立以避免 Mod 冲突,其他版本(例如原版)则不会被隔离。" />
|
||||
<local:MyComboBoxItem Content="隔离非正式版"
|
||||
ToolTip="将 Minecraft 快照、预发布版、远古版本、愚人节版本与其他版本进行隔离" />
|
||||
<local:MyComboBoxItem Content="隔离可安装 Mod 的版本与非正式版" />
|
||||
ToolTip="将 Minecraft 快照、预发布版、远古版本、愚人节版本与其他版本进行隔离。" />
|
||||
<local:MyComboBoxItem Content="隔离可安装 Mod 的版本与非正式版"
|
||||
ToolTip="将可安装 Mod 的版本、Minecraft 快照、预发布版、远古版本、愚人节版本与其他版本进行隔离。" />
|
||||
<local:MyComboBoxItem Content="隔离所有版本"
|
||||
ToolTip="不同版本之间的存档、Mod、资源包等均不互通。
这会导致不同原版版本间的存档不能共用,所以一般不推荐。" />
|
||||
</local:MyComboBox>
|
||||
@@ -99,37 +98,17 @@
|
||||
<TextBlock x:Name="LabArgumentWindowMiddle" Visibility="Collapsed" Grid.Column="2" Text=" × " VerticalAlignment="Center" FontSize="18" />
|
||||
<local:MyTextBox local:SettingService.Key="LaunchArgumentWindowHeight" x:Name="TextArgumentWindowHeight"
|
||||
Padding="0,0,5,0" Visibility="Collapsed" Grid.Column="3" Width="60" HorizontalContentAlignment="Center" Text="480"
|
||||
ToolTip="Forge 1.12.2 等个别版本存在 Bug,会导致高度设定无效" ToolTipService.Placement="Right" ToolTipService.HorizontalOffset="5">
|
||||
ToolTip="Forge 1.12.2 等个别版本存在 Bug,会导致高度设定无效">
|
||||
<local:MyTextBox.ValidateRules>
|
||||
<local:ValidateInteger Min="1" Max="99999" />
|
||||
</local:MyTextBox.ValidateRules>
|
||||
</local:MyTextBox>
|
||||
</Grid>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Row="12" HorizontalAlignment="Left" Text="Java" Margin="0,0,25,0" />
|
||||
<Grid Grid.ColumnSpan="2" Grid.Row="12" Grid.Column="1" HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<local:MyComboBox
|
||||
x:Name="ComboArgumentJava" Grid.Column="0" ToolTip="若将 Java 放在游戏文件夹或 PCL 文件夹,在进行自动选择时 PCL 会尽量优先选择它">
|
||||
<ComboBoxItem Content="加载中……" IsSelected="True" />
|
||||
<!--<local:MyComboBoxItem Content="Java 8 (1.8.0_171),64 位:C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe" ToolTipService.Placement="Right" ToolTipService.HorizontalOffset="5" IsSelected="True" ToolTip="C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe" />-->
|
||||
</local:MyComboBox>
|
||||
<local:MyIconTextButton Margin="5,0,0,0"
|
||||
x:Name="BtnArgumentJavaSearch" Text="搜索" Grid.Column="1"
|
||||
Logo="F1 M 20,17L 43.25,17L 56,29.75L 56,40L 52,37.5L 52,34L 39,34L 39,21L 24,21L 24,55L 36,55L 32,59L 20,59L 20,17 Z M 43,22.25L 43,30L 50.75,30L 43,22.25 Z M 48,38C 53.5228,38 58,42.4772 58,48C 58,53.5229 53.5228,58 48,58C 46.1455,58 44.4089,57.4952 42.9201,56.6155L 36.1213,63.4142C 35.3403,64.1953 34.0739,64.1953 33.2929,63.4142L 32.5858,62.7071C 31.8047,61.9261 31.8047,60.6597 32.5858,59.8787L 39.3845,53.0799C 38.5048,51.5911 38,49.8545 38,48C 38,42.4772 42.4771,38 48,38 Z M 48,42C 44.6863,42 42,44.6863 42,48C 42,51.3137 44.6863,54 48,54C 51.3137,54 54,51.3137 54,48C 54,44.6863 51.3137,42 48,42 Z" />
|
||||
<local:MyIconTextButton
|
||||
x:Name="BtnArgumentJavaSelect" Text="导入" Grid.Column="2"
|
||||
Logo="M827.4 589.1l-30.7-50.7V151.3c0-29.9-25.2-54.3-56.1-54.3h-527c-9.9 0-24.8 6.3-24.8 24.8v700.5c0 20.2 12.1 37 31.7 43.8l169.1 58.6c4.4 1.5 9.1 2.3 13.8 2.3 10.2 0 20.7-3.4 29.9-10 12.9-9.2 20.3-22.4 20.3-36.2l-0.1-16.6h325.7c30.9 0 56.1-24.3 56.1-54.3v-193c0-9.8-2.7-19.4-7.9-27.8z m-423.5 288l-165.6-54.8V153.8l201.5 51.4v439.2c-0.1 0.5-0.8 2.6-3.2 5.3l-20.9 23.4c-7.6 8.4-11.7 18.7-11.7 28.9v175.1zM785.7 810c0 2.2-2.6 4.6-6.4 4.6h-326l-0.6-108.4 20.9-23.4c10.2-11.4 15.9-25 15.9-38.2V205.2c0-21.6-14-39.3-35.7-45.1l-50.4-13.4h337.3c3.8 0 6.4 2.4 6.4 4.6v387.1c0 9.7 2.7 19.4 8 27.9l30.7 50.7v193z" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</local:MyCard>
|
||||
<local:MyCard Margin="0,0,0,15" Title="内存分配">
|
||||
<StackPanel Margin="25,40,25,15">
|
||||
<local:MyHint x:Name="LabRamWarn" Visibility="Visible" Text="32 位 Java 只能分配最多 1 GB 的内存。强烈建议换用 64 位的 Java!" Theme="Yellow" Margin="0,0,0,12" />
|
||||
<Grid Margin="0,0,0,3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -144,13 +123,12 @@
|
||||
</Grid.RowDefinitions>
|
||||
<local:MyRadioBox local:SettingService.Key="LaunchRamType" local:SettingService.Value="0"
|
||||
Text="自动配置" Width="110" Checked="True" x:Name="RadioRamType0" Margin="0,0,20,0"
|
||||
ToolTip="根据安装的 Mod 量与电脑剩余内存,动态调整为游戏分配的内存" ToolTipService.Placement="Right" ToolTipService.HorizontalOffset="-10" ToolTipService.VerticalOffset="-3" />
|
||||
ToolTip="根据安装的 Mod 量与电脑剩余内存,动态调整为游戏分配的内存" />
|
||||
<local:MyRadioBox local:SettingService.Key="LaunchRamType" local:SettingService.Value="1"
|
||||
Grid.Row="2" Text="自定义" x:Name="RadioRamType1" Margin="0,0,20,0" />
|
||||
<local:MySlider Grid.Row="2" Grid.Column="1" IsEnabled="False" x:Name="SliderRamCustom" local:SettingService.Key="LaunchRamCustom" MaxValue="49" Value="13" />
|
||||
<local:MyCheckBox local:SettingService.Key="LaunchArgumentRam"
|
||||
Grid.Row="4" Grid.ColumnSpan="3" Text="启动游戏前进行内存优化" Height="22" x:Name="CheckArgumentRam"
|
||||
ToolTipService.Placement="Left" ToolTipService.HorizontalOffset="525" ToolTipService.VerticalOffset="-30"
|
||||
ToolTip="内存优化能将当前物理内存占用降低约 1/3,不仅限于 MC!
如果使用机械硬盘,这还可能会导致一小段时间的严重卡顿。
使用 --memory 参数启动 PCL 可以静默执行内存优化。" />
|
||||
<!--<local:MyTextBox Grid.Row="2" Grid.Column="3" Width="100" VerticalAlignment="Center" Margin="30,0,0,0" Text="2048 MB" />-->
|
||||
</Grid>
|
||||
@@ -257,13 +235,15 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="9" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="9" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,25,0">
|
||||
<TextBlock Text="Java 虚拟机参数" VerticalAlignment="Center" />
|
||||
<local:MyIconButton Height="23" Margin="0,1,0,0" x:Name="BtnAdvanceJvmReset" VerticalAlignment="Center"
|
||||
ToolTip="还原" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1"
|
||||
ToolTip="还原" ToolTipService.InitialShowDelay="200"
|
||||
Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
</StackPanel>
|
||||
<local:MyTextBox local:SettingService.Key="LaunchAdvanceJvm" x:Name="TextAdvanceJvm" Grid.ColumnSpan="2" Grid.Column="1"
|
||||
@@ -276,28 +256,38 @@
|
||||
ToolTip="在 MC 启动前执行特定命令或程序,语法与 Windows 的命令提示符一致。

你可以用替换标记来动态改变其内容或实现相对路径,在 更多 → 帮助 中搜索 “替换标记” 以了解用法。例如:
 · "{verpath}test.exe" :运行版本文件夹下的 test.exe 程序
 · "{java}java.exe" -jar "{verpath}test.jar" :用 Java 运行版本文件夹下的 test.jar
 · notepad "{verindie}options.txt" :使用记事本打开该版本的设置文件

涉及路径的操作最好都打上双引号,以避免路径中的空格导致运行失败。
执行命令时,命令行所在的目录是当前的 .minecraft 文件夹。" />
|
||||
<local:MyCheckBox local:SettingService.Key="LaunchAdvanceRunWait" x:Name="CheckAdvanceRunWait" Grid.Row="5" Grid.Column="1" Visibility="Collapsed"
|
||||
Text="等待命令执行完成后再继续启动" Margin="0,8,0,7" />
|
||||
<TextBlock VerticalAlignment="Center" Grid.Row="7" HorizontalAlignment="Left" Text="内存管理" Margin="0,0,25,0" />
|
||||
<local:MyComboBox local:SettingService.Key="LaunchAdvanceGC" Grid.Row="7" Grid.ColumnSpan="2" Grid.Column="1">
|
||||
<local:MyComboBoxItem Content="尽量使用 ZGC"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="在 Java 21+ 使用分代 ZGC,20~15 使用非分代的 ZGC,14- 使用 G1GC。
ZGC 的内存占用比 G1GC 更高,不过在回收内存时不会导致卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="尽量使用分代 ZGC"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="在 Java 21+ 使用分代 ZGC,20- 使用 G1GC。
ZGC 的内存占用比 G1GC 更高,不过在回收内存时不会导致卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="标准 G1GC"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="总是使用 G1GC,附带 Mojang 官方的优化参数。
G1GC 的内存占用比 ZGC 更低,但在回收内存时会导致突然的卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="调优 G1GC" local:SettingService.Value="4"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="总是使用 G1GC,附带 PCL 调优过的优化参数。
G1GC 的内存占用比 ZGC 更低,但在回收内存时会导致突然的卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="不指定(可自定义)" local:SettingService.Value="3"
|
||||
ToolTipService.BetweenShowDelay="0" ToolTip="不自动添加 GC 参数。
仅当选择此项时,你可以在 “Java 虚拟机参数” 设置中手动添加 GC 参数。" />
|
||||
</local:MyComboBox>
|
||||
<StackPanel Margin="0,12,0,4" Grid.Row="8" Grid.ColumnSpan="2" HorizontalAlignment="Left">
|
||||
<local:MyCheckBox Height="28" Text="禁用 Java Launch Wrapper" local:SettingService.Key="LaunchAdvanceDisableJLW"
|
||||
ToolTipService.Placement="Right" ToolTip="是否使用 Java Launch Wrapper 修复 Java 18- 在中文路径下可能无法正常启动的问题。
详见:https://github.com/00ll00/java_launch_wrapper" />
|
||||
<local:MyCheckBox Height="28" Text="禁用 LWJGL Unsafe Agent" local:SettingService.Key="LaunchAdvanceDisableLUA"
|
||||
ToolTipService.Placement="Right" ToolTip="是否使用 LWJGL Unsafe Agent 修复 LWJGL 3.4.1 的一个性能问题。
详见:https://github.com/HMCL-dev/lwjgl-unsafe-agent" />
|
||||
<local:MyCheckBox Height="28" Text="使用高性能显卡" local:SettingService.Key="LaunchAdvanceGraphicCard"
|
||||
ToolTipService.Placement="Right" ToolTip="自动在 Windows 设置 → 系统 → 屏幕 → 显示卡 中将 PCL 和 Java 改为使用高性能显卡。
如果同时有集成显卡和独立显卡,这能确保 MC 使用独立显卡进行渲染,以大幅提高帧率。" />
|
||||
<StackPanel VerticalAlignment="Center" Grid.Row="7" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,25,0">
|
||||
<TextBlock Text="Java 列表" VerticalAlignment="Center" />
|
||||
<local:MyIconButton Height="23" Margin="0,1,0,0" VerticalAlignment="Center" Theme="Black" CanClick="False"
|
||||
ToolTip="启动游戏时,PCL 会选择列表中第一个兼容当前 Minecraft 的 Java。
点击选项右侧的箭头可以进行排序,以控制优先选择哪个 Java。
若想无视兼容性,强制使用某个 Java,请在版本独立设置中修改。" ToolTipService.InitialShowDelay="0" Opacity="0.3"
|
||||
Logo="M512 1008C238.7 1008 16 785.2 16 512S238.7 16 512 16 1008 238.7 1008 512 785.2 1008 512 1008z m0-896c-220.8 0-400 179.2-400 400s179.2 400 400 400 400-179.2 400-400S732.8 112 512 112z M514.5 638.7c-26.2 0-48-21.7-48-48 0-52.4 32-100.4 81.9-120.9 26.8-11.5 51.2-39.6 44.8-76.8-5.1-27.5-32-51.8-62.7-56.9-26.2-4.4-51.8 2.5-70.4 18.5-16 13.4-24.3 32-24.3 51.2 0 26.2-21.7 48-48 48s-48-21.7-48-48c0-47.3 21.1-92.8 58.2-124.1a182.4 182.4 0 0 1 147.8-39.6c71.0 11.5 129.2 66.5 142.0 133.7 14.0 76.8-27.5 151.6-101.7 183.0-14.0 5.7-23.0 18.5-23.0 32.6 0 26.2-21.7 48-48 48zM514.5 793.6c-15.3 0-30.0-6.4-40.9-16.6-10.8-10.8-16.6-25.6-16.6-40.9s5.7-30.0 16.6-40.9c2.5-2.5 5.7-5.1 8.9-7.0s6.4-3.8 9.6-5.1a57.7 57.7 0 0 1 80 53.1 57.6 57.6 0 0 1-57.6 57.6z" />
|
||||
</StackPanel>
|
||||
<local:MyHint Text="版本独立设置中还有更多高级选项可供调整。" Margin="0,5,0,10" Theme="Blue" Grid.Row="9" Grid.ColumnSpan="2"
|
||||
<Grid x:Name="PanAdvanceJava" Grid.ColumnSpan="2" Grid.Row="7" Grid.Column="1" HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<local:MyComboBox x:Name="ComboAdvanceJava" Grid.Column="0">
|
||||
<!--<local:MyComboBoxItem Content="Java 8 (1.8.0_171),64 位:C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe" IsSelected="True" ToolTip="C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe" />-->
|
||||
</local:MyComboBox>
|
||||
<TextBlock x:Name="LabAdvanceJava" Grid.Column="0" Margin="8.5,0,21.5,0" IsHitTestVisible="False" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
<local:MyIconButton Margin="5,2,0,2" Grid.Column="1" x:Name="BtnAdvanceJavaSearch"
|
||||
Logo="M512.0 838.3c-80.2 0-153.4-29.3-210.2-77.4l75.5-75.5c11.5-11.5 25.8-22.0 25.8-37.0a27.2 27.2 0 0 0-27.1-27.1H104.0c-27.1 0-27.1 23.9-27.1 27.1v271.9a27.1 27.1 0 0 0 27.1 27.1c15.0 0 27.8-16.6 42.5-31.2l77.9-77.9c76.6 67.7 177.1 108.9 287.4 108.9 221.7 0 404.5-166.0 431.2-380.6h-109.8c-25.9 154.2-159.7 271.9-321.3 271.9zM919.9 76.6c-15.0 0-27.8 16.6-42.5 31.3L799.5 185.8c-76.5-67.7-177.1-108.9-287.4-108.9-221.8 0-404.5 166.1-431.3 380.6H190.6c25.9-154.2 159.7-271.9 321.4-271.9 80.2 0 153.4 29.3 210.1 77.4l-75.5 75.5c-11.6 11.5-25.8 22.0-25.8 37.1a27.2 27.2 0 0 0 27.1 27.1h271.9c27.1 0 27.1-23.9 27.1-27.1V103.8a27.1 27.1 0 0 0-27.1-27.1z" />
|
||||
</Grid>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Row="9" HorizontalAlignment="Left" Text="内存管理" Margin="0,0,25,0" />
|
||||
<local:MyComboBox local:SettingService.Key="LaunchAdvanceGC" Grid.Row="9" Grid.ColumnSpan="2" Grid.Column="1">
|
||||
<local:MyComboBoxItem Content="尽量使用 ZGC" ToolTip="在 Java 21+ 使用分代 ZGC,20~15 使用非分代的 ZGC,14- 使用 G1GC。
ZGC 的内存占用比 G1GC 更高,不过在回收内存时不会导致卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="尽量使用分代 ZGC" ToolTip="在 Java 21+ 使用分代 ZGC,20- 使用 G1GC。
ZGC 的内存占用比 G1GC 更高,不过在回收内存时不会导致卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="标准 G1GC" ToolTip="总是使用 G1GC,附带 Mojang 官方的优化参数。
G1GC 的内存占用比 ZGC 更低,但在回收内存时会导致突然的卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="调优 G1GC" local:SettingService.Value="4" ToolTip="总是使用 G1GC,附带 PCL 调优过的优化参数。
G1GC 的内存占用比 ZGC 更低,但在回收内存时会导致突然的卡顿。
覆盖 “Java 虚拟机参数” 设置中的 GC 相关参数。" />
|
||||
<local:MyComboBoxItem Content="不指定(可自定义)" local:SettingService.Value="3" ToolTip="不自动添加 GC 参数。
仅当选择此项时,你可以在 “Java 虚拟机参数” 设置中手动添加 GC 参数。" />
|
||||
</local:MyComboBox>
|
||||
<StackPanel Margin="0,12,0,4" Grid.Row="10" Grid.ColumnSpan="2" HorizontalAlignment="Left">
|
||||
<local:MyCheckBox Height="28" Text="禁用 Java Launch Wrapper" local:SettingService.Key="LaunchAdvanceDisableJLW" ToolTip="是否使用 Java Launch Wrapper 修复 Java 18- 在中文路径下可能无法正常启动的问题。
详见:https://github.com/00ll00/java_launch_wrapper" />
|
||||
<local:MyCheckBox Height="28" Text="禁用 LWJGL Unsafe Agent" local:SettingService.Key="LaunchAdvanceDisableLUA" ToolTip="是否使用 LWJGL Unsafe Agent 修复 LWJGL 3.4.1 的一个性能问题。
详见:https://github.com/HMCL-dev/lwjgl-unsafe-agent" />
|
||||
<local:MyCheckBox Height="28" Text="使用高性能显卡" local:SettingService.Key="LaunchAdvanceGraphicCard" ToolTip="自动在 Windows 设置 → 系统 → 屏幕 → 显示卡 中将 PCL 和 Java 改为使用高性能显卡。
如果同时有集成显卡和独立显卡,这能确保 MC 使用独立显卡进行渲染,以大幅提高帧率。" />
|
||||
</StackPanel>
|
||||
<local:MyHint Text="版本独立设置中还有更多高级选项可供调整。" Margin="0,5,0,10" Theme="Blue" Grid.Row="11" Grid.ColumnSpan="2"
|
||||
CanClose="True" RelativeSetup="HintMoreAdvancedSetup" />
|
||||
</Grid>
|
||||
</local:MyCard>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageSetupLaunch
|
||||
Public Class PageSetupLaunch
|
||||
|
||||
Private Sub PageSetupLaunch_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
'重复加载部分
|
||||
@@ -6,15 +6,16 @@
|
||||
RefreshRam(False)
|
||||
BtnSwitch.Visibility = If(McInstanceSelected Is Nothing, Visibility.Collapsed, Visibility.Visible)
|
||||
|
||||
'Java 可能在版本设置被修改,所以总是重新加载(反正其他的 Refresh 也不太吃性能)
|
||||
AniControlEnabled += 1
|
||||
Refresh()
|
||||
AniControlEnabled -= 1
|
||||
|
||||
'非重复加载部分
|
||||
Static Reloaded As Boolean = False
|
||||
If Reloaded Then Return
|
||||
Reloaded = True
|
||||
|
||||
AniControlEnabled += 1
|
||||
Refresh()
|
||||
AniControlEnabled -= 1
|
||||
|
||||
'内存自动刷新
|
||||
Dim timer As New Threading.DispatcherTimer With {.Interval = New TimeSpan(0, 0, 0, 1)}
|
||||
AddHandler timer.Tick, AddressOf RefreshRam
|
||||
@@ -25,7 +26,7 @@
|
||||
SettingService.RefreshSettings(Me)
|
||||
UpdateSkinType()
|
||||
UpdateRamType()
|
||||
UpdateJavaComboBox()
|
||||
UpdateJavaList()
|
||||
Catch ex As NullReferenceException
|
||||
Logger.Error(ex, "启动设置项存在异常,已被自动重置", LogBehavior.Alert)
|
||||
Reset()
|
||||
@@ -37,9 +38,9 @@
|
||||
Try
|
||||
SettingService.ResetSettings(Me)
|
||||
Settings.Set("LaunchArgumentIndieV2", Settings.GetDefault("LaunchArgumentIndieV2"))
|
||||
Settings.Reset("LaunchArgumentJavaAll")
|
||||
Settings.Reset("LaunchArgumentJavaSelect")
|
||||
JavaSearchLoader.Start(IsForceRestart:=True)
|
||||
Configs.JavaList.Reset()
|
||||
Configs.JavaRemovedList.Reset()
|
||||
JavaListRefreshWorker.Start()
|
||||
Hint("已初始化启动设置!", HintType.Green)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, "初始化启动设置失败", LogBehavior.Alert)
|
||||
@@ -57,7 +58,7 @@
|
||||
Private Sub RadioSkinType3_Check(sender As Object, e As RouteEventArgs) Handles RadioSkinType4.PreviewCheck
|
||||
If Not (AniControlEnabled = 0 AndAlso e.RaiseByMouse) Then Return
|
||||
'已有图片则不再选择
|
||||
If FileUtils.Exists(PathAppdata & "CustomSkin.png") Then Return
|
||||
If FileUtils.Exists(Paths.AppDataThenName & "CustomSkin.png") Then Return
|
||||
'没有图片则要求选择
|
||||
Dim SkinInfo As McSkinInfo = McSkinSelect()
|
||||
If Not SkinInfo.IsVaild Then
|
||||
@@ -71,17 +72,17 @@
|
||||
Private Function ChangeSkin(SkinInfo As McSkinInfo) As Boolean
|
||||
Try
|
||||
'复制文件
|
||||
FileUtils.Copy(SkinInfo.LocalFile, PathAppdata & "CustomSkin.png")
|
||||
FileUtils.Copy(SkinInfo.LocalFile, Paths.AppDataThenName & "CustomSkin.png")
|
||||
'将单层皮肤扩展到双层
|
||||
Dim Bitmap As New MyBitmap(PathAppdata & "CustomSkin.png")
|
||||
Dim Bitmap As New MyBitmap(Paths.AppDataThenName & "CustomSkin.png")
|
||||
If Bitmap.Pic.Width = 64 AndAlso Bitmap.Pic.Height = 32 Then
|
||||
Dim Img As System.Drawing.Image = Bitmap
|
||||
Dim NewBitmap As New System.Drawing.Bitmap(64, 64)
|
||||
Using g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(NewBitmap)
|
||||
g.DrawImageUnscaled(Img, New System.Drawing.Point(0, 0))
|
||||
End Using
|
||||
FileUtils.Delete(PathAppdata & "CustomSkin.png")
|
||||
NewBitmap.Save(PathAppdata & "CustomSkin.png")
|
||||
FileUtils.Delete(Paths.AppDataThenName & "CustomSkin.png")
|
||||
NewBitmap.Save(Paths.AppDataThenName & "CustomSkin.png")
|
||||
End If
|
||||
'更新设置
|
||||
Settings.Set("LaunchSkinSlim", SkinInfo.IsSlim)
|
||||
@@ -96,7 +97,7 @@
|
||||
End Function
|
||||
Private Sub BtnSkinDelete_Click(sender As Object, e As EventArgs) Handles BtnSkinDelete.Click
|
||||
Try
|
||||
FileUtils.Delete(PathAppdata & "CustomSkin.png")
|
||||
FileUtils.Delete(Paths.AppDataThenName & "CustomSkin.png")
|
||||
RadioSkinType0.SetChecked(True, True)
|
||||
Hint("离线皮肤已清空!", HintType.Green)
|
||||
Catch ex As Exception
|
||||
@@ -164,7 +165,6 @@
|
||||
If(RamGame <> RamGameActual, " (可用 " & If(RamGameActual = Math.Floor(RamGameActual), RamGameActual & ".0", RamGameActual) & " GB)", "")
|
||||
LabRamUsed.Text = If(RamUsed = Math.Floor(RamUsed), RamUsed & ".0", RamUsed) & " GB"
|
||||
LabRamTotal.Text = " / " & If(RamTotal = Math.Floor(RamTotal), RamTotal & ".0", RamTotal) & " GB"
|
||||
LabRamWarn.Visibility = If(RamGame = 1 AndAlso Not JavaIs64Bit() AndAlso Not Is32BitSystem AndAlso JavaList.Any, Visibility.Visible, Visibility.Collapsed)
|
||||
If ShowAnim Then
|
||||
'宽度动画
|
||||
AniStart({
|
||||
@@ -270,7 +270,7 @@
|
||||
''' <summary>
|
||||
''' 获取当前设置的 RAM 值。单位为 GB。
|
||||
''' </summary>
|
||||
Public Shared Function GetRam(Instance As McInstance, UseVersionJavaSetup As Boolean, Optional Is32BitJava As Boolean? = Nothing) As Double
|
||||
Public Shared Function GetRam(Instance As McInstance, UseVersionJavaSetup As Boolean) As Double
|
||||
|
||||
'------------------------------------------
|
||||
' 修改下方代码时需要一并修改 PageInstanceSetup
|
||||
@@ -344,119 +344,97 @@ PreFin:
|
||||
RamGive = (Value - 33) * 2 + 16
|
||||
End If
|
||||
End If
|
||||
'若使用 32 位 Java,则限制为 1G
|
||||
If If(Is32BitJava, Not JavaIs64Bit(If(UseVersionJavaSetup, Instance, Nothing))) Then RamGive = Math.Min(1, RamGive)
|
||||
Return RamGive
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Java 选择"
|
||||
'注意:修改此处代码时需要同时修改 PageInstanceSetup.xaml.vb
|
||||
|
||||
'刷新 Java 下拉框显示
|
||||
Public Sub UpdateJavaComboBox()
|
||||
If ComboArgumentJava Is Nothing Then Return
|
||||
'初始化列表
|
||||
ComboArgumentJava.Items.Clear()
|
||||
ComboArgumentJava.Items.Add(New MyComboBoxItem With {.Content = "自动选择(推荐)", .Tag = "自动选择"})
|
||||
Public Sub UpdateJavaList()
|
||||
If ComboAdvanceJava Is Nothing OrElse LabAdvanceJava Is Nothing OrElse Not ComboAdvanceJava.IsLoaded Then Return
|
||||
ComboAdvanceJava.Items.Clear()
|
||||
'还需要等待搜索结束
|
||||
If JavaListRefreshWorker.Running Then
|
||||
BtnAdvanceJavaSearch.IsEnabled = False
|
||||
ComboAdvanceJava.IsEnabled = False
|
||||
LabAdvanceJava.Text = "搜索中 …"
|
||||
Return
|
||||
End If
|
||||
'========================================== 显示结果 ==========================================
|
||||
BtnAdvanceJavaSearch.IsEnabled = True
|
||||
ComboAdvanceJava.IsEnabled = True
|
||||
'更新下拉框文本
|
||||
Dim Count = Configs.JavaList.Get().Count
|
||||
LabAdvanceJava.Text = If(Count > 0, $"共有 {Count} 个 Java …", "未找到 Java,点击以导入已有的 Java")
|
||||
'更新列表
|
||||
Dim SelectedItem As MyComboBoxItem = Nothing
|
||||
Dim SelectedBySetup As String = Settings.Get(Of String)("LaunchArgumentJavaSelect")
|
||||
Try
|
||||
For Each Java In JavaList.ToList().OrderByDescending(Function(v) v.MajorVersion)
|
||||
Dim ListItem = New MyComboBoxItem With {.Content = Java.ToString, .ToolTip = Java.PathFolder, .Tag = Java}
|
||||
ToolTipService.SetHorizontalOffset(ListItem, 400)
|
||||
ComboArgumentJava.Items.Add(ListItem)
|
||||
'判断人为选中
|
||||
If SelectedBySetup = "" Then Continue For
|
||||
If JavaEntry.FromJson(GetJson(SelectedBySetup)).PathFolder = Java.PathFolder Then SelectedItem = ListItem
|
||||
Dim JavaEntries = Configs.JavaList.Get()
|
||||
For i = 0 To JavaEntries.Count - 1
|
||||
Dim JavaEntry = JavaEntries(i)
|
||||
Dim JavaItem As New MyListItem With {
|
||||
.FontSize = 13, .Height = 24, .IsScaleAnimationEnabled = False, .Type = MyListItem.CheckType.Clickable,
|
||||
.Tag = JavaEntry, .Title = JavaEntry.ToString}
|
||||
AddHandler JavaItem.MouseLeftButtonUp, Sub(sender As Object, e As MouseButtonEventArgs) e.Handled = True
|
||||
AddHandler JavaItem.Click, Sub() Hint("点击选项右侧的箭头可以进行排序,以控制 PCL 优先选择哪个 Java!")
|
||||
ComboAdvanceJava.Items.Add(JavaItem)
|
||||
Dim Buttons As New List(Of MyIconButton)
|
||||
'向上移动按钮
|
||||
Dim UpButton As New MyIconButton With {.Logo = Logo.IconButtonArrowUp, .LogoScale = 0.95, .Height = 24, .Width = 24}
|
||||
UpButton.IsEnabled = i > 0
|
||||
UpButton.ToolTip = "提高优先级"
|
||||
ToolTipService.SetShowOnDisabled(UpButton, True)
|
||||
AddHandler UpButton.Click, Sub() MoveJavaInList(JavaEntry, -1)
|
||||
Buttons.Add(UpButton)
|
||||
'向下移动按钮
|
||||
Dim DownButton As New MyIconButton With {.Logo = Logo.IconButtonArrowDown, .LogoScale = 0.95, .Height = 24, .Width = 24}
|
||||
DownButton.IsEnabled = i < JavaEntries.Count - 1
|
||||
DownButton.ToolTip = "降低优先级"
|
||||
ToolTipService.SetShowOnDisabled(DownButton, True)
|
||||
AddHandler DownButton.Click, Sub() MoveJavaInList(JavaEntry, 1)
|
||||
Buttons.Add(DownButton)
|
||||
'从列表中移除按钮
|
||||
Dim IsOfficial As Boolean = JavaEntry.Folder.StartsWithF($"{Paths.AppData}.minecraft\runtime\")
|
||||
Dim DeleteButton As New MyIconButton With {.Logo = Logo.IconButtonStop, .Height = 24, .Width = 24}
|
||||
DeleteButton.IsEnabled = Not IsOfficial
|
||||
DeleteButton.ToolTip = If(DeleteButton.IsEnabled, "从列表中移除", "无法移除官方 Java")
|
||||
AddHandler DeleteButton.Click, Sub() ManuallyRemoveJava(JavaEntry)
|
||||
ToolTipService.SetShowOnDisabled(DeleteButton, True)
|
||||
Buttons.Add(DeleteButton)
|
||||
'打开文件夹按钮
|
||||
Dim OpenButton As New MyIconButton With {.Logo = Logo.IconButtonOpen, .LogoScale = 1.1, .Height = 24, .Width = 24}
|
||||
OpenButton.ToolTip = "打开文件夹"
|
||||
AddHandler OpenButton.Click, Sub() OpenExplorer(JavaEntry.JavaExePath)
|
||||
Buttons.Add(OpenButton)
|
||||
JavaItem.Buttons = Buttons
|
||||
Next
|
||||
Dim ImportItem As New MyListItem With {
|
||||
.FontSize = 13, .Height = 24, .IsScaleAnimationEnabled = False, .Title = "导入电脑中已有的 Java…", .Type = MyListItem.CheckType.Clickable}
|
||||
AddHandler ImportItem.MouseLeftButtonUp,
|
||||
Sub(sender As Object, e As MouseButtonEventArgs)
|
||||
e.Handled = True
|
||||
ManuallyImportJava()
|
||||
End Sub
|
||||
ComboAdvanceJava.Items.Add(ImportItem)
|
||||
Catch ex As Exception
|
||||
Settings.Set("LaunchArgumentJavaSelect", "")
|
||||
Logger.Error(ex, "更新设置 Java 下拉框失败")
|
||||
End Try
|
||||
'更新选择项
|
||||
If SelectedItem Is Nothing AndAlso JavaList.Any Then SelectedItem = ComboArgumentJava.Items(0) '选中 “自动选择”
|
||||
ComboArgumentJava.SelectedItem = SelectedItem
|
||||
'结束处理
|
||||
If SelectedItem Is Nothing Then
|
||||
ComboArgumentJava.Items.Clear()
|
||||
ComboArgumentJava.Items.Add(New ComboBoxItem With {.Content = "未找到可用的 Java", .IsSelected = True})
|
||||
End If
|
||||
RefreshRam(True)
|
||||
End Sub
|
||||
'阻止在特定情况下展开下拉框
|
||||
Private Sub ComboArgumentJava_DropDownOpened(sender As Object, e As EventArgs) Handles ComboArgumentJava.DropDownOpened
|
||||
If ComboArgumentJava.SelectedItem Is Nothing OrElse ComboArgumentJava.Items(0).Content = "未找到可用的 Java" OrElse ComboArgumentJava.Items(0).Content = "加载中……" Then
|
||||
ComboArgumentJava.IsDropDownOpen = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'下拉框选择更改
|
||||
Private Sub JavaSelectionUpdate() Handles ComboArgumentJava.SelectionChanged
|
||||
If AniControlEnabled <> 0 Then Return
|
||||
'Java 不可用时也不清空,会导致刷新时找不到对象
|
||||
If ComboArgumentJava.SelectedItem Is Nothing OrElse ComboArgumentJava.SelectedItem.Tag Is Nothing Then Return
|
||||
'设置新的 Java
|
||||
Dim SelectedJava = ComboArgumentJava.SelectedItem.Tag
|
||||
If "自动选择".Equals(SelectedJava) Then
|
||||
'选择 “自动”
|
||||
Settings.Set("LaunchArgumentJavaSelect", "")
|
||||
Logger.Info("修改 Java 选择设置:自动选择")
|
||||
Else
|
||||
'选择指定项
|
||||
Settings.Set("LaunchArgumentJavaSelect", CType(SelectedJava.ToJson(), JObject).ToString(Newtonsoft.Json.Formatting.None))
|
||||
Logger.Info($"修改 Java 选择设置:{SelectedJava}")
|
||||
End If
|
||||
RefreshRam(True)
|
||||
End Sub
|
||||
|
||||
'手动选择
|
||||
Private Sub BtnArgumentJavaSelect_Click(sender As Object, e As EventArgs) Handles BtnArgumentJavaSelect.Click
|
||||
If JavaSearchLoader.State = LoadState.Loading Then
|
||||
Hint("正在搜索 Java,请稍候!", HintType.Red)
|
||||
Return
|
||||
End If
|
||||
'选择 Java
|
||||
Dim JavaSelected As String = Dialogs.SelectFile("选择 bin 文件夹中的 javaw.exe 文件", False, filter:={({"exe"}, "javaw.exe")}).FirstOrDefault()
|
||||
If String.IsNullOrEmpty(JavaSelected) Then Return
|
||||
JavaSelected = PathUtils.AddSlashSuffix(PathUtils.RemoveLastPart(JavaSelected))
|
||||
Try
|
||||
'验证 Java 可用
|
||||
Dim NewEntry As New JavaEntry(JavaSelected, True)
|
||||
NewEntry.Check()
|
||||
'加入列表
|
||||
Dim JavaNewList As New JArray From {NewEntry.ToJson}
|
||||
For Each JsonEntry In GetJson(Settings.Get(Of String)("LaunchArgumentJavaAll"))
|
||||
Dim Entry = JavaEntry.FromJson(JsonEntry)
|
||||
If Entry.PathFolder = NewEntry.PathFolder Then Continue For
|
||||
JavaNewList.Add(JsonEntry)
|
||||
Next
|
||||
Settings.Set("LaunchArgumentJavaAll", JavaNewList.ToString(Newtonsoft.Json.Formatting.None))
|
||||
'重新加载列表
|
||||
JavaSearchLoader.Start(IsForceRestart:=True)
|
||||
Hint("已将该 Java 加入 Java 列表!", HintType.Green)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, "该 Java 存在异常,无法使用", LogBehavior.Alert)
|
||||
Return
|
||||
Logger.Error(ex, "更新 Java 列表下拉框失败")
|
||||
End Try
|
||||
End Sub
|
||||
'自动查找
|
||||
Private Sub BtnArgumentJavaSearch_Click(sender As Object, e As EventArgs) Handles BtnArgumentJavaSearch.Click
|
||||
If JavaSearchLoader.State = LoadState.Loading Then
|
||||
Hint("正在搜索 Java,请稍候!", HintType.Red)
|
||||
Return
|
||||
End If
|
||||
RunInThread(
|
||||
Sub()
|
||||
Hint("正在搜索 Java!")
|
||||
JavaSearchLoader.WaitForExit(IsForceRestart:=True)
|
||||
If Not JavaList.Any() Then
|
||||
Hint("未找到可用的 Java!", HintType.Red)
|
||||
Else
|
||||
Hint("已找到 " & JavaList.Count & " 个 Java,请检查下拉框查看列表!", HintType.Green)
|
||||
End If
|
||||
Private Sub MoveJavaInList(JavaEntry As Java, Offset As Integer)
|
||||
Configs.JavaList.Edit(
|
||||
Sub(ByRef List)
|
||||
Dim Index = List.IndexOf(JavaEntry)
|
||||
Dim NewIndex = Index + Offset
|
||||
If Index < 0 OrElse NewIndex < 0 OrElse NewIndex >= List.Count Then Return
|
||||
List.RemoveAt(Index)
|
||||
List.Insert(NewIndex, JavaEntry)
|
||||
End Sub)
|
||||
UpdateJavaLists()
|
||||
End Sub
|
||||
Private Sub BtnAdvanceJavaSearch_Click() Handles BtnAdvanceJavaSearch.Click
|
||||
ManuallySearchJava()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
@@ -476,7 +454,7 @@ PreFin:
|
||||
If ComboArgumentVisibie.SelectedIndex = 0 Then
|
||||
If MyMsgBox("若在游戏启动后立即关闭启动器,崩溃检测、更改游戏标题等功能将失效。" & vbCrLf &
|
||||
"如果想保留这些功能,可以选择让启动器在游戏启动后隐藏,游戏退出后自动关闭。", "提醒", "继续", "取消") = 2 Then
|
||||
ComboArgumentVisibie.SelectedItem = e.RemovedItems(0)
|
||||
If e.RemovedItems.Count > 0 Then ComboArgumentVisibie.SelectedItem = e.RemovedItems(0)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
@@ -487,7 +465,7 @@ PreFin:
|
||||
If Not CheckArgumentRam.Checked Then Return
|
||||
If MyMsgBox("内存优化会显著延长启动耗时,建议仅在内存不足时开启。" & vbCrLf &
|
||||
"如果你在使用机械硬盘,这还可能导致一小段时间的严重卡顿。" &
|
||||
If(SystemUtils.HasAdminRole(), "", $"{vbCrLf}{vbCrLf}每次启动游戏,PCL 都需要申请管理员权限以进行内存优化。{vbCrLf}若想自动授予权限,可以右键 PCL,打开 属性 → 兼容性 → 以管理员身份运行此程序。"),
|
||||
If(WindowsUtils.HasAdminRole(), "", $"{vbCrLf}{vbCrLf}每次启动游戏,PCL 都需要申请管理员权限以进行内存优化。{vbCrLf}若想自动授予权限,可以右键 PCL,打开 属性 → 兼容性 → 以管理员身份运行此程序。"),
|
||||
"提醒", "确定", "取消") = 2 Then
|
||||
CheckArgumentRam.Checked = False
|
||||
End If
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageLeft
|
||||
<local:MyPageLeft
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="PageSetupLeft"
|
||||
@@ -8,7 +8,7 @@
|
||||
LogoScale="0.8" Logo="M52.1,164.5c-1.4,0-3.1-0.5-4.2-1.3c-2.6-1.7-4-4.2-4-7V43.8c0-2.9,1.6-5.8,4.1-7c1.2-0.8,2.7-1.2,4.1-1.2c1.5,0,2.9,0.4,4.2,1.2L153.1,93c0,0,0.1,0,0.1,0.1c2.6,1.7,4,4.2,4,7c0,3-1.7,5.8-4.2,7.1l-96.8,56.2C55.1,164,53.5,164.5,52.1,164.5z M60.4,142.1l72.1-42.1L60.4,58.2V142.1z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="0" ToolTip="初始化本页设置" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
<local:MyIconButton Tag="0" ToolTip="初始化本页设置" ToolTipService.InitialShowDelay="200" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
@@ -16,7 +16,7 @@
|
||||
LogoScale="0.77" Logo="M512 817c-48.601 0-88-39.399-88-88s39.399-88 88-88 88 39.399 88 88-39.399 88-88 88zM237.671 565.74C308.335 474.58 397.369 429 504.774 429c118.433 0 214.225 55.421 287.377 166.264l-53.407 30.369c-13.84 7.87-31.362 4.367-41.114-8.219-50.291-64.911-114.577-97.367-192.856-97.367-86.851 0-156.835 40.318-209.95 120.953l-47.995-28.02c-15.263-8.91-20.412-28.507-11.502-43.77a32 32 0 0 1 2.344-3.47zM107.691 419.47C205.24 278.491 337.805 208 505.379 208c178.77 0 317.694 80.224 416.772 240.672l-56.54 31.73c-13.686 7.68-30.922 4.303-40.697-7.975C735.581 360.213 629.07 303.009 505.38 300.815 373.997 298.485 261.637 362.88 168.3 494l-50.116-28.505c-15.362-8.738-20.732-28.275-11.994-43.637a32 32 0 0 1 1.5-2.387z" >
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="1" ToolTip="初始化本页设置" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
<local:MyIconButton Tag="1" ToolTip="初始化本页设置" ToolTipService.InitialShowDelay="200" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
@@ -24,7 +24,7 @@
|
||||
LogoScale="0.9" Logo="M764.0 0.0a215.4 215.4 0 0 0-76.2 13.9l-9.0 3.6c-49.1 20.7-88.5 30.5-115.4 30.5-27.0 0-66.4-9.8-116.6-31.0a217.5 217.5 0 0 0-72.1-16.7l-9.1-0.3-3.8-0.0-8.6 0.3-4.2 0.2A160.7 160.7 0 0 0 250.4 45.3l-219.3 212.4a102.3 102.3 0 0 0-11.2 134.2l106.3 144.5 3.3 4.3a102.4 102.4 0 0 0 112.8 31.6l5.6-2.1V883.2a140.7 140.7 0 0 0 140.7 140.7h372.1l5.6-0.1a140.7 140.7 0 0 0 135.1-140.6l-0.0-318.6 1.1 0.7a102.3 102.3 0 0 0 141.9-44.2l70.9-144.3a102.3 102.3 0 0 0-20.6-118.6L875.8 45.3A160.7 160.7 0 0 0 764.0 0.0z m-357.3 111.4C468.4 137.6 520.5 150.6 563.1 150.6c42.4 0 94.5-12.9 156.1-38.9A112.5 112.5 0 0 1 764.0 102.4c15.1 0 29.6 5.8 40.5 16.4L1023.9 331.4l-70.9 144.3-93.0-65.6a38.3 38.3 0 0 0-60.5 31.3V883.2a38.3 38.3 0 0 1-38.3 38.3H388.8a38.3 38.3 0 0 1-38.3-38.3V445.1a38.3 38.3 0 0 0-61.6-30.4l-80.0 61.2L102.3 331.3l219.3-212.4a58.3 58.3 0 0 1 35.5-16.2L362.1 102.4l6.3 0.1a115.1 115.1 0 0 1 38.2 8.8z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="2" ToolTip="初始化本页设置" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
<local:MyIconButton Tag="2" ToolTip="初始化本页设置" ToolTipService.InitialShowDelay="200" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
@@ -32,7 +32,7 @@
|
||||
LogoScale="0.8" Logo="M364 0h-273C40 0 0 40 0 91v273C0 414 40 455 91 455h273C414 455 455 414 455 364V91C455 40 414 0 364 0zM341 341H113V113h227v227zM933 0h-273C609 0 568 40 568 91v273c0 50 40 91 91 91h273C983 455 1024 414 1024 364V91c0-50-40-91-90-91zM910 341h-227V113h227v227zM364 568h-273C40 568 0 609 0 659v273c0 50 40 91 91 91h273C414 1024 455 983 455 932v-273C455 609 414 568 364 568zM341 910H113v-227h227v227zM933 568h-273c-50 0-91 40-91 91v273c0 50 40 91 91 91h273c50 0 90-40 90-91v-273c0-50-40-90-90-90zM910 910h-227v-227h227v227z">
|
||||
<local:MyListItem.Buttons>
|
||||
<x:Array Type="{x:Type local:MyIconButton}">
|
||||
<local:MyIconButton Tag="3" ToolTip="初始化本页设置" ToolTipService.Placement="Right" ToolTipService.InitialShowDelay="200" ToolTipService.VerticalOffset="-1" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
<local:MyIconButton Tag="3" ToolTip="初始化本页设置" ToolTipService.InitialShowDelay="200" Click="Reset" Logo="M530 0c287 0 521 229 521 511s-233 511-521 511c-233 0-436-151-500-368a63 63 0 0 1 44-79 65 65 0 0 1 80 43c48 162 200 276 375 276 215 0 390-171 390-383s-174-383-390-383c-103 0-199 39-270 106l21-5a63 63 0 0 1 33 123l-157 42a65 65 0 0 1-90-42l-49-183a65 65 0 1 1 126-33l6 26A524 524 0 0 1 530 0z" LogoScale="0.9" />
|
||||
</x:Array>
|
||||
</local:MyListItem.Buttons>
|
||||
</local:MyListItem>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageSetupLeft
|
||||
Public Class PageSetupLeft
|
||||
|
||||
Private IsLoad As Boolean = False
|
||||
Private IsPageSwitched As Boolean = False '如果在 Loaded 前切换到其他页面,会导致触发 Loaded 时再次切换一次
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageSetupLink
|
||||
Public Class PageSetupLink
|
||||
|
||||
Private Sub PageSetupLink_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Class PageSetupSystem
|
||||
Public Class PageSetupSystem
|
||||
|
||||
|
||||
Private Sub PageSetupSystem_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<local:MyPageRight
|
||||
<local:MyPageRight
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:PCL" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -65,30 +65,30 @@
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="4"
|
||||
Grid.Column="5" Grid.Row="0" Text="橡木棕" x:Name="RadioLauncherTheme4" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="5"
|
||||
Grid.Column="1" Grid.Row="1" Text="玄素黑" x:Name="RadioLauncherTheme5" Opacity="0" ToolTip="灰色是个谎言" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="1" Grid.Row="1" Text="玄素黑" x:Name="RadioLauncherTheme5" Opacity="0" ToolTip="灰色是个谎言" />
|
||||
<local:MyRadioBox Grid.Column="1" Grid.Row="1" Text="玄素黑" x:Name="RadioLauncherTheme5Gray" IsEnabled="False" Opacity="1" />
|
||||
<TextBlock Grid.Column="1" Grid.Row="1" x:Name="LabLauncherTheme5Unlock" Background="{StaticResource ColorBrushSemiTransparent}" ToolTip="灰色是个谎言" ToolTipService.Placement="Bottom" />
|
||||
<TextBlock Grid.Column="1" Grid.Row="1" x:Name="LabLauncherTheme5Unlock" Background="{StaticResource ColorBrushSemiTransparent}" ToolTip="灰色是个谎言" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="12"
|
||||
Grid.Column="2" Grid.Row="1" Text="滑稽彩" x:Name="RadioLauncherTheme12" IsEnabled="False" ToolTip="滑稽树上滑稽果,滑稽树下你和我,滑稽之日搞事情,欢乐多又多" ToolTipService.ShowOnDisabled="True" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="2" Grid.Row="1" Text="滑稽彩" x:Name="RadioLauncherTheme12" IsEnabled="False" ToolTip="滑稽树上滑稽果,滑稽树下你和我,滑稽之日搞事情,欢乐多又多" ToolTipService.ShowOnDisabled="True" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="6"
|
||||
Grid.Column="3" Grid.Row="1" Text="铁杆粉" x:Name="RadioLauncherTheme6" IsEnabled="False" ToolTip="99 次重逢的喜悦" ToolTipService.ShowOnDisabled="True" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="3" Grid.Row="1" Text="铁杆粉" x:Name="RadioLauncherTheme6" IsEnabled="False" ToolTip="99 次重逢的喜悦" ToolTipService.ShowOnDisabled="True" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="7"
|
||||
Grid.Column="4" Grid.Row="1" Text="神秘紫" x:Name="RadioLauncherTheme7" IsEnabled="False" ToolTip="072 101 108 112 032 068 101 118 032 048 046 052 046 052" ToolTipService.ShowOnDisabled="True" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="4" Grid.Row="1" Text="神秘紫" x:Name="RadioLauncherTheme7" IsEnabled="False" ToolTip="072 101 108 112 032 068 101 118 032 048 046 052 046 052" ToolTipService.ShowOnDisabled="True" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="13"
|
||||
Grid.Column="5" Grid.Row="1" Text="欧皇彩" x:Name="RadioLauncherTheme13" IsEnabled="False" ToolTip="这就是传说中的欧皇了吧" ToolTipService.ShowOnDisabled="True" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="5" Grid.Row="1" Text="欧皇彩" x:Name="RadioLauncherTheme13" IsEnabled="False" ToolTip="这就是传说中的欧皇了吧" ToolTipService.ShowOnDisabled="True" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="8"
|
||||
Grid.Column="1" Grid.Row="2" Text="秋仪金" x:Name="RadioLauncherTheme8" IsEnabled="False" ToolTipService.Placement="Bottom" />
|
||||
<TextBlock Grid.Column="1" Grid.Row="2" x:Name="LabLauncherTheme8Copy" Background="{StaticResource ColorBrushSemiTransparent}" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="1" Grid.Row="2" Text="秋仪金" x:Name="RadioLauncherTheme8" IsEnabled="False" />
|
||||
<TextBlock Grid.Column="1" Grid.Row="2" x:Name="LabLauncherTheme8Copy" Background="{StaticResource ColorBrushSemiTransparent}" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="9"
|
||||
Grid.Column="2" Grid.Row="2" Text="活跃橙" x:Name="RadioLauncherTheme9" IsEnabled="False" ToolTipService.Placement="Bottom" />
|
||||
<TextBlock Grid.Column="2" Grid.Row="2" x:Name="LabLauncherTheme9Copy" Background="{StaticResource ColorBrushSemiTransparent}" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="2" Grid.Row="2" Text="活跃橙" x:Name="RadioLauncherTheme9" IsEnabled="False" />
|
||||
<TextBlock Grid.Column="2" Grid.Row="2" x:Name="LabLauncherTheme9Copy" Background="{StaticResource ColorBrushSemiTransparent}" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="10"
|
||||
Grid.Column="3" Grid.Row="2" Text="跳票红" x:Name="RadioLauncherTheme10" IsEnabled="False" ToolTip="进行一次正版登录,支持正版游戏!" ToolTipService.ShowOnDisabled="True" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="3" Grid.Row="2" Text="跳票红" x:Name="RadioLauncherTheme10" IsEnabled="False" ToolTip="进行一次正版登录,支持正版游戏!" ToolTipService.ShowOnDisabled="True" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="11"
|
||||
Grid.Column="4" Grid.Row="2" Text="极客蓝" x:Name="RadioLauncherTheme11" IsEnabled="False" ToolTipService.Placement="Bottom" ToolTip="右键打开解密游戏入口" />
|
||||
<TextBlock Grid.Column="4" Grid.Row="2" x:Name="LabLauncherTheme11Click" Background="{StaticResource ColorBrushSemiTransparent}" ToolTipService.Placement="Bottom" />
|
||||
Grid.Column="4" Grid.Row="2" Text="极客蓝" x:Name="RadioLauncherTheme11" IsEnabled="False" ToolTip="右键打开解密游戏入口" />
|
||||
<TextBlock Grid.Column="4" Grid.Row="2" x:Name="LabLauncherTheme11Click" Background="{StaticResource ColorBrushSemiTransparent}" />
|
||||
<local:MyRadioBox local:SettingService.Key="UiLauncherTheme" local:SettingService.Value="14"
|
||||
Grid.Column="5" Grid.Row="2" Text="自定义" x:Name="RadioLauncherTheme14" IsEnabled="False" ToolTipService.Placement="Bottom" ToolTip="需要解锁五个隐藏主题" ToolTipService.ShowOnDisabled="True" />
|
||||
Grid.Column="5" Grid.Row="2" Text="自定义" x:Name="RadioLauncherTheme14" IsEnabled="False" ToolTip="需要解锁五个隐藏主题" ToolTipService.ShowOnDisabled="True" />
|
||||
</Grid>
|
||||
<local:MyCheckBox local:SettingService.Key="UiLauncherLogo" Text="打开启动器时显示 PCL 图标" Margin="-1,0,0,1" Height="22" />
|
||||
</StackPanel>
|
||||
@@ -283,6 +283,7 @@
|
||||
<local:MyComboBoxItem local:SettingService.Value="14" Content="今日新闻热点(作者:EYicheng)" />
|
||||
<local:MyComboBoxItem local:SettingService.Value="15" Content="Minecraft 芝士站(作者:awaEric233)" />
|
||||
<local:MyComboBoxItem local:SettingService.Value="16" Content="整合包推荐引擎(作者:CHMYGZ)" />
|
||||
<local:MyComboBoxItem local:SettingService.Value="17" Content="Bangumi 番剧主页(作者:wzyaeu)" />
|
||||
</local:MyComboBox>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class PageSetupUI
|
||||
Public Class PageSetupUI
|
||||
|
||||
Private Sub PageSetupUI_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
|
||||
'重复加载部分
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
'背景图片
|
||||
Private Sub BtnUIBgOpen_Click(sender As Object, e As EventArgs) Handles BtnBackgroundOpen.Click
|
||||
OpenExplorer(PathExeFolder & "PCL\Pictures\")
|
||||
OpenExplorer(Paths.Base & "PCL\Pictures\")
|
||||
End Sub
|
||||
Private Sub BtnBackgroundRefresh_Click(sender As Object, e As EventArgs) Handles BtnBackgroundRefresh.Click
|
||||
BackgroundRefresh(True, True)
|
||||
@@ -97,7 +97,7 @@
|
||||
End Sub
|
||||
Private Sub BtnBackgroundClear_Click(sender As Object, e As EventArgs) Handles BtnBackgroundClear.Click
|
||||
If MyMsgBox("即将删除背景图片文件夹中的所有文件。" & vbCrLf & "此操作不可撤销,是否确定?", "警告",, "取消", IsWarn:=True) = 1 Then
|
||||
DirectoryUtils.Delete(PathExeFolder & "PCL\Pictures")
|
||||
DirectoryUtils.Delete(Paths.Base & "PCL\Pictures")
|
||||
BackgroundRefresh(False, True)
|
||||
Hint("背景图片已清空!", HintType.Green)
|
||||
End If
|
||||
@@ -111,9 +111,9 @@
|
||||
Try
|
||||
|
||||
'获取可用的图片文件
|
||||
DirectoryUtils.Create(PathExeFolder & "PCL\Pictures\")
|
||||
DirectoryUtils.Create(Paths.Base & "PCL\Pictures\")
|
||||
Dim Pic As New List(Of String)
|
||||
For Each File In DirectoryUtils.GetFiles(PathExeFolder & "PCL\Pictures\")
|
||||
For Each File In DirectoryUtils.EnumerateFiles(Paths.Base & "PCL\Pictures\", True)
|
||||
Dim Extension As String = PathUtils.GetExtension(File)
|
||||
If Extension <> "ini" AndAlso Extension <> "db" Then Pic.Add(File) '文件夹可能会被加入 .ini 和 thumbs.db
|
||||
Next
|
||||
@@ -157,7 +157,7 @@
|
||||
Private Sub BtnLogoChange_Click(sender As Object, e As EventArgs) Handles BtnLogoChange.Click
|
||||
Dim FileName As String = Dialogs.SelectFile("选择图片", False, filter:={({"png", "jpg", "jpeg", "gif", "webp"}, "常用图片文件")}).FirstOrDefault()
|
||||
If String.IsNullOrEmpty(FileName) Then Return
|
||||
Dim TargetPath As String = PathExeFolder & "PCL\Logo.png"
|
||||
Dim TargetPath As String = Paths.Base & "PCL\Logo.png"
|
||||
Try
|
||||
'复制文件
|
||||
FileUtils.Copy(FileName, TargetPath)
|
||||
@@ -177,7 +177,7 @@
|
||||
If Not (AniControlEnabled = 0 AndAlso e.RaiseByMouse) Then Return
|
||||
Refresh:
|
||||
'已有图片则不再选择
|
||||
Dim TargetPath As String = PathExeFolder & "PCL\Logo.png"
|
||||
Dim TargetPath As String = Paths.Base & "PCL\Logo.png"
|
||||
If FileUtils.Exists(TargetPath) Then
|
||||
Try
|
||||
FrmMain.ImageTitleLogo.Source = Nothing '防止因为 Source 属性前后的值相同而不更新 (#5628)
|
||||
@@ -214,7 +214,7 @@ Refresh:
|
||||
End Sub
|
||||
Private Sub BtnLogoDelete_Click(sender As Object, e As EventArgs) Handles BtnLogoDelete.Click
|
||||
Try
|
||||
FileUtils.Delete(PathExeFolder & "PCL\Logo.png")
|
||||
FileUtils.Delete(Paths.Base & "PCL\Logo.png")
|
||||
RadioLogoType1.SetChecked(True, True)
|
||||
Hint("标题栏图片已清空!", HintType.Green)
|
||||
Catch ex As Exception
|
||||
@@ -224,7 +224,7 @@ Refresh:
|
||||
|
||||
'背景音乐
|
||||
Private Sub BtnMusicOpen_Click(sender As Object, e As EventArgs) Handles BtnMusicOpen.Click
|
||||
OpenExplorer(PathExeFolder & "PCL\Musics\")
|
||||
OpenExplorer(Paths.Base & "PCL\Musics\")
|
||||
End Sub
|
||||
Private Sub BtnMusicRefresh_Click(sender As Object, e As EventArgs) Handles BtnMusicRefresh.Click
|
||||
MusicRefreshPlay(True)
|
||||
@@ -236,7 +236,7 @@ Refresh:
|
||||
PanMusicDetail.Visibility = Visibility.Visible
|
||||
BtnMusicClear.Visibility = Visibility.Visible
|
||||
CardMusic.Title = "背景音乐(" &
|
||||
DirectoryUtils.GetFiles(PathExeFolder & "PCL\Musics\").Count(Function(f) Not {"ini", "jpg", "txt", "cfg", "lrc", "db", "png"}.Contains(PathUtils.GetExtension(f))) &
|
||||
DirectoryUtils.EnumerateFiles(Paths.Base & "PCL\Musics\", True).Count(Function(f) Not {"ini", "jpg", "txt", "cfg", "lrc", "db", "png"}.Contains(PathUtils.GetExtension(f))) &
|
||||
" 首)"
|
||||
Else
|
||||
PanMusicVolume.Visibility = Visibility.Collapsed
|
||||
@@ -258,13 +258,13 @@ Refresh:
|
||||
Thread.Sleep(200)
|
||||
'删除文件
|
||||
Try
|
||||
DirectoryUtils.Delete(PathExeFolder & "PCL\Musics")
|
||||
DirectoryUtils.Delete(Paths.Base & "PCL\Musics")
|
||||
Hint("背景音乐已删除!", HintType.Green)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, "删除背景音乐失败", LogBehavior.Alert)
|
||||
End Try
|
||||
Try
|
||||
DirectoryUtils.Create(PathExeFolder & "PCL\Musics\")
|
||||
DirectoryUtils.Create(Paths.Base & "PCL\Musics\")
|
||||
RunInUi(Sub() MusicRefreshPlay(False))
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, "重建背景音乐文件夹失败", LogBehavior.Alert)
|
||||
@@ -284,12 +284,12 @@ Refresh:
|
||||
'主页
|
||||
Private Sub BtnCustomFile_Click(sender As Object, e As EventArgs) Handles BtnCustomFile.Click
|
||||
Try
|
||||
If FileUtils.Exists(PathExeFolder & "PCL\Custom.xaml") Then
|
||||
If FileUtils.Exists(Paths.Base & "PCL\Custom.xaml") Then
|
||||
If MyMsgBox("当前已存在布局文件,继续生成教学文件将会覆盖现有布局文件!", "覆盖确认", "继续", "取消", IsWarn:=True) = 2 Then Return
|
||||
End If
|
||||
ExtractResources(PathExeFolder & "PCL\Custom.xaml", "Custom")
|
||||
ExtractResources(Paths.Base & "PCL\Custom.xaml", "Custom")
|
||||
Hint("教学文件已生成!", HintType.Green)
|
||||
OpenExplorer(PathExeFolder & "PCL\Custom.xaml")
|
||||
OpenExplorer(Paths.Base & "PCL\Custom.xaml")
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex, "生成教学文件失败")
|
||||
End Try
|
||||
@@ -588,7 +588,7 @@ Refresh:
|
||||
SliderLauncherHue.GetHintText = Function(v) v & "°"
|
||||
SliderLauncherSat.GetHintText = Function(v) v & "%"
|
||||
SliderLauncherDelta.GetHintText =
|
||||
Function(Value As Integer)
|
||||
Function(Value As Integer) As String
|
||||
If Value > 90 Then
|
||||
Return "+" & (Value - 90)
|
||||
ElseIf Value = 90 Then
|
||||
@@ -598,7 +598,7 @@ Refresh:
|
||||
End If
|
||||
End Function
|
||||
SliderLauncherLight.GetHintText =
|
||||
Function(Value As Integer)
|
||||
Function(Value As Integer) As String
|
||||
If Value > 20 Then
|
||||
Return "+" & (Value - 20)
|
||||
ElseIf Value = 20 Then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Public Class SettingService
|
||||
Public Class SettingService
|
||||
|
||||
#Region "属性"
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
Public Class Settings
|
||||
'TODO: 目前仅有此处在使用 DES 加密,后续考虑更换加密算法
|
||||
Imports System.Security.Cryptography
|
||||
|
||||
Public Class Settings
|
||||
|
||||
Public Shared ReadOnly Entries As Dictionary(Of String, Setting) = (New List(Of Setting) From {
|
||||
New Setting("Identify", "", Source:=Sources.Registry),
|
||||
New Setting("WindowHeight", 550),
|
||||
New Setting("WindowWidth", 900),
|
||||
New Setting("AprilDoneYear", 0, Source:=Sources.Registry),
|
||||
New Setting("AprilYear", 0, Source:=Sources.Registry, Encrypted:=True),
|
||||
New Setting("Potatoes", "", Source:=Sources.Registry, Encrypted:=True),
|
||||
New Setting("HintDownloadThread", False, Source:=Sources.Registry),
|
||||
New Setting("HintNotice", 0, Source:=Sources.Registry),
|
||||
@@ -171,7 +173,6 @@
|
||||
New Setting("VersionAdvanceGame", "", Source:=Sources.Instance),
|
||||
New Setting("VersionAdvanceAssets", 0, Source:=Sources.Instance),
|
||||
New Setting("VersionAdvanceAssetsV2", False, Source:=Sources.Instance),
|
||||
New Setting("VersionAdvanceJava", False, Source:=Sources.Instance),
|
||||
New Setting("VersionAdvanceRun", "", Source:=Sources.Instance),
|
||||
New Setting("VersionAdvanceRunWait", True, Source:=Sources.Instance),
|
||||
New Setting("VersionAdvanceDisableJLW", False, Source:=Sources.Instance),
|
||||
@@ -186,6 +187,8 @@
|
||||
New Setting("VersionArgumentIndie", -1, Source:=Sources.Instance),
|
||||
New Setting("VersionArgumentIndieV2", False, Source:=Sources.Instance),
|
||||
New Setting("VersionArgumentJavaSelect", "使用全局设置", Source:=Sources.Instance),
|
||||
New Setting("VersionArgumentJavaV2", 0, Source:=Sources.Instance),
|
||||
New Setting("VersionArgumentJavaRange", "", Source:=Sources.Instance),
|
||||
New Setting("VersionServerEnter", "", Source:=Sources.Instance),
|
||||
New Setting("VersionServerLogin", 0, Source:=Sources.Instance, OnChanged:=AddressOf PageInstanceSetup.OnVersionServerLoginChanged),
|
||||
New Setting("VersionServerNide", "", Source:=Sources.Instance),
|
||||
@@ -245,11 +248,11 @@
|
||||
''' </summary>
|
||||
Public Sub Save(Optional Instance As McInstance = Nothing)
|
||||
Dim Value As String = GetCache(Instance)
|
||||
Logger.Trace($"保存设置:{Key} = {Value}{If(Instance Is Nothing, "", $"(实例:{Instance?.PathVersion})")}")
|
||||
Logger.Trace($"保存设置:{Key} {If(Encrypted, "", "= " & Value)}{If(Instance Is Nothing, "", $"(实例:{Instance?.PathVersion})")}")
|
||||
If Encrypted Then
|
||||
Try
|
||||
If Value Is Nothing Then Value = ""
|
||||
Value = CryptographyUtils.DesEncrypt(Value, "PCL" & Identify)
|
||||
Value = DesEncrypt(Value, "PCL" & Identify)
|
||||
Catch ex As Exception
|
||||
Logger.Warn(ex, $"加密设置失败:{Key}")
|
||||
End Try
|
||||
@@ -319,7 +322,7 @@
|
||||
'正常读取
|
||||
Try
|
||||
Dim GotValue As String = Nothing '先用 String 储存,避免类型转换
|
||||
Dim DefaultValue As String = If(Entry.Encrypted, CryptographyUtils.DesEncrypt(Entry.DefaultValue, "PCL" & Identify), Entry.DefaultValue)
|
||||
Dim DefaultValue As String = If(Entry.Encrypted, DesEncrypt(Entry.DefaultValue, "PCL" & Identify), Entry.DefaultValue)
|
||||
Select Case Entry.Source
|
||||
Case Sources.Normal
|
||||
GotValue = ReadIni("Setup", Key, DefaultValue)
|
||||
@@ -337,7 +340,7 @@
|
||||
GotValue = Entry.DefaultValue
|
||||
Else
|
||||
Try
|
||||
GotValue = CryptographyUtils.DesDecrypt(GotValue, "PCL" & Identify)
|
||||
GotValue = DesDecrypt(GotValue, "PCL" & Identify)
|
||||
Catch ex As Exception
|
||||
Logger.Warn(ex, $"解密设置失败:{Key}")
|
||||
GotValue = Entry.DefaultValue
|
||||
@@ -418,4 +421,46 @@
|
||||
End Select
|
||||
End Function
|
||||
|
||||
#Region "DES 加密"
|
||||
|
||||
Private Shared ReadOnly desInitialVector As Byte() = Encoding.UTF8.GetBytes("95168702")
|
||||
|
||||
''' <summary>
|
||||
''' 使用 DES 对称加密算法加密字符串。
|
||||
''' </summary>
|
||||
Private Shared Function DesEncrypt(sourceString As String, Optional key As String = Nothing) As String
|
||||
key = If(key Is Nothing, "@;$ Abv2", key.GetStableHashCode().ToString().EnsureLength("X"c, 8).Substring(0, 8))
|
||||
Dim btKey As Byte() = Encoding.UTF8.GetBytes(key)
|
||||
Using des As New DESCryptoServiceProvider()
|
||||
Using ms As New MemoryStream()
|
||||
Using cs As New CryptoStream(ms, des.CreateEncryptor(btKey, desInitialVector), CryptoStreamMode.Write)
|
||||
Dim inData As Byte() = Encoding.UTF8.GetBytes(sourceString)
|
||||
cs.Write(inData, 0, inData.Length)
|
||||
cs.FlushFinalBlock()
|
||||
Return Convert.ToBase64String(ms.ToArray())
|
||||
End Using
|
||||
End Using
|
||||
End Using
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 使用 DES 对称加密算法解密字符串。
|
||||
''' </summary>
|
||||
Private Shared Function DesDecrypt(encryptedString As String, Optional key As String = Nothing) As String
|
||||
key = If(key Is Nothing, "@;$ Abv2", key.GetStableHashCode().ToString().EnsureLength("X"c, 8).Substring(0, 8))
|
||||
Dim btKey As Byte() = Encoding.UTF8.GetBytes(key)
|
||||
Using des As New DESCryptoServiceProvider()
|
||||
Using ms As New MemoryStream()
|
||||
Using cs As New CryptoStream(ms, des.CreateDecryptor(btKey, desInitialVector), CryptoStreamMode.Write)
|
||||
Dim inData As Byte() = Convert.FromBase64String(encryptedString)
|
||||
cs.Write(inData, 0, inData.Length)
|
||||
cs.FlushFinalBlock()
|
||||
Return Encoding.UTF8.GetString(ms.ToArray())
|
||||
End Using
|
||||
End Using
|
||||
End Using
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user