Skip to content

Commit 2152b1e

Browse files
committed
Refactor RecordingBlock and RecordingFrame for clarity and consistency in property naming and initialization.
1 parent 4542df0 commit 2152b1e

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/Spectron.Files/Rzx/Blocks/RecordingBlock.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ public class RecordingBlock
2626
/// <summary>
2727
/// Flags (b0: Protected (frames are encrypted with x-key), b1: Compressed data.)
2828
/// </summary>
29-
public DWord Flags { get; private set; }
29+
public DWord Flags { get; private init; }
3030

31+
/// <summary>
32+
/// Sequence of input frames.
33+
/// </summary>
3134
public List<RecordingFrame> Frames { get; } = [];
3235

3336
internal static RecordingBlock Read(ByteStreamReader reader, DWord blockLength)
@@ -70,8 +73,8 @@ private static void ReadFrames(RecordingBlock block, byte[] data)
7073

7174
if (frame.InCounter == 65535)
7275
{
73-
// Repeated frame, copy the values from the previous frame
74-
frame.Values = block.Frames.LastOrDefault()?.Values ?? [];
76+
// Repeated frame, copy "in" values from the previous frame
77+
frame.InValues = block.Frames.LastOrDefault()?.InValues ?? [];
7578
}
7679

7780
block.Frames.Add(frame);

src/Spectron.Files/Rzx/Blocks/RecordingFrame.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class RecordingFrame
2121
/// <summary>
2222
/// Return values for the CPU I/O port reads.
2323
/// </summary>
24-
public byte[] Values { get; internal set; } = [];
24+
public byte[] InValues { get; internal set; } = [];
2525

2626
internal static RecordingFrame Read(ByteStreamReader reader)
2727
{
@@ -33,7 +33,7 @@ internal static RecordingFrame Read(ByteStreamReader reader)
3333

3434
if (block.InCounter != 65535)
3535
{
36-
block.Values = reader.ReadBytes(block.InCounter);
36+
block.InValues = reader.ReadBytes(block.InCounter);
3737
}
3838

3939
return block;

src/Spectron.Files/Rzx/Blocks/SnapshotBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class SnapshotBlock
2727
/// <summary>
2828
/// Input recording block.
2929
/// </summary>
30-
public RecordingBlock? Recording { get; internal set; }
30+
public RecordingBlock Recording { get; internal set; } = new();
3131

3232
/// <summary>
3333
/// Snapshot data.

0 commit comments

Comments
 (0)