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(!_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;
|
return ErrorNumber.NotSupported;
|
||||||
|
|
||||||
var contents = _catalogCache.Keys.ToList();
|
var contents = _catalogCache.Keys.ToList();
|
||||||
|
|||||||
@@ -158,9 +158,9 @@ public sealed partial class AppleDOS
|
|||||||
if(_lockedFiles.Contains(filename)) attributes |= FileAttributes.ReadOnly;
|
if(_lockedFiles.Contains(filename)) attributes |= FileAttributes.ReadOnly;
|
||||||
|
|
||||||
if(_debug &&
|
if(_debug &&
|
||||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
|
string.Equals(path, "$Vtoc", StringComparison.InvariantCulture)))
|
||||||
attributes |= FileAttributes.System;
|
attributes |= FileAttributes.System;
|
||||||
|
|
||||||
return ErrorNumber.NoError;
|
return ErrorNumber.NoError;
|
||||||
@@ -182,13 +182,13 @@ public sealed partial class AppleDOS
|
|||||||
if(filename.Length > 30) return ErrorNumber.NameTooLong;
|
if(filename.Length > 30) return ErrorNumber.NameTooLong;
|
||||||
|
|
||||||
if(_debug &&
|
if(_debug &&
|
||||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
|
string.Equals(path, "$Vtoc", StringComparison.InvariantCulture)))
|
||||||
{
|
{
|
||||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
|
if(string.Equals(path, "$", StringComparison.InvariantCulture))
|
||||||
file = _catalogBlocks;
|
file = _catalogBlocks;
|
||||||
else if(string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)
|
else if(string.Equals(path, "$Vtoc", StringComparison.InvariantCulture))
|
||||||
file = _vtocBlocks;
|
file = _vtocBlocks;
|
||||||
else
|
else
|
||||||
file = _bootBlocks;
|
file = _bootBlocks;
|
||||||
@@ -273,16 +273,15 @@ public sealed partial class AppleDOS
|
|||||||
GetAttributes(path, out FileAttributes attrs);
|
GetAttributes(path, out FileAttributes attrs);
|
||||||
|
|
||||||
if(_debug &&
|
if(_debug &&
|
||||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
|
string.Equals(path, "$Vtoc", StringComparison.InvariantCulture)))
|
||||||
{
|
{
|
||||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
|
if(string.Equals(path, "$", StringComparison.InvariantCulture))
|
||||||
stat.Length = _catalogBlocks.Length;
|
stat.Length = _catalogBlocks.Length;
|
||||||
else if(string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0)
|
else if(string.Equals(path, "$Boot", StringComparison.InvariantCulture))
|
||||||
stat.Length = _bootBlocks.Length;
|
stat.Length = _bootBlocks.Length;
|
||||||
else if(string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)
|
else if(string.Equals(path, "$Vtoc", StringComparison.InvariantCulture)) stat.Length = _vtocBlocks.Length;
|
||||||
stat.Length = _vtocBlocks.Length;
|
|
||||||
|
|
||||||
stat.Blocks = stat.Length / _vtoc.bytesPerSector;
|
stat.Blocks = stat.Length / _vtoc.bytesPerSector;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,9 +58,9 @@ public sealed partial class AppleDOS
|
|||||||
xattrs = [];
|
xattrs = [];
|
||||||
|
|
||||||
if(_debug &&
|
if(_debug &&
|
||||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) {}
|
string.Equals(path, "$Vtoc", StringComparison.InvariantCulture))) {}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!_catalogCache.ContainsKey(filename)) return ErrorNumber.NoSuchFile;
|
if(!_catalogCache.ContainsKey(filename)) return ErrorNumber.NoSuchFile;
|
||||||
@@ -87,14 +87,14 @@ public sealed partial class AppleDOS
|
|||||||
if(filename.Length > 30) return ErrorNumber.NameTooLong;
|
if(filename.Length > 30) return ErrorNumber.NameTooLong;
|
||||||
|
|
||||||
if(_debug &&
|
if(_debug &&
|
||||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
|
string.Equals(path, "$Vtoc", StringComparison.InvariantCulture)))
|
||||||
return ErrorNumber.NoSuchExtendedAttribute;
|
return ErrorNumber.NoSuchExtendedAttribute;
|
||||||
|
|
||||||
if(!_catalogCache.ContainsKey(filename)) return ErrorNumber.NoSuchFile;
|
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;
|
if(!_fileTypeCache.TryGetValue(filename, out byte type)) return ErrorNumber.InvalidArgument;
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ public sealed partial class AppleDOS
|
|||||||
return ErrorNumber.NoError;
|
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;
|
return ErrorNumber.NoSuchExtendedAttribute;
|
||||||
|
|
||||||
if(!_extentCache.TryGetValue(filename, out byte[] ts)) return ErrorNumber.InvalidArgument;
|
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(!_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;
|
return ErrorNumber.NotSupported;
|
||||||
|
|
||||||
var contents = _idToFilename.Select(static kvp => kvp.Value).ToList();
|
var contents = _idToFilename.Select(static kvp => kvp.Value).ToList();
|
||||||
|
|||||||
@@ -208,15 +208,15 @@ public sealed partial class AppleMFS
|
|||||||
|
|
||||||
switch(_debug)
|
switch(_debug)
|
||||||
{
|
{
|
||||||
case true when string.Compare(path, "$", StringComparison.InvariantCulture) == 0:
|
case true when string.Equals(path, "$", StringComparison.InvariantCulture):
|
||||||
file = _directoryBlocks;
|
file = _directoryBlocks;
|
||||||
|
|
||||||
break;
|
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;
|
file = _bootBlocks;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case true when string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0:
|
case true when string.Equals(path, "$Bitmap", StringComparison.InvariantCulture):
|
||||||
file = _blockMapBytes;
|
file = _blockMapBytes;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -292,10 +292,10 @@ public sealed partial class AppleMFS
|
|||||||
|
|
||||||
if(_debug)
|
if(_debug)
|
||||||
{
|
{
|
||||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
if(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0 ||
|
string.Equals(path, "$Bitmap", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
|
string.Equals(path, "$MDB", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
stat = new FileEntryInfo
|
stat = new FileEntryInfo
|
||||||
{
|
{
|
||||||
@@ -305,24 +305,24 @@ public sealed partial class AppleMFS
|
|||||||
Attributes = FileAttributes.System
|
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.Blocks = _directoryBlocks.Length / stat.BlockSize + _directoryBlocks.Length % stat.BlockSize;
|
||||||
|
|
||||||
stat.Length = _directoryBlocks.Length;
|
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.Blocks = _blockMapBytes.Length / stat.BlockSize + _blockMapBytes.Length % stat.BlockSize;
|
||||||
|
|
||||||
stat.Length = _blockMapBytes.Length;
|
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.Blocks = _bootBlocks.Length / stat.BlockSize + _bootBlocks.Length % stat.BlockSize;
|
||||||
stat.Length = _bootBlocks.Length;
|
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.Blocks = _mdbBlocks.Length / stat.BlockSize + _mdbBlocks.Length % stat.BlockSize;
|
||||||
stat.Length = _mdbBlocks.Length;
|
stat.Length = _mdbBlocks.Length;
|
||||||
|
|||||||
@@ -60,10 +60,10 @@ public sealed partial class AppleMFS
|
|||||||
|
|
||||||
if(_debug)
|
if(_debug)
|
||||||
{
|
{
|
||||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
if(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0 ||
|
string.Equals(path, "$Bitmap", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
|
string.Equals(path, "$MDB", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSonyTag))
|
if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSonyTag))
|
||||||
xattrs.Add("com.apple.macintosh.tags");
|
xattrs.Add("com.apple.macintosh.tags");
|
||||||
@@ -107,15 +107,15 @@ public sealed partial class AppleMFS
|
|||||||
|
|
||||||
if(_debug)
|
if(_debug)
|
||||||
{
|
{
|
||||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
if(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0 ||
|
string.Equals(path, "$Bitmap", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
string.Equals(path, "$Boot", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
|
string.Equals(path, "$MDB", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSonyTag) &&
|
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];
|
buf = new byte[_directoryTags.Length];
|
||||||
Array.Copy(_directoryTags, 0, buf, 0, buf.Length);
|
Array.Copy(_directoryTags, 0, buf, 0, buf.Length);
|
||||||
@@ -123,7 +123,7 @@ public sealed partial class AppleMFS
|
|||||||
return ErrorNumber.NoError;
|
return ErrorNumber.NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0)
|
if(string.Equals(path, "$Bitmap", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
buf = new byte[_bitmapTags.Length];
|
buf = new byte[_bitmapTags.Length];
|
||||||
Array.Copy(_bitmapTags, 0, buf, 0, buf.Length);
|
Array.Copy(_bitmapTags, 0, buf, 0, buf.Length);
|
||||||
@@ -131,7 +131,7 @@ public sealed partial class AppleMFS
|
|||||||
return ErrorNumber.NoError;
|
return ErrorNumber.NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0)
|
if(string.Equals(path, "$Boot", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
buf = new byte[_bootTags.Length];
|
buf = new byte[_bootTags.Length];
|
||||||
Array.Copy(_bootTags, 0, buf, 0, buf.Length);
|
Array.Copy(_bootTags, 0, buf, 0, buf.Length);
|
||||||
@@ -139,7 +139,7 @@ public sealed partial class AppleMFS
|
|||||||
return ErrorNumber.NoError;
|
return ErrorNumber.NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
|
if(string.Equals(path, "$MDB", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
buf = new byte[_mdbTags.Length];
|
buf = new byte[_mdbTags.Length];
|
||||||
Array.Copy(_mdbTags, 0, buf, 0, buf.Length);
|
Array.Copy(_mdbTags, 0, buf, 0, buf.Length);
|
||||||
@@ -160,17 +160,17 @@ public sealed partial class AppleMFS
|
|||||||
|
|
||||||
switch(entry.flRLgLen)
|
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);
|
error = ReadFile(path, out buf, true, false);
|
||||||
|
|
||||||
return error;
|
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);
|
error = ReadFile(path, out buf, true, true);
|
||||||
|
|
||||||
return error;
|
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);
|
buf = Marshal.StructureToByteArrayBigEndian(entry.flUsrWds);
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ public sealed partial class AppleMFS
|
|||||||
|
|
||||||
if(!_debug ||
|
if(!_debug ||
|
||||||
!_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSonyTag) ||
|
!_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;
|
return ErrorNumber.NoSuchExtendedAttribute;
|
||||||
|
|
||||||
error = ReadFile(path, out buf, false, true);
|
error = ReadFile(path, out buf, false, true);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public sealed partial class CBM
|
|||||||
|
|
||||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
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;
|
return ErrorNumber.NotSupported;
|
||||||
|
|
||||||
var contents = _cache.Keys.ToList();
|
var contents = _cache.Keys.ToList();
|
||||||
|
|||||||
@@ -63,14 +63,12 @@ public sealed partial class CPM
|
|||||||
if((entry.statusUser & 0x7F) < 0x20)
|
if((entry.statusUser & 0x7F) < 0x20)
|
||||||
{
|
{
|
||||||
for(var f = 0; f < 8; f++)
|
for(var f = 0; f < 8; f++)
|
||||||
{
|
if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00)
|
||||||
if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00) return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
for(var e = 0; e < 3; e++)
|
for(var e = 0; e < 3; e++)
|
||||||
{
|
if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00)
|
||||||
if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00) return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(entry.filename)) fileCount++;
|
if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(entry.filename)) fileCount++;
|
||||||
}
|
}
|
||||||
@@ -81,14 +79,12 @@ public sealed partial class CPM
|
|||||||
case 0x20:
|
case 0x20:
|
||||||
{
|
{
|
||||||
for(var f = 0; f < 8; f++)
|
for(var f = 0; f < 8; f++)
|
||||||
{
|
if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00)
|
||||||
if(entry.filename[f] < 0x20 && entry.filename[f] != 0x00) return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
for(var e = 0; e < 3; e++)
|
for(var e = 0; e < 3; e++)
|
||||||
{
|
if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00)
|
||||||
if(entry.extension[e] < 0x20 && entry.extension[e] != 0x00) return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
_label = Encoding.ASCII.GetString(directory, off + 1, 11).Trim();
|
_label = Encoding.ASCII.GetString(directory, off + 1, 11).Trim();
|
||||||
_labelCreationDate = new byte[4];
|
_labelCreationDate = new byte[4];
|
||||||
@@ -129,7 +125,7 @@ public sealed partial class CPM
|
|||||||
|
|
||||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
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;
|
return ErrorNumber.NotSupported;
|
||||||
|
|
||||||
node = new CpmDirNode
|
node = new CpmDirNode
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public sealed partial class CPM
|
|||||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||||
|
|
||||||
if(string.IsNullOrEmpty(pathElements[0]) ||
|
if(string.IsNullOrEmpty(pathElements[0]) ||
|
||||||
string.Compare(pathElements[0], "/", StringComparison.OrdinalIgnoreCase) == 0)
|
string.Equals(pathElements[0], "/", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
attributes = new FileAttributes();
|
attributes = new FileAttributes();
|
||||||
attributes = FileAttributes.Directory;
|
attributes = FileAttributes.Directory;
|
||||||
@@ -144,7 +144,7 @@ public sealed partial class CPM
|
|||||||
|
|
||||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
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)
|
return _statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out stat)
|
||||||
? ErrorNumber.NoError
|
? ErrorNumber.NoError
|
||||||
|
|||||||
@@ -936,7 +936,7 @@ public sealed partial class CPM
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Head changes after every track
|
// 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];
|
_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
|
// Head changes after whole side
|
||||||
else if(string.Compare(def.order,
|
else if(string.Equals(def.order, "CYLINDERS", StringComparison.InvariantCultureIgnoreCase))
|
||||||
"CYLINDERS",
|
|
||||||
StringComparison.InvariantCultureIgnoreCase) ==
|
|
||||||
0)
|
|
||||||
{
|
{
|
||||||
for(var m = 0; m < def.side1.sectorIds.Length; m++)
|
for(var m = 0; m < def.side1.sectorIds.Length; m++)
|
||||||
_sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
|
_sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
|
||||||
@@ -972,10 +969,7 @@ public sealed partial class CPM
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement COLUMBIA ordering
|
// TODO: Implement COLUMBIA ordering
|
||||||
else if(string.Compare(def.order,
|
else if(string.Equals(def.order, "COLUMBIA", StringComparison.InvariantCultureIgnoreCase))
|
||||||
"COLUMBIA",
|
|
||||||
StringComparison.InvariantCultureIgnoreCase) ==
|
|
||||||
0)
|
|
||||||
{
|
{
|
||||||
AaruLogging.Debug(MODULE_NAME,
|
AaruLogging.Debug(MODULE_NAME,
|
||||||
Localization
|
Localization
|
||||||
@@ -985,8 +979,7 @@ public sealed partial class CPM
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement EAGLE ordering
|
// TODO: Implement EAGLE ordering
|
||||||
else if(string.Compare(def.order, "EAGLE", StringComparison.InvariantCultureIgnoreCase) ==
|
else if(string.Equals(def.order, "EAGLE", StringComparison.InvariantCultureIgnoreCase))
|
||||||
0)
|
|
||||||
{
|
{
|
||||||
AaruLogging.Debug(MODULE_NAME,
|
AaruLogging.Debug(MODULE_NAME,
|
||||||
Localization
|
Localization
|
||||||
@@ -1033,8 +1026,9 @@ public sealed partial class CPM
|
|||||||
|
|
||||||
// Complement of the directory bytes if needed
|
// Complement of the directory bytes if needed
|
||||||
if(def.complement)
|
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
|
// Check the directory
|
||||||
if(CheckDir(directory))
|
if(CheckDir(directory))
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public sealed partial class CPM
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Head changes after every track
|
// 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 +
|
_sectorMask = new int[_workingDefinition.side1.sectorIds.Length +
|
||||||
_workingDefinition.side2.sectorIds.Length];
|
_workingDefinition.side2.sectorIds.Length];
|
||||||
@@ -94,10 +94,7 @@ public sealed partial class CPM
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Head changes after whole side
|
// Head changes after whole side
|
||||||
else if(string.Compare(_workingDefinition.order,
|
else if(string.Equals(_workingDefinition.order, "CYLINDERS", StringComparison.InvariantCultureIgnoreCase))
|
||||||
"CYLINDERS",
|
|
||||||
StringComparison.InvariantCultureIgnoreCase) ==
|
|
||||||
0)
|
|
||||||
{
|
{
|
||||||
for(var m = 0; m < _workingDefinition.side1.sectorIds.Length; m++)
|
for(var m = 0; m < _workingDefinition.side1.sectorIds.Length; m++)
|
||||||
_sectorMask[m] = _workingDefinition.side1.sectorIds[m] - _workingDefinition.side1.sectorIds[0];
|
_sectorMask[m] = _workingDefinition.side1.sectorIds[m] - _workingDefinition.side1.sectorIds[0];
|
||||||
@@ -119,8 +116,7 @@ public sealed partial class CPM
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement COLUMBIA ordering
|
// TODO: Implement COLUMBIA ordering
|
||||||
else if(string.Compare(_workingDefinition.order, "COLUMBIA", StringComparison.InvariantCultureIgnoreCase) ==
|
else if(string.Equals(_workingDefinition.order, "COLUMBIA", StringComparison.InvariantCultureIgnoreCase))
|
||||||
0)
|
|
||||||
{
|
{
|
||||||
AaruLogging.Debug(MODULE_NAME,
|
AaruLogging.Debug(MODULE_NAME,
|
||||||
Localization
|
Localization
|
||||||
@@ -130,7 +126,7 @@ public sealed partial class CPM
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement EAGLE ordering
|
// 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,
|
AaruLogging.Debug(MODULE_NAME,
|
||||||
Localization
|
Localization
|
||||||
@@ -152,7 +148,7 @@ public sealed partial class CPM
|
|||||||
Dictionary<ulong, byte[]> deinterleavedSectors = new();
|
Dictionary<ulong, byte[]> deinterleavedSectors = new();
|
||||||
|
|
||||||
if(_workingDefinition.sides == 1 ||
|
if(_workingDefinition.sides == 1 ||
|
||||||
string.Compare(_workingDefinition.order, "SIDES", StringComparison.InvariantCultureIgnoreCase) == 0)
|
string.Equals(_workingDefinition.order, "SIDES", StringComparison.InvariantCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
AaruLogging.Debug(MODULE_NAME, Localization.Deinterleaving_whole_volume);
|
AaruLogging.Debug(MODULE_NAME, Localization.Deinterleaving_whole_volume);
|
||||||
|
|
||||||
@@ -169,8 +165,9 @@ public sealed partial class CPM
|
|||||||
if(errno != ErrorNumber.NoError) return errno;
|
if(errno != ErrorNumber.NoError) return errno;
|
||||||
|
|
||||||
if(_workingDefinition.complement)
|
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);
|
deinterleavedSectors.Add((ulong)p, readSector);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,11 +51,12 @@ public sealed partial class CPM
|
|||||||
|
|
||||||
if(!_fileCache.ContainsKey(pathElements[0].ToUpperInvariant())) return ErrorNumber.NoSuchFile;
|
if(!_fileCache.ContainsKey(pathElements[0].ToUpperInvariant())) return ErrorNumber.NoSuchFile;
|
||||||
|
|
||||||
if(string.Compare(xattr, "com.caldera.cpm.password", StringComparison.InvariantCulture) == 0)
|
if(string.Equals(xattr, "com.caldera.cpm.password", StringComparison.InvariantCulture))
|
||||||
if(!_passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf))
|
{
|
||||||
return ErrorNumber.NoError;
|
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 ErrorNumber.NoSuchExtendedAttribute;
|
||||||
|
|
||||||
return !_passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf)
|
return !_passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf)
|
||||||
|
|||||||
@@ -105,9 +105,8 @@ public sealed partial class LisaFS
|
|||||||
if(!_mounted || !_debug) return ErrorNumber.AccessDenied;
|
if(!_mounted || !_debug) return ErrorNumber.AccessDenied;
|
||||||
|
|
||||||
if(fileId is > 4 or <= 0)
|
if(fileId is > 4 or <= 0)
|
||||||
{
|
if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED)
|
||||||
if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) return ErrorNumber.InvalidArgument;
|
return ErrorNumber.InvalidArgument;
|
||||||
}
|
|
||||||
|
|
||||||
if(_systemFileCache.TryGetValue(fileId, out buf) && !tags) return ErrorNumber.NoError;
|
if(_systemFileCache.TryGetValue(fileId, out buf) && !tags) return ErrorNumber.NoError;
|
||||||
|
|
||||||
@@ -330,9 +329,8 @@ public sealed partial class LisaFS
|
|||||||
if(!tags)
|
if(!tags)
|
||||||
{
|
{
|
||||||
if(_fileSizeCache.TryGetValue(fileId, out int realSize))
|
if(_fileSizeCache.TryGetValue(fileId, out int realSize))
|
||||||
{
|
if(realSize > temp.Length)
|
||||||
if(realSize > temp.Length) AaruLogging.Error(Localization.File_0_gets_truncated, fileId);
|
AaruLogging.Error(Localization.File_0_gets_truncated, fileId);
|
||||||
}
|
|
||||||
|
|
||||||
buf = temp;
|
buf = temp;
|
||||||
|
|
||||||
@@ -368,42 +366,42 @@ public sealed partial class LisaFS
|
|||||||
|
|
||||||
if(_debug && pathElements.Length == 1)
|
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;
|
fileId = (short)FILEID_MDDF;
|
||||||
|
|
||||||
return ErrorNumber.NoError;
|
return ErrorNumber.NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(string.Compare(pathElements[0], "$Boot", StringComparison.InvariantCulture) == 0)
|
if(string.Equals(pathElements[0], "$Boot", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
fileId = FILEID_BOOT_SIGNED;
|
fileId = FILEID_BOOT_SIGNED;
|
||||||
|
|
||||||
return ErrorNumber.NoError;
|
return ErrorNumber.NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(string.Compare(pathElements[0], "$Loader", StringComparison.InvariantCulture) == 0)
|
if(string.Equals(pathElements[0], "$Loader", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
fileId = FILEID_LOADER_SIGNED;
|
fileId = FILEID_LOADER_SIGNED;
|
||||||
|
|
||||||
return ErrorNumber.NoError;
|
return ErrorNumber.NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(string.Compare(pathElements[0], "$Bitmap", StringComparison.InvariantCulture) == 0)
|
if(string.Equals(pathElements[0], "$Bitmap", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
fileId = (short)FILEID_BITMAP;
|
fileId = (short)FILEID_BITMAP;
|
||||||
|
|
||||||
return ErrorNumber.NoError;
|
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;
|
fileId = (short)FILEID_SRECORD;
|
||||||
|
|
||||||
return ErrorNumber.NoError;
|
return ErrorNumber.NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(string.Compare(pathElements[0], "$", StringComparison.InvariantCulture) == 0)
|
if(string.Equals(pathElements[0], "$", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
fileId = DIRID_ROOT;
|
fileId = DIRID_ROOT;
|
||||||
isDir = true;
|
isDir = true;
|
||||||
@@ -421,7 +419,7 @@ public sealed partial class LisaFS
|
|||||||
string filename = StringHandlers.CToString(entry.filename, _encoding);
|
string filename = StringHandlers.CToString(entry.filename, _encoding);
|
||||||
|
|
||||||
// LisaOS is case insensitive
|
// LisaOS is case insensitive
|
||||||
if(string.Compare(wantedFilename, filename, StringComparison.InvariantCultureIgnoreCase) != 0 ||
|
if(!string.Equals(wantedFilename, filename, StringComparison.InvariantCultureIgnoreCase) ||
|
||||||
entry.parentID != fileId)
|
entry.parentID != fileId)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public sealed partial class PascalPlugin
|
|||||||
|
|
||||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
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;
|
return ErrorNumber.NotSupported;
|
||||||
|
|
||||||
List<string> contents = _fileEntries.ConvertAll(ent => StringHandlers.PascalToString(ent.Filename, _encoding));
|
List<string> contents = _fileEntries.ConvertAll(ent => StringHandlers.PascalToString(ent.Filename, _encoding));
|
||||||
|
|||||||
@@ -43,13 +43,12 @@ public sealed partial class PascalPlugin
|
|||||||
{
|
{
|
||||||
entry = new PascalFileEntry();
|
entry = new PascalFileEntry();
|
||||||
|
|
||||||
foreach(PascalFileEntry ent in _fileEntries.Where(ent => string.Compare(path,
|
foreach(PascalFileEntry ent in _fileEntries.Where(ent => string.Equals(path,
|
||||||
StringHandlers
|
StringHandlers
|
||||||
.PascalToString(ent.Filename,
|
.PascalToString(ent.Filename,
|
||||||
_encoding),
|
_encoding),
|
||||||
StringComparison
|
StringComparison
|
||||||
.InvariantCultureIgnoreCase) ==
|
.InvariantCultureIgnoreCase)))
|
||||||
0))
|
|
||||||
{
|
{
|
||||||
entry = ent;
|
entry = ent;
|
||||||
|
|
||||||
@@ -95,9 +94,9 @@ public sealed partial class PascalPlugin
|
|||||||
byte[] file;
|
byte[] file;
|
||||||
|
|
||||||
if(_debug &&
|
if(_debug &&
|
||||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0))
|
string.Equals(path, "$Boot", StringComparison.InvariantCulture)))
|
||||||
file = string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ? _catalogBlocks : _bootBlocks;
|
file = string.Equals(path, "$", StringComparison.InvariantCulture) ? _catalogBlocks : _bootBlocks;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ErrorNumber error = GetFileEntry(path, out PascalFileEntry entry);
|
ErrorNumber error = GetFileEntry(path, out PascalFileEntry entry);
|
||||||
@@ -173,8 +172,8 @@ public sealed partial class PascalPlugin
|
|||||||
|
|
||||||
if(_debug)
|
if(_debug)
|
||||||
{
|
{
|
||||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
if(string.Equals(path, "$", StringComparison.InvariantCulture) ||
|
||||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0)
|
string.Equals(path, "$Boot", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
stat = new FileEntryInfo
|
stat = new FileEntryInfo
|
||||||
{
|
{
|
||||||
@@ -183,7 +182,7 @@ public sealed partial class PascalPlugin
|
|||||||
Links = 1
|
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;
|
stat.Blocks = _catalogBlocks.Length / stat.BlockSize + _catalogBlocks.Length % stat.BlockSize;
|
||||||
|
|
||||||
|
|||||||
@@ -361,9 +361,9 @@ public sealed partial class Alcohol120
|
|||||||
else if(Path.GetExtension(imageFilter.BasePath).Equals(".xmd", StringComparison.InvariantCultureIgnoreCase))
|
else if(Path.GetExtension(imageFilter.BasePath).Equals(".xmd", StringComparison.InvariantCultureIgnoreCase))
|
||||||
alcFile = Path.GetFileNameWithoutExtension(imageFilter.BasePath) + ".xmf";
|
alcFile = Path.GetFileNameWithoutExtension(imageFilter.BasePath) + ".xmf";
|
||||||
}
|
}
|
||||||
else if(string.Compare(alcFile, "*.mdf", StringComparison.InvariantCultureIgnoreCase) == 0)
|
else if(string.Equals(alcFile, "*.mdf", StringComparison.InvariantCultureIgnoreCase))
|
||||||
alcFile = Path.GetFileNameWithoutExtension(imageFilter.BasePath) + ".mdf";
|
alcFile = Path.GetFileNameWithoutExtension(imageFilter.BasePath) + ".mdf";
|
||||||
else if(string.Compare(alcFile, "*.xmf", StringComparison.InvariantCultureIgnoreCase) == 0)
|
else if(string.Equals(alcFile, "*.xmf", StringComparison.InvariantCultureIgnoreCase))
|
||||||
alcFile = Path.GetFileNameWithoutExtension(imageFilter.BasePath) + ".xmf";
|
alcFile = Path.GetFileNameWithoutExtension(imageFilter.BasePath) + ".xmf";
|
||||||
|
|
||||||
if(_header is { bcaLength: > 0, bcaOffset: > 0 } && _isDvd)
|
if(_header is { bcaLength: > 0, bcaOffset: > 0 } && _isDvd)
|
||||||
|
|||||||
@@ -851,10 +851,9 @@ public sealed partial class BlindWrite5
|
|||||||
var lowerCaseFileName = false;
|
var lowerCaseFileName = false;
|
||||||
string basePath;
|
string basePath;
|
||||||
|
|
||||||
bool version5 = string.Compare(Path.GetExtension(imageFilter.Filename),
|
bool version5 = string.Equals(Path.GetExtension(imageFilter.Filename),
|
||||||
".B5T",
|
".B5T",
|
||||||
StringComparison.OrdinalIgnoreCase) ==
|
StringComparison.OrdinalIgnoreCase);
|
||||||
0;
|
|
||||||
|
|
||||||
string firstExtension = version5 ? "B5I" : "B6I";
|
string firstExtension = version5 ? "B5I" : "B6I";
|
||||||
string firstExtensionLower = version5 ? "b5i" : "b6i";
|
string firstExtensionLower = version5 ? "b5i" : "b6i";
|
||||||
@@ -1295,10 +1294,9 @@ public sealed partial class BlindWrite5
|
|||||||
_imageInfo.DriveFirmwareRevision = StringHandlers.CToString(_header.revision);
|
_imageInfo.DriveFirmwareRevision = StringHandlers.CToString(_header.revision);
|
||||||
_imageInfo.Application = "BlindWrite";
|
_imageInfo.Application = "BlindWrite";
|
||||||
|
|
||||||
if(string.Compare(Path.GetExtension(imageFilter.Filename), ".B5T", StringComparison.OrdinalIgnoreCase) == 0)
|
if(string.Equals(Path.GetExtension(imageFilter.Filename), ".B5T", StringComparison.OrdinalIgnoreCase))
|
||||||
_imageInfo.ApplicationVersion = "5";
|
_imageInfo.ApplicationVersion = "5";
|
||||||
else if(string.Compare(Path.GetExtension(imageFilter.Filename), ".B6T", StringComparison.OrdinalIgnoreCase) ==
|
else if(string.Equals(Path.GetExtension(imageFilter.Filename), ".B6T", StringComparison.OrdinalIgnoreCase))
|
||||||
0)
|
|
||||||
_imageInfo.ApplicationVersion = "6";
|
_imageInfo.ApplicationVersion = "6";
|
||||||
|
|
||||||
_imageInfo.Version = "5";
|
_imageInfo.Version = "5";
|
||||||
|
|||||||
@@ -57,8 +57,9 @@ public sealed partial class Cpcdsk
|
|||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
for(pos = 0; pos < 254; pos++)
|
for(pos = 0; pos < 254; pos++)
|
||||||
if(headerB[pos] == 0x0D && headerB[pos + 1] == 0x0A)
|
{
|
||||||
break;
|
if(headerB[pos] == 0x0D && headerB[pos + 1] == 0x0A) break;
|
||||||
|
}
|
||||||
|
|
||||||
if(pos >= 254) return false;
|
if(pos >= 254) return false;
|
||||||
|
|
||||||
@@ -66,9 +67,9 @@ public sealed partial class Cpcdsk
|
|||||||
|
|
||||||
AaruLogging.Debug(MODULE_NAME, Localization.magic_equals_0_quoted, magic);
|
AaruLogging.Debug(MODULE_NAME, Localization.magic_equals_0_quoted, magic);
|
||||||
|
|
||||||
return string.Compare(CPCDSK_ID, magic, StringComparison.InvariantCultureIgnoreCase) == 0 ||
|
return string.Equals(CPCDSK_ID, magic, StringComparison.InvariantCultureIgnoreCase) ||
|
||||||
string.Compare(EDSK_ID, magic, StringComparison.InvariantCultureIgnoreCase) == 0 ||
|
string.Equals(EDSK_ID, magic, StringComparison.InvariantCultureIgnoreCase) ||
|
||||||
string.Compare(DU54_ID, magic, StringComparison.InvariantCultureIgnoreCase) == 0;
|
string.Equals(DU54_ID, magic, StringComparison.InvariantCultureIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -63,9 +63,8 @@ public sealed partial class Cpcdsk
|
|||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
for(pos = 0; pos < 254; pos++)
|
for(pos = 0; pos < 254; pos++)
|
||||||
{
|
if(headerB[pos] == 0x0D && headerB[pos + 1] == 0x0A)
|
||||||
if(headerB[pos] == 0x0D && headerB[pos + 1] == 0x0A) break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
if(pos >= 254) return ErrorNumber.InvalidArgument;
|
if(pos >= 254) return ErrorNumber.InvalidArgument;
|
||||||
|
|
||||||
@@ -76,12 +75,12 @@ public sealed partial class Cpcdsk
|
|||||||
|
|
||||||
DiskInfo header = Marshal.ByteArrayToStructureLittleEndian<DiskInfo>(headerB);
|
DiskInfo header = Marshal.ByteArrayToStructureLittleEndian<DiskInfo>(headerB);
|
||||||
|
|
||||||
if(string.Compare(CPCDSK_ID, magic, StringComparison.InvariantCultureIgnoreCase) != 0 &&
|
if(!string.Equals(CPCDSK_ID, magic, StringComparison.InvariantCultureIgnoreCase) &&
|
||||||
string.Compare(EDSK_ID, magic, StringComparison.InvariantCultureIgnoreCase) != 0 &&
|
!string.Equals(EDSK_ID, magic, StringComparison.InvariantCultureIgnoreCase) &&
|
||||||
string.Compare(DU54_ID, magic, StringComparison.InvariantCultureIgnoreCase) != 0)
|
!string.Equals(DU54_ID, magic, StringComparison.InvariantCultureIgnoreCase))
|
||||||
return ErrorNumber.InvalidArgument;
|
return ErrorNumber.InvalidArgument;
|
||||||
|
|
||||||
_extended = string.Compare(EDSK_ID, magic, StringComparison.InvariantCultureIgnoreCase) == 0;
|
_extended = string.Equals(EDSK_ID, magic, StringComparison.InvariantCultureIgnoreCase);
|
||||||
AaruLogging.Debug(MODULE_NAME, Localization.Extended_equals_0, _extended);
|
AaruLogging.Debug(MODULE_NAME, Localization.Extended_equals_0, _extended);
|
||||||
|
|
||||||
AaruLogging.Debug(MODULE_NAME, Localization.magic_equals_0_quoted, magic);
|
AaruLogging.Debug(MODULE_NAME, Localization.magic_equals_0_quoted, magic);
|
||||||
@@ -133,10 +132,9 @@ public sealed partial class Cpcdsk
|
|||||||
stream.EnsureRead(trackB, 0, 256);
|
stream.EnsureRead(trackB, 0, 256);
|
||||||
TrackInfo trackInfo = Marshal.ByteArrayToStructureLittleEndian<TrackInfo>(trackB);
|
TrackInfo trackInfo = Marshal.ByteArrayToStructureLittleEndian<TrackInfo>(trackB);
|
||||||
|
|
||||||
if(string.Compare(TRACK_ID,
|
if(!string.Equals(TRACK_ID,
|
||||||
Encoding.ASCII.GetString(trackInfo.magic),
|
Encoding.ASCII.GetString(trackInfo.magic),
|
||||||
StringComparison.InvariantCultureIgnoreCase) !=
|
StringComparison.InvariantCultureIgnoreCase))
|
||||||
0)
|
|
||||||
{
|
{
|
||||||
AaruLogging.Error(Localization.Not_the_expected_track_info);
|
AaruLogging.Error(Localization.Not_the_expected_track_info);
|
||||||
|
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ public sealed partial class Vhdx
|
|||||||
|
|
||||||
IFilter parentFilter;
|
IFilter parentFilter;
|
||||||
|
|
||||||
if(string.Compare(entryType, RELATIVE_PATH_KEY, StringComparison.OrdinalIgnoreCase) == 0)
|
if(string.Equals(entryType, RELATIVE_PATH_KEY, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
stream.Seek(parentEntry.valueOffset + _metadataOffset, SeekOrigin.Begin);
|
stream.Seek(parentEntry.valueOffset + _metadataOffset, SeekOrigin.Begin);
|
||||||
var tmpVal = new byte[parentEntry.valueLength];
|
var tmpVal = new byte[parentEntry.valueLength];
|
||||||
@@ -338,8 +338,8 @@ public sealed partial class Vhdx
|
|||||||
SentrySdk.CaptureException(ex);
|
SentrySdk.CaptureException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(string.Compare(entryType, VOLUME_PATH_KEY, StringComparison.OrdinalIgnoreCase) == 0 ||
|
else if(string.Equals(entryType, VOLUME_PATH_KEY, StringComparison.OrdinalIgnoreCase) ||
|
||||||
string.Compare(entryType, ABSOLUTE_WIN32_PATH_KEY, StringComparison.OrdinalIgnoreCase) == 0)
|
string.Equals(entryType, ABSOLUTE_WIN32_PATH_KEY, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
stream.Seek(parentEntry.valueOffset + _metadataOffset, SeekOrigin.Begin);
|
stream.Seek(parentEntry.valueOffset + _metadataOffset, SeekOrigin.Begin);
|
||||||
var tmpVal = new byte[parentEntry.valueLength];
|
var tmpVal = new byte[parentEntry.valueLength];
|
||||||
|
|||||||
Reference in New Issue
Block a user