mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge pull request #18834 from bdach/ban-implicit-to-lower-upper
Disallow usage of `string.To{Upper,Lower}()` without explicit culture
This commit is contained in:
@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
|
||||
};
|
||||
favouriteRequest.Failure += e =>
|
||||
{
|
||||
Logger.Error(e, $"Failed to {actionType.ToString().ToLower()} beatmap: {e.Message}");
|
||||
Logger.Error(e, $"Failed to {actionType.ToString().ToLowerInvariant()} beatmap: {e.Message}");
|
||||
Enabled.Value = true;
|
||||
};
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Database
|
||||
/// <summary>
|
||||
/// A user displayable name for the model type associated with this manager.
|
||||
/// </summary>
|
||||
string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLower()}";
|
||||
string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLowerInvariant()}";
|
||||
|
||||
/// <summary>
|
||||
/// Fired when the user requests to view the resulting import.
|
||||
|
@ -201,6 +201,6 @@ namespace osu.Game.Database
|
||||
|
||||
public Action<Notification>? PostNotification { get; set; }
|
||||
|
||||
public virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLower()}";
|
||||
public virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLowerInvariant()}";
|
||||
}
|
||||
}
|
||||
|
@ -549,6 +549,6 @@ namespace osu.Game.Database
|
||||
yield return f.Filename;
|
||||
}
|
||||
|
||||
public virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLower()}";
|
||||
public virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLowerInvariant()}";
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Online.API.Requests
|
||||
var req = base.CreateWebRequest();
|
||||
|
||||
req.AddParameter("spotlight", spotlight.ToString());
|
||||
req.AddParameter("filter", sort.ToString().ToLower());
|
||||
req.AddParameter("filter", sort.ToString().ToLowerInvariant());
|
||||
|
||||
return req;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Online.API.Requests
|
||||
Ruleset = ruleset;
|
||||
}
|
||||
|
||||
protected override string Target => Lookup != null ? $@"users/{Lookup}/{Ruleset?.ShortName}?key={lookupType.ToString().ToLower()}" : $@"me/{Ruleset?.ShortName}";
|
||||
protected override string Target => Lookup != null ? $@"users/{Lookup}/{Ruleset?.ShortName}?key={lookupType.ToString().ToLowerInvariant()}" : $@"me/{Ruleset?.ShortName}";
|
||||
|
||||
private enum LookupType
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Text = @"your personal best".ToUpper(),
|
||||
Text = @"your personal best".ToUpperInvariant(),
|
||||
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold),
|
||||
},
|
||||
scoreContainer = new Container
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -79,7 +80,7 @@ namespace osu.Game.Overlays.Chat
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Text = time.ToLocalTime().ToString("dd MMMM yyyy").ToUpper(),
|
||||
Text = time.ToLocalTime().ToLocalisableString(@"dd MMMM yyyy").ToUpper(),
|
||||
Font = OsuFont.Torus.With(size: TextSize, weight: FontWeight.SemiBold),
|
||||
Colour = colourProvider?.Content1 ?? Colour4.White,
|
||||
},
|
||||
|
@ -7,6 +7,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
@ -146,7 +147,7 @@ namespace osu.Game.Overlays.News
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = date.ToString("d MMM yyyy").ToUpper(),
|
||||
Text = date.ToLocalisableString(@"d MMM yyyy").ToUpper(),
|
||||
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold),
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
|
@ -109,15 +109,15 @@ namespace osu.Game.Overlays
|
||||
: base(value)
|
||||
{
|
||||
if (!(Value is Enum enumValue))
|
||||
Text.Text = Value.ToString().ToLower();
|
||||
Text.Text = Value.ToString().ToLowerInvariant();
|
||||
else
|
||||
{
|
||||
var localisableDescription = enumValue.GetLocalisableDescription();
|
||||
string nonLocalisableDescription = enumValue.GetDescription();
|
||||
|
||||
// If localisable == non-localisable, then we must have a basic string, so .ToLower() is used.
|
||||
// If localisable == non-localisable, then we must have a basic string, so .ToLowerInvariant() is used.
|
||||
Text.Text = localisableDescription.Equals(nonLocalisableDescription)
|
||||
? nonLocalisableDescription.ToLower()
|
||||
? nonLocalisableDescription.ToLowerInvariant()
|
||||
: localisableDescription;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
if (edgeType == EdgeType.None)
|
||||
yield break;
|
||||
|
||||
string postfix = hitObject is IHasDuration ? edgeType.ToString().ToLower() : null;
|
||||
string postfix = hitObject is IHasDuration ? edgeType.ToString().ToLowerInvariant() : null;
|
||||
|
||||
if (maxVolume <= muted_threshold)
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
}
|
||||
}
|
||||
|
||||
private bool hasAudioExtension(string filename) => audioExtensions.Any(filename.ToLower().EndsWith);
|
||||
private bool hasAudioExtension(string filename) => audioExtensions.Any(filename.ToLowerInvariant().EndsWith);
|
||||
private bool probablyHasAudioData(Stream data) => data.Length > min_bytes_threshold;
|
||||
|
||||
public class IssueTemplateTooShort : IssueTemplate
|
||||
|
@ -135,7 +135,7 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
|
||||
new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12),
|
||||
Text = title.ToUpper(),
|
||||
Text = title.ToUpperInvariant(),
|
||||
},
|
||||
content = new Container
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
foreach (Match match in query_syntax_regex.Matches(query))
|
||||
{
|
||||
string key = match.Groups["key"].Value.ToLower();
|
||||
string key = match.Groups["key"].Value.ToLowerInvariant();
|
||||
var op = parseOperator(match.Groups["op"].Value);
|
||||
string value = match.Groups["value"].Value;
|
||||
|
||||
|
Reference in New Issue
Block a user