diff --git a/VPet-Simulator.Windows.Interface/GameSave_v2.cs b/VPet-Simulator.Windows.Interface/GameSave_v2.cs
index 2f06da2..8ab984f 100644
--- a/VPet-Simulator.Windows.Interface/GameSave_v2.cs
+++ b/VPet-Simulator.Windows.Interface/GameSave_v2.cs
@@ -1,13 +1,17 @@
using LinePutScript;
using LinePutScript.Dictionary;
+using LinePutScript.Localization.WPF;
+using Panuon.WPF.UI;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Security.Cryptography;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using VPet_Simulator.Core;
+using static System.Net.Mime.MediaTypeNames;
namespace VPet_Simulator.Windows.Interface
{
@@ -55,9 +59,28 @@ namespace VPet_Simulator.Windows.Interface
if (nohashcheck)
{
hash = lps.GetInt64("hash");
+ int ver = lps["hash"].GetInt("ver");
if (lps.Remove("hash"))
{
- HashCheck = Sub.GetHashCode(lps.ToString()) == hash;
+ if (ver == 2)
+ HashCheck = Sub.GetHashCode(lps.ToString()) == hash;
+ else
+ {
+ try
+ {
+ using (MD5 md5 = MD5.Create())
+ {
+ HashCheck = BitConverter.ToInt64(md5.ComputeHash(Encoding.UTF8.GetBytes(lps.ToString())), 0) == hash;
+ }
+ if (!HashCheck)
+ HashCheck = Sub.GetHashCode(lps.ToString()) == hash;
+ }
+ catch (Exception e)
+ {
+ HashCheck = false;
+ MessageBoxX.Show(e.ToString(), "当前存档Hash验证信息".Translate() + ":" + "失败".Translate());
+ }
+ }
}
}
@@ -109,16 +132,23 @@ namespace VPet_Simulator.Windows.Interface
if (HashCheck)
{
lps[(gi64)"hash"] = Sub.GetHashCode(lps.ToString());
+ lps["hash"][(gint)"ver"] = 2;
}
else
+ {
lps[(gint)"hash"] = -1;
+ lps["hash"][(gint)"ver"] = 2;
+ }
return lps;
}
+
///
/// Hash检查
///
public bool HashCheck { get; private set; } = true;
+ FInt64 IGetOBJ.this[gflt subName] { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+
///
@@ -132,7 +162,7 @@ namespace VPet_Simulator.Windows.Interface
#region GETOBJ
public DateTime this[gdat subName] { get => Data[subName]; set => Data[subName] = value; }
- public double this[gflt subName] { get => Data[subName]; set => Data[subName] = value; }
+ public FInt64 this[gflt subName] { get => Data[subName]; set => Data[subName] = value; }
public double this[gdbe subName] { get => Data[subName]; set => Data[subName] = value; }
public long this[gi64 subName] { get => Data[subName]; set => Data[subName] = value; }
public int this[gint subName] { get => Data[subName]; set => Data[subName] = value; }
@@ -170,12 +200,12 @@ namespace VPet_Simulator.Windows.Interface
Data.SetInt64(subName, value);
}
- public double GetFloat(string subName, double defaultvalue = 0)
+ public FInt64 GetFloat(string subName, FInt64 defaultvalue = default)
{
return Data.GetFloat(subName, defaultvalue);
}
- public void SetFloat(string subName, double value)
+ public void SetFloat(string subName, FInt64 value)
{
Data.SetFloat(subName, value);
}
diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs
index 524b179..72b97af 100644
--- a/VPet-Simulator.Windows/MainWindow.cs
+++ b/VPet-Simulator.Windows/MainWindow.cs
@@ -637,7 +637,7 @@ namespace VPet_Simulator.Windows
{
var stat = GameSavesData.Statistics;
var save = Core.Save;
- stat["stat_money"] = save.Money;
+ stat["stat_money"] = (SetObject)save.Money;
stat["stat_level"] = save.Level;
stat["stat_likability"] = save.Likability;
@@ -1425,12 +1425,16 @@ namespace VPet_Simulator.Windows
await Dispatcher.InvokeAsync(new Action(() => LoadingText.Content = "尝试加载游戏动画".Translate()));
await Dispatcher.InvokeAsync(new Action(() =>
{
- LoadingText.Content = "尝试加载动画和生成缓存".Translate();
+ LoadingText.Content = "尝试加载动画和生成缓存\n该步骤可能会耗时比较长\n请耐心等待".Translate();
Core.Graph = petloader.Graph(Set.Resolution);
Main = new Main(Core);
Main.NoFunctionMOD = Set.CalFunState;
+
+ LoadingText.Content = "正在加载游戏".Translate();
+
+
//加载数据合理化:工作
if (!Set["gameconfig"].GetBool("noAutoCal"))
{
@@ -1459,7 +1463,6 @@ namespace VPet_Simulator.Windows
}
- LoadingText.Content = "正在加载游戏".Translate();
var m = new System.Windows.Controls.MenuItem()
{
Header = "MOD管理".Translate(),