continuity/Server/PacketHandlers/ChannelSelectionHandler.cs
Timothy Schenk dc6d8316e9
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 1s
Build, Package and Push Images / build (push) Successful in 26s
Build, Package and Push Images / sbom-scan (push) Successful in 39s
Build, Package and Push Images / sonarqube (push) Successful in 1m21s
Build, Package and Push Images / container-build (push) Successful in 1m30s
Build, Package and Push Images / container-sbom-scan (push) Successful in 37s
chore: ci jobs expanded & .net 8 support
ci: branch name sanitization for docker

ci: another attempt

ci: forgot actor

chore: remove nuke remnants

chore(deps): update dependency dotnet-sdk to v7.0.403

Signed-off-by: noreply@rainote.dev

refactor: shared data into library

refactor: rewrite for packethandler/id map

chore: logging

chore: Sonar Warnings

chore: upgrade to .net8 image

chore: fetch all required information for characters

chore: upgrade to .net 8

ci: install .net 7.0 alongside 8.0 for sbom

fix: incorrect job

ci: let's try arm64 again

ci: adjust project for .net 8 support

chore: adjustments to composefile

chore: analyzer setup

chore: analyzer and project settings updated
2023-11-08 09:38:49 +01:00

37 lines
1.2 KiB
C#

using Microsoft.EntityFrameworkCore;
using Wonderking.Packets.Incoming;
namespace Server.PacketHandlers;
using DB;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using NetCoreServer;
public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
{
private readonly IConfiguration _configuration;
private readonly ILogger<ChannelSelectionHandler> _logger;
private readonly WonderkingContext _wonderkingContext;
public ChannelSelectionHandler(IConfiguration configuration, ILogger<ChannelSelectionHandler> logger,
WonderkingContext wonderkingContext)
{
this._configuration = configuration;
this._logger = logger;
this._wonderkingContext = wonderkingContext;
}
public ChannelSelectionHandler()
{
}
public Task HandleAsync(ChannelSelectionPacket packet, TcpSession session)
{
var authSession = (AuthSession)session;
var charactersOfAccount = this._wonderkingContext.Accounts.Include(account => account.Characters)
.FirstOrDefault(a => a.Id == authSession.AccountId)
?.Characters;
return Task.CompletedTask;
}
}