From 6e4908b21e04ba979e3cb15af3898d57797d9bdc Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 13 Feb 2021 01:38:09 -0800 Subject: [PATCH] Simplify a little path.getfilename will never return null unless you pass null, which we don't do setchecksums' base method does the AllBlocks.SetChecksums. move the battle team set to right before the usage of SetChecksums --- PKHeX.Core/Saves/SAV7.cs | 7 +------ PKHeX.Core/Saves/SaveFileMetadata.cs | 4 +--- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/PKHeX.Core/Saves/SAV7.cs b/PKHeX.Core/Saves/SAV7.cs index 4ef05617c..e9c6ab3e6 100644 --- a/PKHeX.Core/Saves/SAV7.cs +++ b/PKHeX.Core/Saves/SAV7.cs @@ -93,14 +93,9 @@ namespace PKHeX.Core new byte[0x80].CopyTo(Data, AllBlocks[MemeCryptoBlock].Offset + 0x100); } - protected override void SetChecksums() - { - BoxLayout.SaveBattleTeams(); - AllBlocks.SetChecksums(Data); - } - protected override byte[] GetFinalData() { + BoxLayout.SaveBattleTeams(); SetChecksums(); var result = MemeCrypto.Resign7(Data); Debug.Assert(result != Data); diff --git a/PKHeX.Core/Saves/SaveFileMetadata.cs b/PKHeX.Core/Saves/SaveFileMetadata.cs index c73f56fc5..b8cac2b35 100644 --- a/PKHeX.Core/Saves/SaveFileMetadata.cs +++ b/PKHeX.Core/Saves/SaveFileMetadata.cs @@ -94,12 +94,10 @@ namespace PKHeX.Core FileName = GetFileName(path, BAKSuffix); } - private static string? GetFileName(string path, string bak) + private static string GetFileName(string path, string bak) { var bakName = Util.CleanFileName(bak); var fn = Path.GetFileName(path); - if (fn == null) - return null; return fn.EndsWith(bakName) ? fn.Substring(0, fn.Length - bakName.Length) : fn; }