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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user