Use range indexers.

This commit is contained in:
2022-11-14 01:15:06 +00:00
parent e0508f096c
commit 6a4dea75ea
23 changed files with 65 additions and 64 deletions

View File

@@ -211,10 +211,10 @@ public class BZip2 : IFilter
get
{
if(BasePath?.EndsWith(".bz2", StringComparison.InvariantCultureIgnoreCase) == true)
return BasePath.Substring(0, BasePath.Length - 4);
return BasePath[..^4];
return BasePath?.EndsWith(".bzip2", StringComparison.InvariantCultureIgnoreCase) == true
? BasePath.Substring(0, BasePath.Length - 6) : BasePath;
return BasePath?.EndsWith(".bzip2", StringComparison.InvariantCultureIgnoreCase) == true ? BasePath[..^6]
: BasePath;
}
}

View File

@@ -210,10 +210,10 @@ public sealed class GZip : IFilter
get
{
if(BasePath?.EndsWith(".gz", StringComparison.InvariantCultureIgnoreCase) == true)
return BasePath.Substring(0, BasePath.Length - 3);
return BasePath[..^3];
return BasePath?.EndsWith(".gzip", StringComparison.InvariantCultureIgnoreCase) == true
? BasePath.Substring(0, BasePath.Length - 5) : BasePath;
return BasePath?.EndsWith(".gzip", StringComparison.InvariantCultureIgnoreCase) == true ? BasePath[..^5]
: BasePath;
}
}

View File

@@ -179,10 +179,10 @@ public sealed class LZip : IFilter
get
{
if(BasePath?.EndsWith(".lz", StringComparison.InvariantCultureIgnoreCase) == true)
return BasePath.Substring(0, BasePath.Length - 3);
return BasePath[..^3];
return BasePath?.EndsWith(".lzip", StringComparison.InvariantCultureIgnoreCase) == true
? BasePath.Substring(0, BasePath.Length - 5) : BasePath;
return BasePath?.EndsWith(".lzip", StringComparison.InvariantCultureIgnoreCase) == true ? BasePath[..^5]
: BasePath;
}
}

View File

@@ -184,10 +184,10 @@ public sealed class XZ : IFilter
get
{
if(BasePath?.EndsWith(".xz", StringComparison.InvariantCultureIgnoreCase) == true)
return BasePath.Substring(0, BasePath.Length - 3);
return BasePath[..^3];
return BasePath?.EndsWith(".xzip", StringComparison.InvariantCultureIgnoreCase) == true
? BasePath.Substring(0, BasePath.Length - 5) : BasePath;
return BasePath?.EndsWith(".xzip", StringComparison.InvariantCultureIgnoreCase) == true ? BasePath[..^5]
: BasePath;
}
}