Add missing string function ordinal specifications

This commit is contained in:
Dean Herbert 2020-10-16 12:49:31 +09:00
parent 39a74536f2
commit cc41845f56
6 changed files with 13 additions and 12 deletions

View File

@ -234,7 +234,7 @@ private void reset(bool loadLastResults = false)
if (string.IsNullOrEmpty(line)) if (string.IsNullOrEmpty(line))
continue; continue;
if (line.ToUpperInvariant().StartsWith("GROUP")) if (line.ToUpperInvariant().StartsWith("GROUP", StringComparison.Ordinal))
continue; continue;
// ReSharper disable once AccessToModifiedClosure // ReSharper disable once AccessToModifiedClosure

View File

@ -92,7 +92,7 @@ protected void HandleColours<TModel>(TModel output, string line)
{ {
var pair = SplitKeyVal(line); var pair = SplitKeyVal(line);
bool isCombo = pair.Key.StartsWith(@"Combo"); bool isCombo = pair.Key.StartsWith(@"Combo", StringComparison.Ordinal);
string[] split = pair.Value.Split(','); string[] split = pair.Value.Split(',');

View File

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

View File

@ -100,7 +100,7 @@ private void addMissingRulesets()
{ {
// todo: StartsWith can be changed to Equals on 2020-11-08 // todo: StartsWith can be changed to Equals on 2020-11-08
// This is to give users enough time to have their database use new abbreviated info). // This is to give users enough time to have their database use new abbreviated info).
if (context.RulesetInfo.FirstOrDefault(ri => ri.InstantiationInfo.StartsWith(r.RulesetInfo.InstantiationInfo)) == null) if (context.RulesetInfo.FirstOrDefault(ri => ri.InstantiationInfo.StartsWith(r.RulesetInfo.InstantiationInfo, StringComparison.Ordinal)) == null)
context.RulesetInfo.Add(r.RulesetInfo); context.RulesetInfo.Add(r.RulesetInfo);
} }

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
@ -115,16 +116,16 @@ private void flushPendingLines()
currentConfig.MinimumColumnWidth = minWidth; currentConfig.MinimumColumnWidth = minWidth;
break; break;
case string _ when pair.Key.StartsWith("Colour"): case string _ when pair.Key.StartsWith("Colour", StringComparison.Ordinal):
HandleColours(currentConfig, line); HandleColours(currentConfig, line);
break; break;
// Custom sprite paths // Custom sprite paths
case string _ when pair.Key.StartsWith("NoteImage"): case string _ when pair.Key.StartsWith("NoteImage", StringComparison.Ordinal):
case string _ when pair.Key.StartsWith("KeyImage"): case string _ when pair.Key.StartsWith("KeyImage", StringComparison.Ordinal):
case string _ when pair.Key.StartsWith("Hit"): case string _ when pair.Key.StartsWith("Hit", StringComparison.Ordinal):
case string _ when pair.Key.StartsWith("Stage"): case string _ when pair.Key.StartsWith("Stage", StringComparison.Ordinal):
case string _ when pair.Key.StartsWith("Lighting"): case string _ when pair.Key.StartsWith("Lighting", StringComparison.Ordinal):
currentConfig.ImageLookups[pair.Key] = pair.Value; currentConfig.ImageLookups[pair.Key] = pair.Value;
break; break;
} }

View File

@ -45,7 +45,7 @@ public SentryLogger(OsuGame game)
// since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports. // since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports.
if (lastException != null && if (lastException != null &&
lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace)) lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace, StringComparison.Ordinal))
return; return;
lastException = exception; lastException = exception;