Skip to content

Commit

Permalink
Move back to regular constructor to avoid hidden fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ArachisH committed Mar 22, 2024
1 parent 300411a commit df5edeb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Tanji.Core/Services/Implementations/ClientHandlerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

namespace Tanji.Core.Services;

public sealed class ClientHandlerService(ILogger<ClientHandlerService> logger, IOptions<TanjiOptions> options) : IClientHandlerService
public sealed class ClientHandlerService : IClientHandlerService
{
private static readonly JsonSerializerOptions SerializerOptions;

private readonly TanjiOptions _options = options.Value;
private readonly ILogger<ClientHandlerService> _logger = logger;
private readonly TanjiOptions _options;
private readonly ILogger<ClientHandlerService> _logger;

public DirectoryInfo PatchedClientsDirectory { get; } = Directory.CreateDirectory("Patched Clients");
public DirectoryInfo MessagesDirectory { get; } = Directory.CreateDirectory("Messages");
Expand All @@ -43,6 +43,11 @@ static ClientHandlerService()
SerializerOptions.Converters.Add(new PlatformConverter());
SerializerOptions.Converters.Add(new IPEndPointConverter());
}
public ClientHandlerService(ILogger<ClientHandlerService> logger, IOptions<TanjiOptions> options)
{
_logger = logger;
_options = options.Value;
}

public IGame PatchClient(HPlatform platform, string? clientPath = null)
{
Expand Down Expand Up @@ -117,7 +122,7 @@ public bool TryGetIdentifiers(string? revision, out Outgoing? outgoing, out Inco
foreach (FileInfo fileInfo in MessagesDirectory.EnumerateFiles())
{
if (!fileInfo.Name.EndsWith($"{revision}.json")) continue;

using FileStream messagesDeserializationStream = File.OpenRead(fileInfo.FullName);
var identifiers = JsonSerializer.Deserialize<CachedIdentifiers>(messagesDeserializationStream, SerializerOptions);

Expand Down

0 comments on commit df5edeb

Please sign in to comment.