添加设置默认存档的功能 fix#357

This commit is contained in:
ZouJin 2024-04-17 14:51:44 +08:00
parent 8be34c391b
commit cf358025db
7 changed files with 45 additions and 5 deletions

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Interop;
using VPet_Simulator.Windows.Interface;
namespace VPet_Simulator.Windows
@ -43,6 +44,18 @@ namespace VPet_Simulator.Windows
{
MutiSaves.Add("");
}
if (!Args.Any(x => x.Contains("prefix")))
{
var file = new DirectoryInfo(ExtensionValue.BaseDirectory).GetFiles("startup_*").FirstOrDefault();
if (file != null)
{
var su = file.Name.Substring(8);
var al = Args.ToList();
al.Add($"prefix#{su}:|");
Args = al.ToArray();
}
}
}
HashSet<string> ErrorReport = new HashSet<string>();
private void UnhandledException(Exception e, bool isFatality)

View File

@ -18,7 +18,7 @@ public partial class MainWindow
/// <summary>
/// 版本号
/// </summary>
public int version { get; } = 11006;
public int version { get; } = 11010;
/// <summary>
/// 版本号
/// </summary>

View File

@ -432,13 +432,17 @@
Background="{DynamicResource SecondaryLight}" Content="{ll:Str 打开}"
ToolTip="{ll:Str 打开当前选择的多开存档}" VerticalAlignment="Top" Height="25"
Click="btn_muti_open_click" />
<Button Grid.Row="1" Grid.Column="3" Margin="5" Padding="1" pu:ButtonHelper.CornerRadius="4"
Background="{DynamicResource SecondaryLight}" Content="{ll:Str 默认}"
ToolTip="{ll:Str 设置当前多开存档为默认启动项}" VerticalAlignment="Center" Height="25"
Click="btn_muti_master_click" />
<Button x:Name="btn_mutidel" Grid.Row="1" Grid.Column="3" Margin="5" Padding="1"
pu:ButtonHelper.CornerRadius="4" Background="{DynamicResource SecondaryLight}"
Content="{ll:Str 删除}" ToolTip="{ll:Str 删除当前选择的多开存档}" VerticalAlignment="Bottom"
Height="25" Click="btn_mutidel_Click" />
<ListBox x:Name="LBHave" Grid.Row="1" Grid.Column="2" Margin="1,2,1,2"
pu:ListBoxHelper.CornerRadius="4" BorderBrush="{DynamicResource DARKPrimary}"
BorderThickness="2" MinHeight="66"
BorderThickness="2" MinHeight="88"
pu:ListBoxHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}"
pu:ListBoxHelper.ItemsHoverBackground="{DynamicResource Primary}"
pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource DARKPrimary}" />

View File

@ -1541,6 +1541,20 @@ namespace VPet_Simulator.Windows
}
}
private void btn_muti_master_click(object sender, RoutedEventArgs e)
{
if (LBHave.SelectedIndex == -1)
return;
var str = App.MutiSaves[LBHave.SelectedIndex];
foreach (var sp in new DirectoryInfo(ExtensionValue.BaseDirectory).GetFiles("startup_*"))
{
sp.Delete();
}
if (str != "")
File.Create(ExtensionValue.BaseDirectory + @"\startup_" + str).Close();
MessageBoxX.Show("已将当前选择 {0} 设为默认启动存档".Translate(str.Translate()));
}
private void SwitchHideFromTaskControl_OnChecked(object sender, RoutedEventArgs e)
{
if (!AllowChange)

View File

@ -80,4 +80,7 @@ OPPOSans R#OPPOSans R:|
{0}生病了,已自动退出访客表#{0} is sick and has automatically exited the Guest List:|
{0}生病了,无法创建或者加入访客表#{0} is sick and cannot create or join a Guest List:|
{0}花费${3}给{4}的{1}买了{2}#{0} bought {2} for {4}'s {1} at a cost of ${3}.:|
{0}给{3}的{1}买了{2}#{0} bought {2} for {3}'s {1}.:|
{0}给{3}的{1}买了{2}#{0} bought {2} for {3}'s {1}.:|
已将当前选择 {0} 设为默认启动存档#The current selection {0} has been set as the default startup archive:|
默认#Default:|
设置当前多开存档为默认启动项#Set the current multi-save archive as the default startup item:|

View File

@ -80,4 +80,7 @@ OPPOSans R#OPPOSans R:|
{0}生病了,已自动退出访客表#{0}生病了,已自动退出访客表:|
{0}生病了,无法创建或者加入访客表#{0}生病了,无法创建或者加入访客表:|
{0}花费${3}给{4}的{1}买了{2}#{0}花费${3}给{4}的{1}买了{2}:|
{0}给{3}的{1}买了{2}#{0}给{3}的{1}买了{2}:|
{0}给{3}的{1}买了{2}#{0}给{3}的{1}买了{2}:|
已将当前选择 {0} 设为默认启动存档#已将当前选择 {0} 设为默认启动存档:|
默认#默认:|
设置当前多开存档为默认启动项#设置当前多开存档为默认启动项:|

View File

@ -80,4 +80,7 @@ OPPOSans R#OPPOSans R:|
{0}生病了,已自动退出访客表#{0}生病了,已自動退出訪客表:|
{0}生病了,无法创建或者加入访客表#{0}生病了,無法建立或加入訪客表:|
{0}花费${3}给{4}的{1}买了{2}#{0}花費${3}給{4}的{1}買了{2}:|
{0}给{3}的{1}买了{2}#{0}給{3}的{1}買了{2}:|
{0}给{3}的{1}买了{2}#{0}給{3}的{1}買了{2}:|
已将当前选择 {0} 设为默认启动存档#已將目前選擇 {0} 設為預設啟動存檔:|
默认#預設:|
设置当前多开存档为默认启动项#設定目前多開存檔為預設啟動項:|