1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:17:23 +08:00

Use string.Starts-/EndsWith char overloads

This commit is contained in:
Berkan Diler 2020-10-16 11:27:02 +02:00
parent 829241a9f0
commit cc11283143
3 changed files with 6 additions and 6 deletions

View File

@ -593,7 +593,7 @@ namespace osu.Game.Database
var fileInfos = new List<TFileModel>();
string prefix = reader.Filenames.GetCommonPrefix();
if (!(prefix.EndsWith("/", StringComparison.Ordinal) || prefix.EndsWith("\\", StringComparison.Ordinal)))
if (!(prefix.EndsWith('/') || prefix.EndsWith('\\')))
prefix = string.Empty;
// import files to manager

View File

@ -181,7 +181,7 @@ namespace osu.Game
if (args?.Length > 0)
{
var paths = args.Where(a => !a.StartsWith(@"-", StringComparison.Ordinal)).ToArray();
var paths = args.Where(a => !a.StartsWith('-')).ToArray();
if (paths.Length > 0)
Task.Run(() => Import(paths));
}
@ -289,7 +289,7 @@ namespace osu.Game
public void OpenUrlExternally(string url) => waitForReady(() => externalLinkOpener, _ =>
{
if (url.StartsWith("/", StringComparison.Ordinal))
if (url.StartsWith('/'))
url = $"{API.Endpoint}{url}";
externalLinkOpener.OpenUrlExternally(url);

View File

@ -80,9 +80,9 @@ namespace osu.Game.Screens.Select
private static int getLengthScale(string value) =>
value.EndsWith("ms", StringComparison.Ordinal) ? 1 :
value.EndsWith("s", StringComparison.Ordinal) ? 1000 :
value.EndsWith("m", StringComparison.Ordinal) ? 60000 :
value.EndsWith("h", StringComparison.Ordinal) ? 3600000 : 1000;
value.EndsWith('s') ? 1000 :
value.EndsWith('m') ? 60000 :
value.EndsWith('h') ? 3600000 : 1000;
private static bool parseFloatWithPoint(string value, out float result) =>
float.TryParse(value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out result);