mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Refactor] Call string.Equals instead of string.Compare.
This commit is contained in:
@@ -113,7 +113,7 @@ public sealed partial class AppleDOS
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
if(!string.IsNullOrEmpty(path) && !string.Equals(path, "/", StringComparison.OrdinalIgnoreCase))
|
||||
return ErrorNumber.NotSupported;
|
||||
|
||||
var contents = _catalogCache.Keys.ToList();
|
||||
|
||||
@@ -158,9 +158,9 @@ public sealed partial class AppleDOS
|
||||
if(_lockedFiles.Contains(filename)) attributes |= FileAttributes.ReadOnly;
|
||||
|
||||
if(_debug &&
|
||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
|
||||
(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Vtoc", StringComparison.InvariantCulture)))
|
||||
attributes |= FileAttributes.System;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
@@ -182,13 +182,13 @@ public sealed partial class AppleDOS
|
||||
if(filename.Length > 30) return ErrorNumber.NameTooLong;
|
||||
|
||||
if(_debug &&
|
||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
|
||||
(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Vtoc", StringComparison.InvariantCulture)))
|
||||
{
|
||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(path, "$", StringComparison.InvariantCulture))
|
||||
file = _catalogBlocks;
|
||||
else if(string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)
|
||||
else if(string.Equals(path, "$Vtoc", StringComparison.InvariantCulture))
|
||||
file = _vtocBlocks;
|
||||
else
|
||||
file = _bootBlocks;
|
||||
@@ -273,16 +273,15 @@ public sealed partial class AppleDOS
|
||||
GetAttributes(path, out FileAttributes attrs);
|
||||
|
||||
if(_debug &&
|
||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
|
||||
(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Vtoc", StringComparison.InvariantCulture)))
|
||||
{
|
||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(path, "$", StringComparison.InvariantCulture))
|
||||
stat.Length = _catalogBlocks.Length;
|
||||
else if(string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0)
|
||||
stat.Length = _bootBlocks.Length;
|
||||
else if(string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)
|
||||
stat.Length = _vtocBlocks.Length;
|
||||
else if(string.Equals(path, "$Boot", StringComparison.InvariantCulture))
|
||||
stat.Length = _bootBlocks.Length;
|
||||
else if(string.Equals(path, "$Vtoc", StringComparison.InvariantCulture)) stat.Length = _vtocBlocks.Length;
|
||||
|
||||
stat.Blocks = stat.Length / _vtoc.bytesPerSector;
|
||||
}
|
||||
|
||||
@@ -58,9 +58,9 @@ public sealed partial class AppleDOS
|
||||
xattrs = [];
|
||||
|
||||
if(_debug &&
|
||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) {}
|
||||
(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Vtoc", StringComparison.InvariantCulture))) {}
|
||||
else
|
||||
{
|
||||
if(!_catalogCache.ContainsKey(filename)) return ErrorNumber.NoSuchFile;
|
||||
@@ -87,14 +87,14 @@ public sealed partial class AppleDOS
|
||||
if(filename.Length > 30) return ErrorNumber.NameTooLong;
|
||||
|
||||
if(_debug &&
|
||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
|
||||
(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Vtoc", StringComparison.InvariantCulture)))
|
||||
return ErrorNumber.NoSuchExtendedAttribute;
|
||||
|
||||
if(!_catalogCache.ContainsKey(filename)) return ErrorNumber.NoSuchFile;
|
||||
|
||||
if(string.Compare(xattr, "com.apple.dos.type", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(xattr, "com.apple.dos.type", StringComparison.InvariantCulture))
|
||||
{
|
||||
if(!_fileTypeCache.TryGetValue(filename, out byte type)) return ErrorNumber.InvalidArgument;
|
||||
|
||||
@@ -104,7 +104,7 @@ public sealed partial class AppleDOS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(string.Compare(xattr, "com.apple.dos.tracksectorlist", StringComparison.InvariantCulture) != 0 || !_debug)
|
||||
if(!string.Equals(xattr, "com.apple.dos.tracksectorlist", StringComparison.InvariantCulture) || !_debug)
|
||||
return ErrorNumber.NoSuchExtendedAttribute;
|
||||
|
||||
if(!_extentCache.TryGetValue(filename, out byte[] ts)) return ErrorNumber.InvalidArgument;
|
||||
|
||||
@@ -128,7 +128,7 @@ public sealed partial class AppleMFS
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
if(!string.IsNullOrEmpty(path) && !string.Equals(path, "/", StringComparison.OrdinalIgnoreCase))
|
||||
return ErrorNumber.NotSupported;
|
||||
|
||||
var contents = _idToFilename.Select(static kvp => kvp.Value).ToList();
|
||||
|
||||
@@ -208,15 +208,15 @@ public sealed partial class AppleMFS
|
||||
|
||||
switch(_debug)
|
||||
{
|
||||
case true when string.Compare(path, "$", StringComparison.InvariantCulture) == 0:
|
||||
case true when string.Equals(path, "$", StringComparison.InvariantCulture):
|
||||
file = _directoryBlocks;
|
||||
|
||||
break;
|
||||
case true when string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 && _bootBlocks != null:
|
||||
case true when string.Equals(path, "$Boot", StringComparison.InvariantCulture) && _bootBlocks != null:
|
||||
file = _bootBlocks;
|
||||
|
||||
break;
|
||||
case true when string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0:
|
||||
case true when string.Equals(path, "$Bitmap", StringComparison.InvariantCulture):
|
||||
file = _blockMapBytes;
|
||||
|
||||
break;
|
||||
@@ -292,10 +292,10 @@ public sealed partial class AppleMFS
|
||||
|
||||
if(_debug)
|
||||
{
|
||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Bitmap", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$MDB", StringComparison.InvariantCulture))
|
||||
{
|
||||
stat = new FileEntryInfo
|
||||
{
|
||||
@@ -305,24 +305,24 @@ public sealed partial class AppleMFS
|
||||
Attributes = FileAttributes.System
|
||||
};
|
||||
|
||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(path, "$", StringComparison.InvariantCulture))
|
||||
{
|
||||
stat.Blocks = _directoryBlocks.Length / stat.BlockSize + _directoryBlocks.Length % stat.BlockSize;
|
||||
|
||||
stat.Length = _directoryBlocks.Length;
|
||||
}
|
||||
else if(string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0)
|
||||
else if(string.Equals(path, "$Bitmap", StringComparison.InvariantCulture))
|
||||
{
|
||||
stat.Blocks = _blockMapBytes.Length / stat.BlockSize + _blockMapBytes.Length % stat.BlockSize;
|
||||
|
||||
stat.Length = _blockMapBytes.Length;
|
||||
}
|
||||
else if(string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 && _bootBlocks != null)
|
||||
else if(string.Equals(path, "$Boot", StringComparison.InvariantCulture) && _bootBlocks != null)
|
||||
{
|
||||
stat.Blocks = _bootBlocks.Length / stat.BlockSize + _bootBlocks.Length % stat.BlockSize;
|
||||
stat.Length = _bootBlocks.Length;
|
||||
}
|
||||
else if(string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
|
||||
else if(string.Equals(path, "$MDB", StringComparison.InvariantCulture))
|
||||
{
|
||||
stat.Blocks = _mdbBlocks.Length / stat.BlockSize + _mdbBlocks.Length % stat.BlockSize;
|
||||
stat.Length = _mdbBlocks.Length;
|
||||
|
||||
@@ -60,10 +60,10 @@ public sealed partial class AppleMFS
|
||||
|
||||
if(_debug)
|
||||
{
|
||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Bitmap", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$MDB", StringComparison.InvariantCulture))
|
||||
{
|
||||
if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSonyTag))
|
||||
xattrs.Add("com.apple.macintosh.tags");
|
||||
@@ -107,15 +107,15 @@ public sealed partial class AppleMFS
|
||||
|
||||
if(_debug)
|
||||
{
|
||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Bitmap", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$MDB", StringComparison.InvariantCulture))
|
||||
{
|
||||
if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSonyTag) &&
|
||||
string.Compare(xattr, "com.apple.macintosh.tags", StringComparison.InvariantCulture) == 0)
|
||||
string.Equals(xattr, "com.apple.macintosh.tags", StringComparison.InvariantCulture))
|
||||
{
|
||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(path, "$", StringComparison.InvariantCulture))
|
||||
{
|
||||
buf = new byte[_directoryTags.Length];
|
||||
Array.Copy(_directoryTags, 0, buf, 0, buf.Length);
|
||||
@@ -123,7 +123,7 @@ public sealed partial class AppleMFS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(path, "$Bitmap", StringComparison.InvariantCulture))
|
||||
{
|
||||
buf = new byte[_bitmapTags.Length];
|
||||
Array.Copy(_bitmapTags, 0, buf, 0, buf.Length);
|
||||
@@ -131,7 +131,7 @@ public sealed partial class AppleMFS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(path, "$Boot", StringComparison.InvariantCulture))
|
||||
{
|
||||
buf = new byte[_bootTags.Length];
|
||||
Array.Copy(_bootTags, 0, buf, 0, buf.Length);
|
||||
@@ -139,7 +139,7 @@ public sealed partial class AppleMFS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(path, "$MDB", StringComparison.InvariantCulture))
|
||||
{
|
||||
buf = new byte[_mdbTags.Length];
|
||||
Array.Copy(_mdbTags, 0, buf, 0, buf.Length);
|
||||
@@ -160,17 +160,17 @@ public sealed partial class AppleMFS
|
||||
|
||||
switch(entry.flRLgLen)
|
||||
{
|
||||
case > 0 when string.Compare(xattr, "com.apple.ResourceFork", StringComparison.InvariantCulture) == 0:
|
||||
case > 0 when string.Equals(xattr, "com.apple.ResourceFork", StringComparison.InvariantCulture):
|
||||
error = ReadFile(path, out buf, true, false);
|
||||
|
||||
return error;
|
||||
case > 0 when string.Compare(xattr, "com.apple.ResourceFork.tags", StringComparison.InvariantCulture) == 0:
|
||||
case > 0 when string.Equals(xattr, "com.apple.ResourceFork.tags", StringComparison.InvariantCulture):
|
||||
error = ReadFile(path, out buf, true, true);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
if(string.Compare(xattr, "com.apple.FinderInfo", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(xattr, "com.apple.FinderInfo", StringComparison.InvariantCulture))
|
||||
{
|
||||
buf = Marshal.StructureToByteArrayBigEndian(entry.flUsrWds);
|
||||
|
||||
@@ -179,7 +179,7 @@ public sealed partial class AppleMFS
|
||||
|
||||
if(!_debug ||
|
||||
!_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSonyTag) ||
|
||||
string.Compare(xattr, "com.apple.macintosh.tags", StringComparison.InvariantCulture) != 0)
|
||||
!string.Equals(xattr, "com.apple.macintosh.tags", StringComparison.InvariantCulture))
|
||||
return ErrorNumber.NoSuchExtendedAttribute;
|
||||
|
||||
error = ReadFile(path, out buf, false, true);
|
||||
|
||||
@@ -46,7 +46,7 @@ public sealed partial class CBM
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
if(!string.IsNullOrEmpty(path) && !string.Equals(path, "/", StringComparison.OrdinalIgnoreCase))
|
||||
return ErrorNumber.NotSupported;
|
||||
|
||||
var contents = _cache.Keys.ToList();
|
||||
|
||||
@@ -63,14 +63,12 @@ public sealed partial class CPM
|
||||
if((entry.statusUser & 0x7F) < 0x20)
|
||||
{
|
||||
for(var f = 0; f < 8; f++)
|
||||
{
|
||||
if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00) return false;
|
||||
}
|
||||
if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00)
|
||||
return false;
|
||||
|
||||
for(var e = 0; e < 3; e++)
|
||||
{
|
||||
if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00) return false;
|
||||
}
|
||||
if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00)
|
||||
return false;
|
||||
|
||||
if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(entry.filename)) fileCount++;
|
||||
}
|
||||
@@ -81,14 +79,12 @@ public sealed partial class CPM
|
||||
case 0x20:
|
||||
{
|
||||
for(var f = 0; f < 8; f++)
|
||||
{
|
||||
if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00) return false;
|
||||
}
|
||||
if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00)
|
||||
return false;
|
||||
|
||||
for(var e = 0; e < 3; e++)
|
||||
{
|
||||
if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00) return false;
|
||||
}
|
||||
if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00)
|
||||
return false;
|
||||
|
||||
_label = Encoding.ASCII.GetString(directory, off + 1, 11).Trim();
|
||||
_labelCreationDate = new byte[4];
|
||||
@@ -129,7 +125,7 @@ public sealed partial class CPM
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
if(!string.IsNullOrEmpty(path) && !string.Equals(path, "/", StringComparison.OrdinalIgnoreCase))
|
||||
return ErrorNumber.NotSupported;
|
||||
|
||||
node = new CpmDirNode
|
||||
|
||||
@@ -51,7 +51,7 @@ public sealed partial class CPM
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
if(string.IsNullOrEmpty(pathElements[0]) ||
|
||||
string.Compare(pathElements[0], "/", StringComparison.OrdinalIgnoreCase) == 0)
|
||||
string.Equals(pathElements[0], "/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
attributes = FileAttributes.Directory;
|
||||
@@ -144,7 +144,7 @@ public sealed partial class CPM
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
if(!string.IsNullOrEmpty(path) && !string.Equals(path, "/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return _statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out stat)
|
||||
? ErrorNumber.NoError
|
||||
|
||||
@@ -936,7 +936,7 @@ public sealed partial class CPM
|
||||
else
|
||||
{
|
||||
// Head changes after every track
|
||||
if(string.Compare(def.order, "SIDES", StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
if(string.Equals(def.order, "SIDES", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
_sectorMask = new int[def.side1.sectorIds.Length + def.side2.sectorIds.Length];
|
||||
|
||||
@@ -952,10 +952,7 @@ public sealed partial class CPM
|
||||
}
|
||||
|
||||
// Head changes after whole side
|
||||
else if(string.Compare(def.order,
|
||||
"CYLINDERS",
|
||||
StringComparison.InvariantCultureIgnoreCase) ==
|
||||
0)
|
||||
else if(string.Equals(def.order, "CYLINDERS", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
for(var m = 0; m < def.side1.sectorIds.Length; m++)
|
||||
_sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
|
||||
@@ -972,10 +969,7 @@ public sealed partial class CPM
|
||||
}
|
||||
|
||||
// TODO: Implement COLUMBIA ordering
|
||||
else if(string.Compare(def.order,
|
||||
"COLUMBIA",
|
||||
StringComparison.InvariantCultureIgnoreCase) ==
|
||||
0)
|
||||
else if(string.Equals(def.order, "COLUMBIA", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
Localization
|
||||
@@ -985,8 +979,7 @@ public sealed partial class CPM
|
||||
}
|
||||
|
||||
// TODO: Implement EAGLE ordering
|
||||
else if(string.Compare(def.order, "EAGLE", StringComparison.InvariantCultureIgnoreCase) ==
|
||||
0)
|
||||
else if(string.Equals(def.order, "EAGLE", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
Localization
|
||||
@@ -1033,8 +1026,9 @@ public sealed partial class CPM
|
||||
|
||||
// Complement of the directory bytes if needed
|
||||
if(def.complement)
|
||||
for(var b = 0; b < directory.Length; b++)
|
||||
directory[b] = (byte)(~directory[b] & 0xFF);
|
||||
{
|
||||
for(var b = 0; b < directory.Length; b++) directory[b] = (byte)(~directory[b] & 0xFF);
|
||||
}
|
||||
|
||||
// Check the directory
|
||||
if(CheckDir(directory))
|
||||
|
||||
@@ -75,7 +75,7 @@ public sealed partial class CPM
|
||||
else
|
||||
{
|
||||
// Head changes after every track
|
||||
if(string.Compare(_workingDefinition.order, "SIDES", StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
if(string.Equals(_workingDefinition.order, "SIDES", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
_sectorMask = new int[_workingDefinition.side1.sectorIds.Length +
|
||||
_workingDefinition.side2.sectorIds.Length];
|
||||
@@ -94,10 +94,7 @@ public sealed partial class CPM
|
||||
}
|
||||
|
||||
// Head changes after whole side
|
||||
else if(string.Compare(_workingDefinition.order,
|
||||
"CYLINDERS",
|
||||
StringComparison.InvariantCultureIgnoreCase) ==
|
||||
0)
|
||||
else if(string.Equals(_workingDefinition.order, "CYLINDERS", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
for(var m = 0; m < _workingDefinition.side1.sectorIds.Length; m++)
|
||||
_sectorMask[m] = _workingDefinition.side1.sectorIds[m] - _workingDefinition.side1.sectorIds[0];
|
||||
@@ -119,8 +116,7 @@ public sealed partial class CPM
|
||||
}
|
||||
|
||||
// TODO: Implement COLUMBIA ordering
|
||||
else if(string.Compare(_workingDefinition.order, "COLUMBIA", StringComparison.InvariantCultureIgnoreCase) ==
|
||||
0)
|
||||
else if(string.Equals(_workingDefinition.order, "COLUMBIA", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
Localization
|
||||
@@ -130,7 +126,7 @@ public sealed partial class CPM
|
||||
}
|
||||
|
||||
// TODO: Implement EAGLE ordering
|
||||
else if(string.Compare(_workingDefinition.order, "EAGLE", StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
else if(string.Equals(_workingDefinition.order, "EAGLE", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
Localization
|
||||
@@ -151,8 +147,8 @@ public sealed partial class CPM
|
||||
// Deinterleave whole volume
|
||||
Dictionary<ulong, byte[]> deinterleavedSectors = new();
|
||||
|
||||
if(_workingDefinition.sides == 1 ||
|
||||
string.Compare(_workingDefinition.order, "SIDES", StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
if(_workingDefinition.sides == 1 ||
|
||||
string.Equals(_workingDefinition.order, "SIDES", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
AaruLogging.Debug(MODULE_NAME, Localization.Deinterleaving_whole_volume);
|
||||
|
||||
@@ -169,8 +165,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);
|
||||
}
|
||||
|
||||
@@ -51,11 +51,12 @@ public sealed partial class CPM
|
||||
|
||||
if(!_fileCache.ContainsKey(pathElements[0].ToUpperInvariant())) return ErrorNumber.NoSuchFile;
|
||||
|
||||
if(string.Compare(xattr, "com.caldera.cpm.password", StringComparison.InvariantCulture) == 0)
|
||||
if(!_passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf))
|
||||
return ErrorNumber.NoError;
|
||||
if(string.Equals(xattr, "com.caldera.cpm.password", StringComparison.InvariantCulture))
|
||||
{
|
||||
if(!_passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf)) return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(string.Compare(xattr, "com.caldera.cpm.password.text", StringComparison.InvariantCulture) != 0)
|
||||
if(!string.Equals(xattr, "com.caldera.cpm.password.text", StringComparison.InvariantCulture))
|
||||
return ErrorNumber.NoSuchExtendedAttribute;
|
||||
|
||||
return !_passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf)
|
||||
|
||||
@@ -105,9 +105,8 @@ public sealed partial class LisaFS
|
||||
if(!_mounted || !_debug) return ErrorNumber.AccessDenied;
|
||||
|
||||
if(fileId is > 4 or <= 0)
|
||||
{
|
||||
if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) return ErrorNumber.InvalidArgument;
|
||||
}
|
||||
if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
|
||||
if(_systemFileCache.TryGetValue(fileId, out buf) && !tags) return ErrorNumber.NoError;
|
||||
|
||||
@@ -330,9 +329,8 @@ public sealed partial class LisaFS
|
||||
if(!tags)
|
||||
{
|
||||
if(_fileSizeCache.TryGetValue(fileId, out int realSize))
|
||||
{
|
||||
if(realSize > temp.Length) AaruLogging.Error(Localization.File_0_gets_truncated, fileId);
|
||||
}
|
||||
if(realSize > temp.Length)
|
||||
AaruLogging.Error(Localization.File_0_gets_truncated, fileId);
|
||||
|
||||
buf = temp;
|
||||
|
||||
@@ -368,42 +366,42 @@ public sealed partial class LisaFS
|
||||
|
||||
if(_debug && pathElements.Length == 1)
|
||||
{
|
||||
if(string.Compare(pathElements[0], "$MDDF", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(pathElements[0], "$MDDF", StringComparison.InvariantCulture))
|
||||
{
|
||||
fileId = (short)FILEID_MDDF;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(string.Compare(pathElements[0], "$Boot", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(pathElements[0], "$Boot", StringComparison.InvariantCulture))
|
||||
{
|
||||
fileId = FILEID_BOOT_SIGNED;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(string.Compare(pathElements[0], "$Loader", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(pathElements[0], "$Loader", StringComparison.InvariantCulture))
|
||||
{
|
||||
fileId = FILEID_LOADER_SIGNED;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(string.Compare(pathElements[0], "$Bitmap", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(pathElements[0], "$Bitmap", StringComparison.InvariantCulture))
|
||||
{
|
||||
fileId = (short)FILEID_BITMAP;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(string.Compare(pathElements[0], "$S-Record", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(pathElements[0], "$S-Record", StringComparison.InvariantCulture))
|
||||
{
|
||||
fileId = (short)FILEID_SRECORD;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(string.Compare(pathElements[0], "$", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(pathElements[0], "$", StringComparison.InvariantCulture))
|
||||
{
|
||||
fileId = DIRID_ROOT;
|
||||
isDir = true;
|
||||
@@ -421,8 +419,8 @@ public sealed partial class LisaFS
|
||||
string filename = StringHandlers.CToString(entry.filename, _encoding);
|
||||
|
||||
// LisaOS is case insensitive
|
||||
if(string.Compare(wantedFilename, filename, StringComparison.InvariantCultureIgnoreCase) != 0 ||
|
||||
entry.parentID != fileId)
|
||||
if(!string.Equals(wantedFilename, filename, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
entry.parentID != fileId)
|
||||
continue;
|
||||
|
||||
fileId = entry.fileID;
|
||||
|
||||
@@ -50,7 +50,7 @@ public sealed partial class PascalPlugin
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
|
||||
if(!string.IsNullOrEmpty(path) && !string.Equals(path, "/", StringComparison.OrdinalIgnoreCase))
|
||||
return ErrorNumber.NotSupported;
|
||||
|
||||
List<string> contents = _fileEntries.ConvertAll(ent => StringHandlers.PascalToString(ent.Filename, _encoding));
|
||||
|
||||
@@ -43,13 +43,12 @@ public sealed partial class PascalPlugin
|
||||
{
|
||||
entry = new PascalFileEntry();
|
||||
|
||||
foreach(PascalFileEntry ent in _fileEntries.Where(ent => string.Compare(path,
|
||||
StringHandlers
|
||||
.PascalToString(ent.Filename,
|
||||
_encoding),
|
||||
StringComparison
|
||||
.InvariantCultureIgnoreCase) ==
|
||||
0))
|
||||
foreach(PascalFileEntry ent in _fileEntries.Where(ent => string.Equals(path,
|
||||
StringHandlers
|
||||
.PascalToString(ent.Filename,
|
||||
_encoding),
|
||||
StringComparison
|
||||
.InvariantCultureIgnoreCase)))
|
||||
{
|
||||
entry = ent;
|
||||
|
||||
@@ -95,9 +94,9 @@ public sealed partial class PascalPlugin
|
||||
byte[] file;
|
||||
|
||||
if(_debug &&
|
||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0))
|
||||
file = string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ? _catalogBlocks : _bootBlocks;
|
||||
(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Boot", StringComparison.InvariantCulture)))
|
||||
file = string.Equals(path, "$", StringComparison.InvariantCulture) ? _catalogBlocks : _bootBlocks;
|
||||
else
|
||||
{
|
||||
ErrorNumber error = GetFileEntry(path, out PascalFileEntry entry);
|
||||
@@ -173,8 +172,8 @@ public sealed partial class PascalPlugin
|
||||
|
||||
if(_debug)
|
||||
{
|
||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||
string.Equals(path, "$Boot", StringComparison.InvariantCulture))
|
||||
{
|
||||
stat = new FileEntryInfo
|
||||
{
|
||||
@@ -183,7 +182,7 @@ public sealed partial class PascalPlugin
|
||||
Links = 1
|
||||
};
|
||||
|
||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
|
||||
if(string.Equals(path, "$", StringComparison.InvariantCulture))
|
||||
{
|
||||
stat.Blocks = _catalogBlocks.Length / stat.BlockSize + _catalogBlocks.Length % stat.BlockSize;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user