mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Loop can be converted into LINQ-expression.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
@@ -261,10 +262,7 @@ namespace DiscImageChef.Filesystems
|
||||
RootBlock rblk = new RootBlock();
|
||||
|
||||
// So to handle even number of sectors
|
||||
foreach(ulong root_ptr in root_ptrs)
|
||||
{
|
||||
if(root_ptr >= partition.End || root_ptr < partition.Start) continue;
|
||||
|
||||
foreach(ulong root_ptr in root_ptrs.Where(root_ptr => root_ptr < partition.End && root_ptr >= partition.Start)) {
|
||||
DicConsole.DebugWriteLine("AmigaDOS plugin", "Searching for Rootblock in sector {0}", root_ptr);
|
||||
|
||||
sector = imagePlugin.ReadSector(root_ptr);
|
||||
@@ -346,10 +344,7 @@ namespace DiscImageChef.Filesystems
|
||||
uint blockSize = 0;
|
||||
|
||||
// So to handle even number of sectors
|
||||
foreach(ulong root_ptr in root_ptrs)
|
||||
{
|
||||
if(root_ptr >= partition.End || root_ptr < partition.Start) continue;
|
||||
|
||||
foreach(ulong root_ptr in root_ptrs.Where(root_ptr => root_ptr < partition.End && root_ptr >= partition.Start)) {
|
||||
DicConsole.DebugWriteLine("AmigaDOS plugin", "Searching for Rootblock in sector {0}", root_ptr);
|
||||
|
||||
RootBlockSector = imagePlugin.ReadSector(root_ptr);
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DiscImageChef.Filesystems.AppleDOS
|
||||
@@ -63,8 +64,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
return Errno.NotSupported;
|
||||
|
||||
contents = new List<string>();
|
||||
foreach(string ent in catalogCache.Keys) contents.Add(ent);
|
||||
contents = catalogCache.Keys.ToList();
|
||||
|
||||
if(debug)
|
||||
{
|
||||
@@ -103,31 +103,29 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
catSector = (CatalogSector)Marshal.PtrToStructure(catPtr, typeof(CatalogSector));
|
||||
Marshal.FreeHGlobal(catPtr);
|
||||
|
||||
foreach(FileEntry entry in catSector.entries)
|
||||
if(entry.extentTrack > 0)
|
||||
{
|
||||
track1UsedByFiles |= entry.extentTrack == 1;
|
||||
track2UsedByFiles |= entry.extentTrack == 2;
|
||||
foreach(FileEntry entry in catSector.entries.Where(entry => entry.extentTrack > 0)) {
|
||||
track1UsedByFiles |= entry.extentTrack == 1;
|
||||
track2UsedByFiles |= entry.extentTrack == 2;
|
||||
|
||||
byte[] filenameB = new byte[30];
|
||||
ushort ts = (ushort)((entry.extentTrack << 8) | entry.extentSector);
|
||||
byte[] filenameB = new byte[30];
|
||||
ushort ts = (ushort)((entry.extentTrack << 8) | entry.extentSector);
|
||||
|
||||
// Apple DOS has high byte set over ASCII.
|
||||
for(int i = 0; i < 30; i++) filenameB[i] = (byte)(entry.filename[i] & 0x7F);
|
||||
// Apple DOS has high byte set over ASCII.
|
||||
for(int i = 0; i < 30; i++) filenameB[i] = (byte)(entry.filename[i] & 0x7F);
|
||||
|
||||
string filename = StringHandlers.SpacePaddedToString(filenameB, CurrentEncoding);
|
||||
string filename = StringHandlers.SpacePaddedToString(filenameB, CurrentEncoding);
|
||||
|
||||
if(!catalogCache.ContainsKey(filename)) catalogCache.Add(filename, ts);
|
||||
if(!catalogCache.ContainsKey(filename)) catalogCache.Add(filename, ts);
|
||||
|
||||
if(!fileTypeCache.ContainsKey(filename))
|
||||
fileTypeCache.Add(filename, (byte)(entry.typeAndFlags & 0x7F));
|
||||
if(!fileTypeCache.ContainsKey(filename))
|
||||
fileTypeCache.Add(filename, (byte)(entry.typeAndFlags & 0x7F));
|
||||
|
||||
if(!fileSizeCache.ContainsKey(filename))
|
||||
fileSizeCache.Add(filename, entry.length * vtoc.bytesPerSector);
|
||||
if(!fileSizeCache.ContainsKey(filename))
|
||||
fileSizeCache.Add(filename, entry.length * vtoc.bytesPerSector);
|
||||
|
||||
if((entry.typeAndFlags & 0x80) == 0x80 && !lockedFiles.Contains(filename))
|
||||
lockedFiles.Add(filename);
|
||||
}
|
||||
if((entry.typeAndFlags & 0x80) == 0x80 && !lockedFiles.Contains(filename))
|
||||
lockedFiles.Add(filename);
|
||||
}
|
||||
|
||||
lba = (ulong)(catSector.trackOfNext * sectorsPerTrack + catSector.sectorOfNext);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DiscImageChef.Console;
|
||||
|
||||
namespace DiscImageChef.Filesystems.AppleMFS
|
||||
@@ -46,8 +47,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
return Errno.NotSupported;
|
||||
|
||||
contents = new List<string>();
|
||||
foreach(KeyValuePair<uint, string> kvp in idToFilename) contents.Add(kvp.Value);
|
||||
contents = idToFilename.Select(kvp => kvp.Value).ToList();
|
||||
|
||||
if(debug)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
@@ -240,11 +241,8 @@ namespace DiscImageChef.Filesystems
|
||||
bool equal_fat_ids = fat1_sector0[0] == fat2_sector0[0] && fat1_sector0[1] == fat2_sector0[1];
|
||||
// Volume is software interleaved 2:1
|
||||
MemoryStream rootMs = new MemoryStream();
|
||||
foreach(ulong rootSector in new[] {0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20})
|
||||
{
|
||||
byte[] tmp = imagePlugin.ReadSector(rootSector);
|
||||
rootMs.Write(tmp, 0, tmp.Length);
|
||||
}
|
||||
foreach(byte[] tmp in from ulong rootSector in new[] {0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20} select imagePlugin.ReadSector(rootSector))
|
||||
{ rootMs.Write(tmp, 0, tmp.Length); }
|
||||
|
||||
byte[] root_dir = rootMs.ToArray();
|
||||
rootMs = null;
|
||||
@@ -606,11 +604,8 @@ namespace DiscImageChef.Filesystems
|
||||
bool equal_fat_ids = fat1_sector0[0] == fat2_sector0[0] && fat1_sector0[1] == fat2_sector0[1];
|
||||
// Volume is software interleaved 2:1
|
||||
MemoryStream rootMs = new MemoryStream();
|
||||
foreach(ulong rootSector in new[] {0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20})
|
||||
{
|
||||
byte[] tmp = imagePlugin.ReadSector(rootSector);
|
||||
rootMs.Write(tmp, 0, tmp.Length);
|
||||
}
|
||||
foreach(byte[] tmp in from ulong rootSector in new[] {0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20} select imagePlugin.ReadSector(rootSector))
|
||||
{ rootMs.Write(tmp, 0, tmp.Length); }
|
||||
|
||||
byte[] root_dir = rootMs.ToArray();
|
||||
rootMs = null;
|
||||
@@ -1310,11 +1305,8 @@ namespace DiscImageChef.Filesystems
|
||||
if(useDecRainbowBPB)
|
||||
{
|
||||
MemoryStream rootMs = new MemoryStream();
|
||||
foreach(ulong rootSector in new[] {0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20})
|
||||
{
|
||||
byte[] tmp = imagePlugin.ReadSector(rootSector);
|
||||
rootMs.Write(tmp, 0, tmp.Length);
|
||||
}
|
||||
foreach(byte[] tmp in from ulong rootSector in new[] {0x17, 0x19, 0x1B, 0x1D, 0x1E, 0x20} select imagePlugin.ReadSector(rootSector))
|
||||
{ rootMs.Write(tmp, 0, tmp.Length); }
|
||||
|
||||
root_directory = rootMs.ToArray();
|
||||
rootMs = null;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
@@ -86,16 +87,14 @@ namespace DiscImageChef.Filesystems
|
||||
262144 / imagePlugin.GetSectorSize()
|
||||
};
|
||||
|
||||
foreach(ulong loc in locations)
|
||||
if(partition.End > partition.Start + loc + sb_size_in_sectors)
|
||||
{
|
||||
ufs_sb_sectors = imagePlugin.ReadSectors(partition.Start + loc, sb_size_in_sectors);
|
||||
magic = BitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
|
||||
foreach(ulong loc in locations.Where(loc => partition.End > partition.Start + loc + sb_size_in_sectors)) {
|
||||
ufs_sb_sectors = imagePlugin.ReadSectors(partition.Start + loc, sb_size_in_sectors);
|
||||
magic = BitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
|
||||
|
||||
if(magic == UFS_MAGIC || magic == UFS_CIGAM || magic == UFS_MAGIC_BW || magic == UFS_CIGAM_BW ||
|
||||
magic == UFS2_MAGIC || magic == UFS2_CIGAM || magic == UFS_BAD_MAGIC ||
|
||||
magic == UFS_BAD_CIGAM) return true;
|
||||
}
|
||||
if(magic == UFS_MAGIC || magic == UFS_CIGAM || magic == UFS_MAGIC_BW || magic == UFS_CIGAM_BW ||
|
||||
magic == UFS2_MAGIC || magic == UFS2_CIGAM || magic == UFS_BAD_MAGIC ||
|
||||
magic == UFS_BAD_CIGAM) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -129,22 +128,20 @@ namespace DiscImageChef.Filesystems
|
||||
262144 / imagePlugin.GetSectorSize()
|
||||
};
|
||||
|
||||
foreach(ulong loc in locations)
|
||||
if(partition.End > partition.Start + loc + sb_size_in_sectors)
|
||||
foreach(ulong loc in locations.Where(loc => partition.End > partition.Start + loc + sb_size_in_sectors)) {
|
||||
ufs_sb_sectors = imagePlugin.ReadSectors(partition.Start + loc, sb_size_in_sectors);
|
||||
magic = BitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
|
||||
|
||||
if(magic == UFS_MAGIC || magic == UFS_CIGAM || magic == UFS_MAGIC_BW || magic == UFS_CIGAM_BW ||
|
||||
magic == UFS2_MAGIC || magic == UFS2_CIGAM || magic == UFS_BAD_MAGIC || magic == UFS_BAD_CIGAM)
|
||||
{
|
||||
ufs_sb_sectors = imagePlugin.ReadSectors(partition.Start + loc, sb_size_in_sectors);
|
||||
magic = BitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
|
||||
|
||||
if(magic == UFS_MAGIC || magic == UFS_CIGAM || magic == UFS_MAGIC_BW || magic == UFS_CIGAM_BW ||
|
||||
magic == UFS2_MAGIC || magic == UFS2_CIGAM || magic == UFS_BAD_MAGIC || magic == UFS_BAD_CIGAM)
|
||||
{
|
||||
sb_offset = partition.Start + loc;
|
||||
break;
|
||||
}
|
||||
|
||||
magic = 0;
|
||||
sb_offset = partition.Start + loc;
|
||||
break;
|
||||
}
|
||||
|
||||
magic = 0;
|
||||
}
|
||||
|
||||
if(magic == 0)
|
||||
{
|
||||
information = "Not a UFS filesystem, I shouldn't have arrived here!";
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DiscImageChef.Decoders;
|
||||
using DiscImageChef.DiscImages;
|
||||
|
||||
@@ -89,12 +90,9 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
|
||||
Errno ReadDir(short dirId, ref List<string> contents)
|
||||
{
|
||||
contents = new List<string>();
|
||||
foreach(CatalogEntry entry in catalogCache)
|
||||
if(entry.parentID == dirId)
|
||||
// Do same trick as Mac OS X, replace filesystem '/' with '-',
|
||||
// as '-' is the path separator in Lisa OS
|
||||
contents.Add(StringHandlers.CToString(entry.filename, CurrentEncoding).Replace('/', '-'));
|
||||
// Do same trick as Mac OS X, replace filesystem '/' with '-',
|
||||
// as '-' is the path separator in Lisa OS
|
||||
contents = (from entry in catalogCache where entry.parentID == dirId select StringHandlers.CToString(entry.filename, CurrentEncoding).Replace('/', '-')).ToList();
|
||||
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.Console;
|
||||
@@ -115,15 +116,13 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
byte[] tmp = imagePlugin.ReadSectors(partition.Start, 2);
|
||||
|
||||
foreach(int offset in new[] {0, 0x200, 0x400, 0x600, 0x800, 0xA00})
|
||||
if(BitConverter.ToUInt16(tmp, offset) == 0 &&
|
||||
(byte)((tmp[offset + 0x04] & ProDOSStorageTypeMask) >> 4) == RootDirectoryType &&
|
||||
tmp[offset + 0x23] == ProDOSEntryLength && tmp[offset + 0x24] == ProDOSEntriesPerBlock)
|
||||
{
|
||||
Array.Copy(tmp, offset, rootDirectoryKeyBlock, 0, 0x200);
|
||||
APMFromHDDOnCD = true;
|
||||
break;
|
||||
}
|
||||
foreach(int offset in new[] {0, 0x200, 0x400, 0x600, 0x800, 0xA00}.Where(offset => BitConverter.ToUInt16(tmp, offset) == 0 &&
|
||||
(byte)((tmp[offset + 0x04] & ProDOSStorageTypeMask) >> 4) == RootDirectoryType &&
|
||||
tmp[offset + 0x23] == ProDOSEntryLength && tmp[offset + 0x24] == ProDOSEntriesPerBlock)) {
|
||||
Array.Copy(tmp, offset, rootDirectoryKeyBlock, 0, 0x200);
|
||||
APMFromHDDOnCD = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ushort prePointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0);
|
||||
@@ -169,15 +168,13 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
byte[] tmp = imagePlugin.ReadSectors(partition.Start, 2);
|
||||
|
||||
foreach(int offset in new[] {0, 0x200, 0x400, 0x600, 0x800, 0xA00})
|
||||
if(BitConverter.ToUInt16(tmp, offset) == 0 &&
|
||||
(byte)((tmp[offset + 0x04] & ProDOSStorageTypeMask) >> 4) == RootDirectoryType &&
|
||||
tmp[offset + 0x23] == ProDOSEntryLength && tmp[offset + 0x24] == ProDOSEntriesPerBlock)
|
||||
{
|
||||
Array.Copy(tmp, offset, rootDirectoryKeyBlockBytes, 0, 0x200);
|
||||
APMFromHDDOnCD = true;
|
||||
break;
|
||||
}
|
||||
foreach(int offset in new[] {0, 0x200, 0x400, 0x600, 0x800, 0xA00}.Where(offset => BitConverter.ToUInt16(tmp, offset) == 0 &&
|
||||
(byte)((tmp[offset + 0x04] & ProDOSStorageTypeMask) >> 4) == RootDirectoryType &&
|
||||
tmp[offset + 0x23] == ProDOSEntryLength && tmp[offset + 0x24] == ProDOSEntriesPerBlock)) {
|
||||
Array.Copy(tmp, offset, rootDirectoryKeyBlockBytes, 0, 0x200);
|
||||
APMFromHDDOnCD = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ProDOSRootDirectoryKeyBlock rootDirectoryKeyBlock = new ProDOSRootDirectoryKeyBlock();
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
|
||||
@@ -132,12 +133,7 @@ namespace DiscImageChef.Filesystems
|
||||
spc
|
||||
};
|
||||
|
||||
foreach(int i in locations)
|
||||
{
|
||||
if(i + sb_size_in_sectors >= (int)imagePlugin.ImageInfo.Sectors) break;
|
||||
|
||||
byte[] sb_sector = imagePlugin.ReadSectors((ulong)i + partition.Start, sb_size_in_sectors);
|
||||
|
||||
foreach(byte[] sb_sector in locations.TakeWhile(i => i + sb_size_in_sectors < (int)imagePlugin.ImageInfo.Sectors).Select(i => imagePlugin.ReadSectors((ulong)i + partition.Start, sb_size_in_sectors))) {
|
||||
magic = BitConverter.ToUInt32(sb_sector, 0x3F8); // XENIX magic location
|
||||
|
||||
if(magic == XENIX_MAGIC || magic == XENIX_CIGAM || magic == SYSV_MAGIC || magic == SYSV_CIGAM)
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
{
|
||||
@@ -45,9 +46,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
return Errno.NotSupported;
|
||||
|
||||
contents = new List<string>();
|
||||
foreach(PascalFileEntry ent in fileEntries)
|
||||
contents.Add(StringHandlers.PascalToString(ent.filename, CurrentEncoding));
|
||||
contents = fileEntries.Select(ent => StringHandlers.PascalToString(ent.filename, CurrentEncoding)).ToList();
|
||||
|
||||
if(debug)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
{
|
||||
@@ -163,13 +164,11 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
{
|
||||
entry = new PascalFileEntry();
|
||||
|
||||
foreach(PascalFileEntry ent in fileEntries)
|
||||
if(string.Compare(path, StringHandlers.PascalToString(ent.filename, CurrentEncoding),
|
||||
StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
{
|
||||
entry = ent;
|
||||
return Errno.NoError;
|
||||
}
|
||||
foreach(PascalFileEntry ent in fileEntries.Where(ent => string.Compare(path, StringHandlers.PascalToString(ent.filename, CurrentEncoding),
|
||||
StringComparison.InvariantCultureIgnoreCase) == 0)) {
|
||||
entry = ent;
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
return Errno.NoSuchFile;
|
||||
}
|
||||
|
||||
@@ -245,10 +245,7 @@ namespace DiscImageChef.Filesystems
|
||||
ulong[] positions = {256, 512, partition.End - 256, partition.End};
|
||||
bool anchorFound = false;
|
||||
|
||||
foreach(ulong position in positions)
|
||||
{
|
||||
if(position + partition.Start >= partition.End) continue;
|
||||
|
||||
foreach(ulong position in positions.Where(position => position + partition.Start < partition.End)) {
|
||||
sector = imagePlugin.ReadSector(position);
|
||||
anchor = new AnchorVolumeDescriptorPointer();
|
||||
IntPtr anchorPtr = Marshal.AllocHGlobal(Marshal.SizeOf(anchor));
|
||||
|
||||
Reference in New Issue
Block a user