mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
更新备份目录
This commit is contained in:
parent
d6e2ae050b
commit
a283216ab4
@ -1,4 +1,5 @@
|
||||
using System.Windows;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System.Windows;
|
||||
|
||||
namespace VPet_Simulator.Windows
|
||||
{
|
||||
@ -18,7 +19,10 @@ namespace VPet_Simulator.Windows
|
||||
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
string errstr = "游戏发生错误,可能是" + (string.IsNullOrWhiteSpace(CoreMOD.NowLoading) ? "游戏或者MOD" : $"MOD({CoreMOD.NowLoading})") + "导致的\n如有可能请发送 错误信息截图和引发错误之前的操作 给开发者:service@exlb.net\n感谢您对游戏开发的支持\n" + e.Exception.ToString();
|
||||
string errstr = "游戏发生错误,可能是".Translate() + (string.IsNullOrWhiteSpace(CoreMOD.NowLoading) ?
|
||||
"游戏或者MOD".Translate() : $"MOD({CoreMOD.NowLoading})") +
|
||||
"导致的\n如有可能请发送 错误信息截图和引发错误之前的操作 给开发者:service@exlb.net\n感谢您对游戏开发的支持\n".Translate()
|
||||
+ e.Exception.ToString();
|
||||
if (MainWindow == null)
|
||||
{
|
||||
MessageBox.Show(errstr, "游戏致命性错误");
|
||||
|
@ -231,9 +231,11 @@ namespace VPet_Simulator.Windows
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception Exception)
|
||||
{
|
||||
SuccessLoad = false;
|
||||
string errstr = "MOD加载错误,是MOD({0})导致的\n如有可能请发送 错误信息截图和引发错误之前的操作 给开发者:service@exlb.net\n感谢您对游戏开发的支持\n".Translate() + Exception.ToString();
|
||||
new winReport(mw, errstr).Show();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -91,22 +91,22 @@ namespace VPet_Simulator.Windows
|
||||
}
|
||||
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Setting.lps", Set.ToString());
|
||||
|
||||
if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\UserData"))
|
||||
Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + @"\UserData");
|
||||
if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\BackUP"))
|
||||
Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + @"\BackUP");
|
||||
|
||||
if (Core != null && Core.Save != null)
|
||||
{
|
||||
var ds = new List<string>(Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory + @"\UserData"));
|
||||
var ds = new List<string>(Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory + @"\BackUP"));
|
||||
while (ds.Count > Set.BackupSaveMaxNum)
|
||||
{
|
||||
File.Delete(ds[0]);
|
||||
ds.RemoveAt(0);
|
||||
}
|
||||
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + $"\\UserData\\Save_{st}.lps"))
|
||||
File.Delete(AppDomain.CurrentDomain.BaseDirectory + $"\\UserData\\Save_{st}.lps");
|
||||
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + $"\\BackUP\\Save_{st}.lps"))
|
||||
File.Delete(AppDomain.CurrentDomain.BaseDirectory + $"\\BackUP\\Save_{st}.lps");
|
||||
|
||||
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps"))
|
||||
File.Move(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps", AppDomain.CurrentDomain.BaseDirectory + $"\\UserData\\Save_{st}.lps");
|
||||
File.Move(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps", AppDomain.CurrentDomain.BaseDirectory + $"\\BackUP\\Save_{st}.lps");
|
||||
var l = Core.Save.ToLine();
|
||||
if (HashCheck)
|
||||
{
|
||||
|
@ -159,9 +159,9 @@ namespace VPet_Simulator.Windows
|
||||
|
||||
public void LoadLatestSave(string petname)
|
||||
{
|
||||
if (Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\UserData"))
|
||||
if (Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\BackUP"))
|
||||
{
|
||||
var latestsave = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"\UserData")
|
||||
var latestsave = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"\BackUP")
|
||||
.GetFiles("*.lps").OrderByDescending(x => x.LastWriteTime).FirstOrDefault();
|
||||
if (latestsave != null)
|
||||
{
|
||||
@ -229,12 +229,33 @@ namespace VPet_Simulator.Windows
|
||||
else
|
||||
LocalizeCore.LoadCulture(Set.Language);
|
||||
|
||||
//旧版本设置兼容
|
||||
var cgpteb = Set["CGPT"].Find("enable");
|
||||
if (cgpteb != null)
|
||||
{
|
||||
if (Set["CGPT"][(gbol)"enable"])
|
||||
{
|
||||
Set["CGPT"][(gstr)"type"] = "API";
|
||||
}
|
||||
else
|
||||
{
|
||||
Set["CGPT"][(gstr)"type"] = "LB";
|
||||
}
|
||||
Set["CGPT"].Remove(cgpteb);
|
||||
}
|
||||
if (Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\UserData") && !Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\BackUP"))
|
||||
{
|
||||
Directory.Move(AppDomain.CurrentDomain.BaseDirectory + @"\UserData", AppDomain.CurrentDomain.BaseDirectory + @"\BackUP");
|
||||
}
|
||||
|
||||
|
||||
Dispatcher.BeginInvoke(new Action(() => LoadingText.Content = "尝试加载游戏MOD".Translate()));
|
||||
|
||||
//当前桌宠动画
|
||||
var petloader = Pets.Find(x => x.Name == Set.PetGraph);
|
||||
petloader ??= Pets[0];
|
||||
|
||||
//加载游戏内容
|
||||
//加载存档
|
||||
Core.Controller = new MWController(this);
|
||||
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps") &&
|
||||
!GameLoad(new LpsDocument(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps")).First()))
|
||||
@ -274,20 +295,6 @@ namespace VPet_Simulator.Windows
|
||||
rndtext.Add("关注 {0} 谢谢喵".Translate(Environment.UserName));
|
||||
}
|
||||
|
||||
//旧版本设置兼容
|
||||
var cgpteb = Set["CGPT"].Find("enable");
|
||||
if (cgpteb != null)
|
||||
{
|
||||
if (Set["CGPT"][(gbol)"enable"])
|
||||
{
|
||||
Set["CGPT"][(gstr)"type"] = "API";
|
||||
}
|
||||
else
|
||||
{
|
||||
Set["CGPT"][(gstr)"type"] = "LB";
|
||||
}
|
||||
Set["CGPT"].Remove(cgpteb);
|
||||
}
|
||||
//音乐识别timer加载
|
||||
MusicTimer = new System.Timers.Timer(100)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;X64,DEMO</DefineConstants>
|
||||
<DefineConstants>TRACE;X64;DEMO</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
@ -96,7 +96,7 @@
|
||||
</Reference>
|
||||
<Reference Include="CSCore, Version=1.2.1.2, Culture=neutral, PublicKeyToken=5a08f2b6f4415dea, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CSCore.1.2.1.2\lib\net35-client\CSCore.dll</HintPath>
|
||||
</Reference>
|
||||
</Reference>
|
||||
<Reference Include="LinePutScript, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\LinePutScript.1.9.2\lib\net462\LinePutScript.dll</HintPath>
|
||||
</Reference>
|
||||
@ -312,7 +312,9 @@
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="steam_api64.dll" />
|
||||
<None Include="steam_api64.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -972,9 +972,9 @@ namespace VPet_Simulator.Windows
|
||||
reloadid = mw.Set.Statistics[(gint)"savetimes"];
|
||||
CBSaveReLoad.SelectedItem = null;
|
||||
CBSaveReLoad.Items.Clear();
|
||||
if (Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\UserData"))
|
||||
if (Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\BackUP"))
|
||||
{
|
||||
foreach (var file in new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"\UserData")
|
||||
foreach (var file in new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"\BackUP")
|
||||
.GetFiles().OrderByDescending(x => x.LastWriteTime))
|
||||
{
|
||||
if (file.Extension.ToLower() == ".lps")
|
||||
@ -992,7 +992,7 @@ namespace VPet_Simulator.Windows
|
||||
if (CBSaveReLoad.SelectedItem != null)
|
||||
{
|
||||
string txt = (string)CBSaveReLoad.SelectedItem;
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + @"\UserData\" + txt + ".lps";
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + @"\BackUP\" + txt + ".lps";
|
||||
if (File.Exists(path))
|
||||
{
|
||||
var l = new Line(File.ReadAllText(path));
|
||||
|
Loading…
Reference in New Issue
Block a user