From 6482eb6fc8aab1d396bc52bff9cdb77a2cb721a7 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Thu, 4 Jul 2024 15:47:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=BB=E5=8F=96=E5=AD=98?= =?UTF-8?q?=E6=A1=A3=E5=8F=AF=E8=83=BD=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Windows/MainWindow.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index 455c357..4dd83f3 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -1271,12 +1271,12 @@ namespace VPet_Simulator.Windows { Set = new Setting(this, File.ReadAllText(ExtensionValue.BaseDirectory + @$"\Setting{PrefixSave}.lps")); } - if (PrefixSave == "" && !Set["SingleTips"].GetBool("helloworld") && File.Exists(ExtensionValue.BaseDirectory + @"\Setting.bkp")) + if (PrefixSave == "" && (Set == null || (Set != null && !Set["SingleTips"].GetBool("helloworld"))) && File.Exists(ExtensionValue.BaseDirectory + @"\Setting.bkp")) {//如果设置是损坏的, 读取备份设置 Set = new Setting(this, File.ReadAllText(ExtensionValue.BaseDirectory + @"\Setting.bkp")); } - else - Set = new Setting(this, "Setting#VPET:|\n"); + + Set ??= new Setting(this, "Setting#VPET:|\n"); var visualTree = new FrameworkElementFactory(typeof(Border)); visualTree.SetValue(Border.BackgroundProperty, new TemplateBindingExtension(BackgroundProperty));