Use range indexers.

This commit is contained in:
2024-11-12 06:46:45 +00:00
parent 3522fe3028
commit 7e94ea0a4d
2 changed files with 4 additions and 4 deletions

View File

@@ -348,7 +348,7 @@ public class Vfs : IDisposable
internal CachedDisk GetDisk(ulong machineId, string name)
{
if(name.EndsWith(".chd", StringComparison.OrdinalIgnoreCase)) name = name.Substring(0, name.Length - 4);
if(name.EndsWith(".chd", StringComparison.OrdinalIgnoreCase)) name = name[..^4];
ConcurrentDictionary<string, CachedDisk> cachedDisks = GetDisksFromMachine(machineId);
@@ -359,7 +359,7 @@ public class Vfs : IDisposable
internal CachedMedia GetMedia(ulong machineId, string name)
{
if(name.EndsWith(".aif", StringComparison.OrdinalIgnoreCase)) name = name.Substring(0, name.Length - 4);
if(name.EndsWith(".aif", StringComparison.OrdinalIgnoreCase)) name = name[..^4];
ConcurrentDictionary<string, CachedMedia> cachedMedias = GetMediasFromMachine(machineId);

View File

@@ -133,7 +133,7 @@ public class FileExporter
});
if(machineName.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase))
machineName = machineName.Substring(0, machineName.Length - 4);
machineName = machineName[..^4];
string machinePath = Path.Combine(_outPath, machineName);
@@ -338,7 +338,7 @@ public class FileExporter
});
if(machineName.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase))
machineName = machineName.Substring(0, machineName.Length - 4);
machineName = machineName[..^4];
string machinePath = Path.Combine(_outPath, machineName);