Remove unnecessary constructor

Make key readonly
This commit is contained in:
Kurt 2020-01-11 14:18:11 -08:00
parent 95f24a9d36
commit 7e6edbaded
2 changed files with 3 additions and 4 deletions

View File

@ -151,7 +151,7 @@ public sealed class SCBlock : BlockInfo
/// <summary>
/// Used to encrypt the rest of the block.
/// </summary>
public uint Key { get; set; }
public readonly uint Key;
/// <summary>
/// What kind of block is it?
@ -168,8 +168,7 @@ public sealed class SCBlock : BlockInfo
/// </summary>
public byte[] Data = Array.Empty<byte>();
private SCBlock(uint key) => Key = key;
internal SCBlock() { }
internal SCBlock(uint key) => Key = key;
protected override bool ChecksumValid(byte[] data) => true;
protected override void SetChecksum(byte[] data) { }

View File

@ -12,7 +12,7 @@ private static SCBlock[] GetBlankBlockArray(IReadOnlyList<uint> arr)
for (int i = 0; i < blocks.Length; i++)
{
int index = i * 2;
blocks[i] = new SCBlock { Key = arr[index], Data = new byte[(int)arr[index + 1]] };
blocks[i] = new SCBlock(arr[index]) { Data = new byte[(int)arr[index + 1]] };
}
return blocks;