Deduplicate savefile constructors

No longer necessary as we don't keep BAK reference anymore.
This commit is contained in:
Kurt 2022-03-05 17:15:38 -08:00
parent 8fdd96209c
commit 8f0035a577
3 changed files with 3 additions and 22 deletions

View file

@ -11,14 +11,7 @@ public sealed class SAV8LA : SaveFile, ISaveBlock8LA, ISCBlockArray, ISaveFileRe
protected internal override string ShortSummary => $"{OT} ({Version}) - {LastSaved.LastSavedTime}";
public override string Extension => string.Empty;
public SAV8LA(byte[] data) : base(data)
{
Data = Array.Empty<byte>();
AllBlocks = SwishCrypto.Decrypt(data);
Blocks = new SaveBlockAccessor8LA(this);
SaveRevision = Blocks.DetectRevision();
Initialize();
}
public SAV8LA(byte[] data) : this(SwishCrypto.Decrypt(data)) { }
private SAV8LA(IReadOnlyList<SCBlock> blocks) : base(Array.Empty<byte>())
{

View file

@ -8,14 +8,7 @@ namespace PKHeX.Core
/// </summary>
public sealed class SAV8SWSH : SAV8, ISaveBlock8SWSH, ITrainerStatRecord, ISaveFileRevision, ISCBlockArray
{
public SAV8SWSH(byte[] data) : base(data)
{
Data = Array.Empty<byte>();
AllBlocks = SwishCrypto.Decrypt(data);
Blocks = new SaveBlockAccessor8SWSH(this);
SaveRevision = Zukan.GetRevision();
Initialize();
}
public SAV8SWSH(byte[] data) : this(SwishCrypto.Decrypt(data)) { }
private SAV8SWSH(IReadOnlyList<SCBlock> blocks) : base(Array.Empty<byte>())
{

View file

@ -23,12 +23,7 @@ namespace PKHeX.Core
Metadata = new SaveFileMetadata(this);
}
protected SaveFile(int size = 0)
{
Data = size == 0 ? Array.Empty<byte>() : new byte[size];
State = new SaveFileState(false);
Metadata = new SaveFileMetadata(this);
}
protected SaveFile(int size = 0) : this(size == 0 ? Array.Empty<byte>() : new byte[size], false) { }
protected internal abstract string ShortSummary { get; }
public abstract string Extension { get; }