mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Use range indexers.
This commit is contained in:
@@ -73,7 +73,7 @@ public sealed partial class FAT
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
string cutPath = path.StartsWith("/", StringComparison.Ordinal) ? path.Substring(1).ToLower(_cultureInfo)
|
||||
string cutPath = path.StartsWith("/", StringComparison.Ordinal) ? path[1..].ToLower(_cultureInfo)
|
||||
: path.ToLower(_cultureInfo);
|
||||
|
||||
if(_directoryCache.TryGetValue(cutPath, out Dictionary<string, CompleteDirectoryEntry> currentDirectory))
|
||||
@@ -366,9 +366,8 @@ public sealed partial class FAT
|
||||
foreach(KeyValuePair<string, CompleteDirectoryEntry> sidecar in fat32EaSidecars)
|
||||
{
|
||||
// No real file this sidecar accompanies
|
||||
if(!currentDirectory.
|
||||
TryGetValue(sidecar.Key.Substring(0, sidecar.Key.Length - FAT32_EA_TAIL.Length),
|
||||
out CompleteDirectoryEntry fileWithEa))
|
||||
if(!currentDirectory.TryGetValue(sidecar.Key[..^FAT32_EA_TAIL.Length],
|
||||
out CompleteDirectoryEntry fileWithEa))
|
||||
continue;
|
||||
|
||||
// If not in debug mode we will consider the lack of EA bitflags to mean the EAs are corrupted or not real
|
||||
|
||||
@@ -293,7 +293,7 @@ public sealed partial class FAT
|
||||
{
|
||||
entry = null;
|
||||
|
||||
string cutPath = path.StartsWith('/') ? path.Substring(1).ToLower(_cultureInfo) : path.ToLower(_cultureInfo);
|
||||
string cutPath = path.StartsWith('/') ? path[1..].ToLower(_cultureInfo) : path.ToLower(_cultureInfo);
|
||||
|
||||
string[] pieces = cutPath.Split(new[]
|
||||
{
|
||||
|
||||
@@ -1050,7 +1050,7 @@ public sealed partial class FAT
|
||||
foreach(KeyValuePair<string, CompleteDirectoryEntry> sidecar in fat32EaSidecars)
|
||||
{
|
||||
// No real file this sidecar accompanies
|
||||
if(!_rootDirectoryCache.TryGetValue(sidecar.Key.Substring(0, sidecar.Key.Length - FAT32_EA_TAIL.Length),
|
||||
if(!_rootDirectoryCache.TryGetValue(sidecar.Key[..^FAT32_EA_TAIL.Length],
|
||||
out CompleteDirectoryEntry fileWithEa))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public sealed partial class FAT
|
||||
return ErrorNumber.NotSupported;
|
||||
|
||||
if(path[0] == '/')
|
||||
path = path.Substring(1);
|
||||
path = path[1..];
|
||||
|
||||
if(_eaCache.TryGetValue(path.ToLower(_cultureInfo), out Dictionary<string, byte[]> eas))
|
||||
{
|
||||
@@ -111,7 +111,7 @@ public sealed partial class FAT
|
||||
return err;
|
||||
|
||||
if(path[0] == '/')
|
||||
path = path.Substring(1);
|
||||
path = path[1..];
|
||||
|
||||
if(!xattrs.Contains(xattr.ToLower(_cultureInfo)))
|
||||
return ErrorNumber.NoSuchExtendedAttribute;
|
||||
|
||||
Reference in New Issue
Block a user