mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Loop can be converted into LINQ-expression.
This commit is contained in:
@@ -790,13 +790,7 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
definitions.definitions.Count > 0)
|
||||
{
|
||||
DicConsole.DebugWriteLine("CP/M Plugin", "Trying all known definitions.");
|
||||
foreach(CpmDefinition def in definitions.definitions)
|
||||
{
|
||||
ulong sectors = (ulong)(def.cylinders * def.sides * def.sectorsPerTrack);
|
||||
|
||||
if(sectors != imagePlugin.GetSectors() || def.bytesPerSector != imagePlugin.GetSectorSize())
|
||||
continue;
|
||||
|
||||
foreach(CpmDefinition def in from def in definitions.definitions let sectors = (ulong)(def.cylinders * def.sides * def.sectorsPerTrack) where sectors == imagePlugin.GetSectors() && def.bytesPerSector == imagePlugin.GetSectorSize() select def) {
|
||||
// Definition seems to describe current disk, at least, same number of volume sectors and bytes per sector
|
||||
DicConsole.DebugWriteLine("CP/M Plugin", "Trying definition \"{0}\"", def.comment);
|
||||
ulong offset;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.Console;
|
||||
@@ -282,7 +283,7 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
// 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) if(!blocks.Contains(blk) && blk != 0) blocks.Add(blk);
|
||||
foreach(ushort blk in entry.allocations.Where(blk => !blocks.Contains(blk) && blk != 0)) blocks.Add(blk);
|
||||
|
||||
// Save the file
|
||||
fInfo.UID = (ulong)user;
|
||||
@@ -376,7 +377,7 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
// 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) if(!blocks.Contains(blk) && blk != 0) blocks.Add(blk);
|
||||
foreach(ushort blk in entry.allocations.Cast<ushort>().Where(blk => !blocks.Contains(blk) && blk != 0)) blocks.Add(blk);
|
||||
|
||||
// Save the file
|
||||
fInfo.UID = (ulong)user;
|
||||
|
||||
Reference in New Issue
Block a user