From 5549edf8b100976b73916d3a6974a23ff9e73fa9 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Sun, 10 Sep 2023 21:52:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=87=E4=BB=BD=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E9=A1=BA=E5=BA=8F=E9=97=AE=E9=A2=98=20Fix=20#192?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Windows/Function/CoreMOD.cs | 11 ++++++++++- VPet-Simulator.Windows/MainWindow.cs | 8 +++++++- VPet-Simulator.Windows/MainWindow.xaml.cs | 11 ++++++++--- VPet-Simulator.Windows/mod/0001_ModMaker | 1 + 4 files changed, 26 insertions(+), 5 deletions(-) create mode 120000 VPet-Simulator.Windows/mod/0001_ModMaker diff --git a/VPet-Simulator.Windows/Function/CoreMOD.cs b/VPet-Simulator.Windows/Function/CoreMOD.cs index 70ec9cc..c9dadb3 100644 --- a/VPet-Simulator.Windows/Function/CoreMOD.cs +++ b/VPet-Simulator.Windows/Function/CoreMOD.cs @@ -121,9 +121,18 @@ namespace VPet_Simulator.Windows var name = lps.First().Info; var p = mw.Pets.FirstOrDefault(x => x.Name == name); if (p == null) - mw.Pets.Add(new PetLoader(lps, di)); + { + p = new PetLoader(lps, di); + if (p.Config.Works.Count > 0) + Tag.Add("work"); + mw.Pets.Add(p); + } else { + if (lps.FindAllLine("work").Length >= 0) + { + + } p.path.Add(di.FullName + "\\" + lps.First()["path"].Info); p.Config.Set(lps); } diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index 21587d3..0ed7f6f 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Linq; using System.Net; using System.Text; using System.Threading; @@ -180,7 +181,12 @@ namespace VPet_Simulator.Windows if (Core != null && Core.Save != null) { - var ds = new List(Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory + @"\BackUP")); + var ds = new List(Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory + @"\BackUP", "*.lps")).FindAll(x => x.Contains('_')).OrderBy(x => + { + if (int.TryParse(x.Split('_')[1], out int i)) + return i; + return 0; + }).ToList(); while (ds.Count > Set.BackupSaveMaxNum) { File.Delete(ds[0]); diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 17c76eb..ff93215 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -235,13 +235,18 @@ namespace VPet_Simulator.Windows { if (Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\BackUP")) { - var latestsave = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"\BackUP") - .GetFiles("*.lps").OrderByDescending(x => x.LastWriteTime).FirstOrDefault(); + var ds = new List(Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory + @"\BackUP", "*.lps")).FindAll(x => x.Contains('_')).OrderBy(x => + { + if (int.TryParse(x.Split('_')[1], out int i)) + return i; + return 0; + }).ToList(); + var latestsave = ds.LastOrDefault(); if (latestsave != null) { try { - if (GameLoad(new Line(File.ReadAllText(latestsave.FullName)))) + if (GameLoad(new Line(File.ReadAllText(latestsave)))) return; MessageBoxX.Show("存档损毁,无法加载该存档\n可能是上次储存出错或Steam云同步导致的\n请在设置中加载备份还原存档", "存档损毁".Translate()); } diff --git a/VPet-Simulator.Windows/mod/0001_ModMaker b/VPet-Simulator.Windows/mod/0001_ModMaker new file mode 120000 index 0000000..f705ec3 --- /dev/null +++ b/VPet-Simulator.Windows/mod/0001_ModMaker @@ -0,0 +1 @@ +D:/Documents/Visual Studio 2022/Projects/VPet.ModMaker/0001_ModMaker \ No newline at end of file