-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to .NET 9 + use System.Text.Json (#100)
* Change to .NET 8 * Update packages * Drop Newtonsoft.Json (needs to wait for .NET 9) * Switch to .NET 9 * Switch libraries to RC1 * Update BytexDigital.Steam * Update .NET version in workflows * Update to .NET 9 release version * Replace OnFailure() with TapError()
- Loading branch information
Showing
47 changed files
with
259 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace ArmaForces.Arma.Server.Constants; | ||
|
||
public static class JsonOptions | ||
{ | ||
public static JsonSerializerOptions Legacy = new() | ||
{ | ||
WriteIndented = true | ||
}; | ||
|
||
public static JsonSerializerOptions Default = new() | ||
{ | ||
WriteIndented = true, | ||
Converters = | ||
{ | ||
new JsonStringEnumConverter() | ||
}, | ||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase, | ||
DefaultIgnoreCondition = JsonIgnoreCondition.Never | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 27 additions & 50 deletions
77
ArmaForces.Arma.Server/Features/Servers/DTOs/ServerStatus.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,34 @@ | ||
using System; | ||
using Newtonsoft.Json; | ||
|
||
namespace ArmaForces.Arma.Server.Features.Servers.DTOs | ||
{ | ||
public class ServerStatus | ||
public class ServerStatus( | ||
ServerStatusEnum status = ServerStatusEnum.Stopped, | ||
string? name = null, | ||
string? modsetName = null, | ||
string? mapName = null, | ||
int? playersCount = null, | ||
int? playersMaxCount = null, | ||
int? port = null, | ||
DateTimeOffset? startTime = null, | ||
int? headlessClientsCount = null) | ||
{ | ||
public ServerStatus( | ||
ServerStatusEnum serverStatusEnum = ServerStatusEnum.Stopped, | ||
string? name = null, | ||
string? modsetName = null, | ||
string? mapName = null, | ||
int? playersCount = null, | ||
int? playersMaxCount = null, | ||
int? port = null, | ||
DateTimeOffset? startTime = null, | ||
int? headlessClientsCount = null) | ||
{ | ||
Status = serverStatusEnum; | ||
Name = name; | ||
ModsetName = modsetName; | ||
Map = mapName; | ||
Players = playersCount; | ||
PlayersMax = playersMaxCount; | ||
Port = port; | ||
StartTime = startTime; | ||
HeadlessClientsConnected = headlessClientsCount; | ||
} | ||
|
||
[JsonProperty(Required = Required.Always)] | ||
public ServerStatusEnum Status { get; } | ||
|
||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public string? Name { get; } | ||
|
||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public string? ModsetName { get; } | ||
|
||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public string? Map { get; } | ||
|
||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public int? Players { get; } | ||
|
||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public int? PlayersMax { get; } | ||
|
||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public int? Port {get; } | ||
|
||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public DateTimeOffset? StartTime { get; } | ||
|
||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public int? HeadlessClientsConnected { get; } | ||
public ServerStatusEnum Status { get; init; } = status; | ||
|
||
public string? Name { get; init; } = name; | ||
|
||
public string? ModsetName { get; init; } = modsetName; | ||
|
||
public string? Map { get; init; } = mapName; | ||
|
||
public int? Players { get; init; } = playersCount; | ||
|
||
public int? PlayersMax { get; init; } = playersMaxCount; | ||
|
||
public int? Port {get; init; } = port; | ||
|
||
public DateTimeOffset? StartTime { get; init; } = startTime; | ||
|
||
public int? HeadlessClientsConnected { get; init; } = headlessClientsCount; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.