mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 01:42:55 +08:00
Use string.Starts-/EndsWith char overloads
This commit is contained in:
parent
829241a9f0
commit
cc11283143
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user