[Refactor] Call AddRange instead of Add.

This commit is contained in:
2025-11-24 19:00:58 +00:00
parent ebce649b61
commit c4af5bf241
3 changed files with 7 additions and 8 deletions

View File

@@ -439,7 +439,7 @@ partial class Dump
{
outputOptical.SetTracks(tracks.ToList());
foreach(ulong newPregapSector in newPregapSectors) _resume.BadBlocks.Add(newPregapSector);
_resume.BadBlocks.AddRange(newPregapSectors);
if(i >= blocksToRead)
i -= blocksToRead;

View File

@@ -844,8 +844,7 @@ partial class Dump
{
(outputFormat as IWritableOpticalImage).SetTracks(tracks.ToList());
foreach(ulong newPregapSector in newPregapSectors)
_resume.BadBlocks.Add(newPregapSector);
_resume.BadBlocks.AddRange(newPregapSectors);
if(i >= blocksToRead)
i -= blocksToRead;
@@ -1109,7 +1108,7 @@ partial class Dump
{
(outputFormat as IWritableOpticalImage).SetTracks(tracks.ToList());
foreach(ulong newPregapSector in newPregapSectors) _resume.BadBlocks.Add(newPregapSector);
_resume.BadBlocks.AddRange(newPregapSectors);
if(i >= blocksToRead)
i -= blocksToRead;

View File

@@ -169,8 +169,9 @@ public sealed partial class CPM
if(errno != ErrorNumber.NoError) return errno;
if(_workingDefinition.complement)
for(var b = 0; b < readSector.Length; b++)
readSector[b] = (byte)(~readSector[b] & 0xFF);
{
for(var b = 0; b < readSector.Length; b++) readSector[b] = (byte)(~readSector[b] & 0xFF);
}
deinterleavedSectors.Add((ulong)p, readSector);
}
@@ -340,8 +341,7 @@ public sealed partial class CPM
// allocate block 0 for a file because that's where the directory resides.
// There is also a field telling how many bytes are used in the last block, but its meaning is
// non-standard so we must ignore it.
foreach(ushort blk in entry.allocations.Where(blk => !blocks.Contains(blk) && blk != 0))
blocks.Add(blk);
blocks.AddRange(entry.allocations.Where(blk => !blocks.Contains(blk) && blk != 0));
// Save the file
fInfo.UID = (ulong)user;