mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
修复老版本vpet(v1.4-)hashcheck失效的错误
This commit is contained in:
parent
8673d05775
commit
22745eb116
@ -10,7 +10,9 @@ using System.Security.Cryptography;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using VPet_Simulator.Core;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace VPet_Simulator.Windows.Interface
|
||||
{
|
||||
@ -31,7 +33,7 @@ namespace VPet_Simulator.Windows.Interface
|
||||
{
|
||||
if (lps.FindLine("statistics") == null)
|
||||
{//尝试从老存档加载
|
||||
Statistics = oldStatistics;
|
||||
Statistics = oldStatistics ?? new Statistics();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -46,8 +48,26 @@ namespace VPet_Simulator.Windows.Interface
|
||||
hash = vpet.GetInt64("hash");
|
||||
if (vpet.Remove("hash"))
|
||||
{
|
||||
HashCheck = vpet.GetLongHashCode() == hash;
|
||||
nohashcheck = false;
|
||||
try
|
||||
{
|
||||
using (MD5 md5 = MD5.Create())
|
||||
{
|
||||
long hs = BitConverter.ToInt64(md5.ComputeHash(Encoding.UTF8.GetBytes(vpet.Name)), 0)
|
||||
* 2 + BitConverter.ToInt64(md5.ComputeHash(Encoding.UTF8.GetBytes(vpet.info)), 0)
|
||||
* 3 + BitConverter.ToInt64(md5.ComputeHash(Encoding.UTF8.GetBytes(vpet.text)), 0) * 4;
|
||||
foreach (ISub su in vpet.ToList())
|
||||
{
|
||||
hs += BitConverter.ToInt64(md5.ComputeHash(Encoding.UTF8.GetBytes(su.Name)), 0) * 2
|
||||
+ BitConverter.ToInt64(md5.ComputeHash(Encoding.UTF8.GetBytes(su.Info)), 0) * 3;
|
||||
}
|
||||
HashCheck = hs == hash;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
nohashcheck = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (oldGameSave != null)
|
||||
|
@ -145,7 +145,7 @@ namespace VPet_Simulator.Windows.Interface
|
||||
/// </summary>
|
||||
public int BackupSaveMaxNum
|
||||
{
|
||||
get => Math.Max(GetInt("bakupsave", 30), 1);
|
||||
get => Math.Max(GetInt("bakupsave", 50), 1);
|
||||
set => SetInt("bakupsave", value);
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -125,10 +125,6 @@
|
||||
<Resource Include="Res\remixicon.ttf" />
|
||||
<Resource Include="vpeticon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\VPet-Simulator.Core\VPet-Simulator.Core.csproj" />
|
||||
<ProjectReference Include="..\VPet-Simulator.Windows.Interface\VPet-Simulator.Windows.Interface.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Settings.Designer.cs">
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
@ -242,4 +238,8 @@
|
||||
<PackageReference Include="Panuon.WPF" Version="1.0.3" />
|
||||
<PackageReference Include="Panuon.WPF.UI" Version="1.1.16.8" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\VPet-Simulator.Core\VPet-Simulator.Core.csproj" />
|
||||
<ProjectReference Include="..\VPet-Simulator.Windows.Interface\VPet-Simulator.Windows.Interface.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user