Skip to content

Commit

Permalink
Appease message pack new inspections
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Jan 7, 2025
1 parent 6f42b59 commit d5f2bdf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CodeAnalysis/osu.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ dotnet_diagnostic.IDE1006.severity = warning
# Too many noisy warnings for parsing/formatting numbers
dotnet_diagnostic.CA1305.severity = none

# messagepack complains about "osu" not being title cased due to reserved words
dotnet_diagnostic.CS8981.severity = none

# CA1507: Use nameof to express symbol names
# Flaggs serialization name attributes
# Flags serialization name attributes
dotnet_diagnostic.CA1507.severity = suggestion

# CA1806: Do not ignore method results
Expand Down
6 changes: 4 additions & 2 deletions osu.Game/Online/API/ModSettingsDictionaryFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@

namespace osu.Game.Online.API
{
public class ModSettingsDictionaryFormatter : IMessagePackFormatter<Dictionary<string, object>>
public class ModSettingsDictionaryFormatter : IMessagePackFormatter<Dictionary<string, object>?>
{
public void Serialize(ref MessagePackWriter writer, Dictionary<string, object> value, MessagePackSerializerOptions options)
public void Serialize(ref MessagePackWriter writer, Dictionary<string, object>? value, MessagePackSerializerOptions options)
{
if (value == null) return;

var primitiveFormatter = PrimitiveObjectFormatter.Instance;

writer.WriteArrayHeader(value.Count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus
{
[MessagePackObject]
public class TeamVersusUserState : MatchUserState
{
[Key(0)]
Expand Down
4 changes: 4 additions & 0 deletions osu.Game/Users/UserActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public class ChoosingBeatmap : UserActivity
}

[MessagePackObject]
[Union(12, typeof(InSoloGame))]
[Union(23, typeof(InMultiplayerGame))]
[Union(24, typeof(SpectatingMultiplayerGame))]
[Union(31, typeof(InPlaylistGame))]
public abstract class InGame : UserActivity
{
[Key(0)]
Expand Down

0 comments on commit d5f2bdf

Please sign in to comment.