mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 15:03:13 +08:00
Replace calls to defective Humanizer methods with correct version
This commit is contained in:
parent
ffa9a83a4f
commit
6f37487528
@ -19,3 +19,7 @@ P:System.Threading.Tasks.Task`1.Result;Don't use Task.Result. Use Task.GetResult
|
||||
M:System.Threading.ManualResetEventSlim.Wait();Specify a timeout to avoid waiting forever.
|
||||
M:System.String.ToLower();string.ToLower() changes behaviour depending on CultureInfo.CurrentCulture. Use string.ToLowerInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture or use LocalisableString.
|
||||
M:System.String.ToUpper();string.ToUpper() changes behaviour depending on CultureInfo.CurrentCulture. Use string.ToUpperInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture or use LocalisableString.
|
||||
M:Humanizer.InflectorExtensions.Pascalize(System.String);Humanizer's .Pascalize() extension method changes behaviour depending on CultureInfo.CurrentCulture. Use StringDehumanizeExtensions.ToPascalCase() instead.
|
||||
M:Humanizer.InflectorExtensions.Camelize(System.String);Humanizer's .Camelize() extension method changes behaviour depending on CultureInfo.CurrentCulture. Use StringDehumanizeExtensions.ToCamelCase() instead.
|
||||
M:Humanizer.InflectorExtensions.Underscore(System.String);Humanizer's .Underscore() extension method changes behaviour depending on CultureInfo.CurrentCulture. Use StringDehumanizeExtensions.ToSnakeCase() instead.
|
||||
M:Humanizer.InflectorExtensions.Kebaberize(System.String);Humanizer's .Kebaberize() extension method changes behaviour depending on CultureInfo.CurrentCulture. Use StringDehumanizeExtensions.ToKebabCase() instead.
|
||||
|
@ -4,13 +4,13 @@
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using Humanizer;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays;
|
||||
@ -77,7 +77,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
};
|
||||
|
||||
control.Query.BindValueChanged(q => query.Text = $"Query: {q.NewValue}", true);
|
||||
control.General.BindCollectionChanged((_, _) => general.Text = $"General: {(control.General.Any() ? string.Join('.', control.General.Select(i => i.ToString().Underscore())) : "")}", true);
|
||||
control.General.BindCollectionChanged((_, _) => general.Text = $"General: {(control.General.Any() ? string.Join('.', control.General.Select(i => i.ToString().ToSnakeCase())) : "")}", true);
|
||||
control.Ruleset.BindValueChanged(r => ruleset.Text = $"Ruleset: {r.NewValue}", true);
|
||||
control.Category.BindValueChanged(c => category.Text = $"Category: {c.NewValue}", true);
|
||||
control.Genre.BindValueChanged(g => genre.Text = $"Genre: {g.NewValue}", true);
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Humanizer;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Extensions;
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
@ -25,7 +25,7 @@ namespace osu.Game.Beatmaps
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Texture = textures.Get($"Icons/BeatmapDetails/{iconType.ToString().Kebaberize()}");
|
||||
Texture = textures.Get($"Icons/BeatmapDetails/{iconType.ToString().ToKebabCase()}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
|
||||
using Humanizer;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -67,7 +66,7 @@ namespace osu.Game.Extensions
|
||||
|
||||
foreach (var (_, property) in component.GetSettingsSourceProperties())
|
||||
{
|
||||
if (!info.Settings.TryGetValue(property.Name.Underscore(), out object settingValue))
|
||||
if (!info.Settings.TryGetValue(property.Name.ToSnakeCase(), out object settingValue))
|
||||
continue;
|
||||
|
||||
skinnable.CopyAdjustedSetting((IBindable)property.GetValue(component), settingValue);
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Humanizer;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using osu.Game.Extensions;
|
||||
|
||||
namespace osu.Game.IO.Serialization
|
||||
{
|
||||
@ -12,7 +12,7 @@ namespace osu.Game.IO.Serialization
|
||||
{
|
||||
protected override string ResolvePropertyName(string propertyName)
|
||||
{
|
||||
return propertyName.Underscore();
|
||||
return propertyName.ToSnakeCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,12 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Humanizer;
|
||||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
@ -45,7 +45,7 @@ namespace osu.Game.Online.API
|
||||
var bindable = (IBindable)property.GetValue(mod);
|
||||
|
||||
if (!bindable.IsDefault)
|
||||
Settings.Add(property.Name.Underscore(), bindable.GetUnderlyingSettingValue());
|
||||
Settings.Add(property.Name.ToSnakeCase(), bindable.GetUnderlyingSettingValue());
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ namespace osu.Game.Online.API
|
||||
{
|
||||
foreach (var (_, property) in resultMod.GetSettingsSourceProperties())
|
||||
{
|
||||
if (!Settings.TryGetValue(property.Name.Underscore(), out object settingValue))
|
||||
if (!Settings.TryGetValue(property.Name.ToSnakeCase(), out object settingValue))
|
||||
continue;
|
||||
|
||||
try
|
||||
|
@ -4,7 +4,7 @@
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.IO.Network;
|
||||
using Humanizer;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays.Comments;
|
||||
|
||||
@ -32,7 +32,7 @@ namespace osu.Game.Online.API.Requests
|
||||
var req = base.CreateWebRequest();
|
||||
|
||||
req.AddParameter("commentable_id", commentableId.ToString());
|
||||
req.AddParameter("commentable_type", type.ToString().Underscore().ToLowerInvariant());
|
||||
req.AddParameter("commentable_type", type.ToString().ToSnakeCase().ToLowerInvariant());
|
||||
req.AddParameter("page", page.ToString());
|
||||
req.AddParameter("sort", sort.ToString().ToLowerInvariant());
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Humanizer;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
@ -22,7 +22,7 @@ namespace osu.Game.Online.API.Requests
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().Underscore()}";
|
||||
protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().ToSnakeCase()}";
|
||||
}
|
||||
|
||||
public enum BeatmapSetType
|
||||
|
@ -4,8 +4,8 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using Humanizer;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
@ -21,7 +21,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty]
|
||||
private string type
|
||||
{
|
||||
set => Type = (RecentActivityType)Enum.Parse(typeof(RecentActivityType), value.Pascalize());
|
||||
set => Type = (RecentActivityType)Enum.Parse(typeof(RecentActivityType), value.ToPascalCase());
|
||||
}
|
||||
|
||||
public RecentActivityType Type;
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Humanizer;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.IO.Network;
|
||||
using osu.Game.Extensions;
|
||||
@ -86,7 +85,7 @@ namespace osu.Game.Online.API.Requests
|
||||
req.AddParameter("q", query);
|
||||
|
||||
if (General != null && General.Any())
|
||||
req.AddParameter("c", string.Join('.', General.Select(e => e.ToString().Underscore())));
|
||||
req.AddParameter("c", string.Join('.', General.Select(e => e.ToString().ToSnakeCase())));
|
||||
|
||||
if (ruleset.OnlineID >= 0)
|
||||
req.AddParameter("m", ruleset.OnlineID.ToString());
|
||||
|
@ -4,8 +4,8 @@
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Humanizer;
|
||||
using osu.Framework.IO.Network;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
||||
|
||||
@ -27,7 +27,7 @@ namespace osu.Game.Online.Rooms
|
||||
var req = base.CreateWebRequest();
|
||||
|
||||
if (status != RoomStatusFilter.Open)
|
||||
req.AddParameter("mode", status.ToString().Underscore().ToLowerInvariant());
|
||||
req.AddParameter("mode", status.ToString().ToSnakeCase().ToLowerInvariant());
|
||||
|
||||
if (!string.IsNullOrEmpty(category))
|
||||
req.AddParameter("category", category);
|
||||
|
@ -6,7 +6,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Humanizer;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -71,7 +70,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
var bindable = (IBindable)property.GetValue(component);
|
||||
|
||||
if (!bindable.IsDefault)
|
||||
Settings.Add(property.Name.Underscore(), bindable.GetUnderlyingSettingValue());
|
||||
Settings.Add(property.Name.ToSnakeCase(), bindable.GetUnderlyingSettingValue());
|
||||
}
|
||||
|
||||
if (component is Container<Drawable> container)
|
||||
|
Loading…
Reference in New Issue
Block a user