新增备份设置 & 旧版本多开bug修复

This commit is contained in:
ZouJin 2024-04-17 16:38:52 +08:00
parent 802af257d6
commit 0c29f37101
2 changed files with 12 additions and 0 deletions

View File

@ -34,6 +34,10 @@ namespace VPet_Simulator.Windows
{
Args = e.Args;
//旧版本多开bug修复
if (File.Exists(ExtensionValue.BaseDirectory + @"\Setting-.lps"))
File.Delete(ExtensionValue.BaseDirectory + @"\Setting-.lps");
foreach (var mss in new DirectoryInfo(ExtensionValue.BaseDirectory).GetFiles("Setting*.lps"))
{
var n = mss.Name.Substring(7).Trim('-');

View File

@ -235,6 +235,10 @@ namespace VPet_Simulator.Windows
//timecount = DateTime.Now;
}
Set.StartRecordLastPoint = new Point(Dispatcher.Invoke(() => Left), Dispatcher.Invoke(() => Top));
if (PrefixSave == "")
{//对于主设置的备份
File.Move(ExtensionValue.BaseDirectory + @"\Setting.lps", ExtensionValue.BaseDirectory + @"\Setting.bkp");
}
File.WriteAllText(ExtensionValue.BaseDirectory + @$"\Setting{PrefixSave}.lps", Set.ToString());
if (!Directory.Exists(ExtensionValue.BaseDirectory + @"\Saves"))
@ -1259,6 +1263,10 @@ namespace VPet_Simulator.Windows
{
Set = new Setting(this, File.ReadAllText(ExtensionValue.BaseDirectory + @$"\Setting{PrefixSave}.lps"));
}
else if (PrefixSave == "" && File.Exists(ExtensionValue.BaseDirectory + @"\Setting.lps"))
{
Set = new Setting(this, File.ReadAllText(ExtensionValue.BaseDirectory + @"\Setting.lps"));
}
else
Set = new Setting(this, "Setting#VPET:|\n");