1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 13:22:55 +08:00

Update APIUser to provide enum from serialised country code

This commit is contained in:
Salman Ahmed 2022-07-16 04:06:25 +03:00
parent 4ea8fd75cc
commit 00f4c8052e

View File

@ -34,8 +34,24 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"previous_usernames")]
public string[] PreviousUsernames;
private Country? country;
public Country Country
{
get => country ??= (Enum.TryParse(userCountry.Code, out Country result) ? result : default);
set => country = value;
}
#pragma warning disable 649
[JsonProperty(@"country")]
public Country Country;
private UserCountry userCountry;
private class UserCountry
{
[JsonProperty(@"code")]
public string Code;
}
#pragma warning restore 649
public readonly Bindable<UserStatus> Status = new Bindable<UserStatus>();