From fc6e21e2d8e15a18f0ac5d2c9e87398bbe97b629 Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Fri, 11 Aug 2023 11:53:14 +0200 Subject: [PATCH] remove: Console.WriteLine calls --- Server/AuthSession.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Server/AuthSession.cs b/Server/AuthSession.cs index c0a7a23..c7db002 100644 --- a/Server/AuthSession.cs +++ b/Server/AuthSession.cs @@ -64,24 +64,24 @@ public class AuthSession : TcpSession protected override void OnReceived(byte[] buffer, long offset, long size) { - Console.WriteLine($"Length: {size} & offset: {offset}"); + this._logger.LogDebug("Length: {Size} & offset: {Offset}", size, offset); Span decryptedBuffer = new byte[size]; // xor every value after the first 8 bytes var dataBuffer = this.Decrypt(new ArraySegment(buffer, 8, (int)size - 8).ToArray()); - Console.WriteLine("Length " + BitConverter.ToUInt16(buffer, 0)); + this._logger.LogDebug("Length {length}", BitConverter.ToUInt16(buffer, 0)); var opCode = BitConverter.ToUInt16(buffer.ToArray(), 2); - Console.WriteLine("Packet Op Code: " + opCode); - Console.WriteLine("Some Value: " + buffer[4]); + this._logger.LogDebug("Packet Op Code: {OpCode}", opCode); + this._logger.LogDebug("Some Value: {RandomValue}" + buffer[4]); var clientAliveTime = BitConverter.ToUInt16(buffer.ToArray(), 5); - Console.WriteLine("Client Alive time: " + clientAliveTime); - Console.WriteLine("Might be a flag:" + buffer[7]); + this._logger.LogDebug("Client Alive time: {ClientAliveTime}", clientAliveTime); + this._logger.LogDebug("Might be a flag: {Flag}", buffer[7]); - Console.WriteLine("Full buffer: " + Encoding.ASCII.GetString(dataBuffer.ToArray())); + this._logger.LogDebug("Full buffer: {Buffer}", Encoding.ASCII.GetString(dataBuffer.ToArray())); - var rawPacket = new RawPacket((OperationCode)opCode, dataBuffer, clientAliveTime, buffer[0], - buffer[3], this.Id, this); + var rawPacket = new RawPacket((OperationCode)opCode, dataBuffer, clientAliveTime, buffer[7], + buffer[4], this.Id, this); Task.Run(() => this._mediator.Send(rawPacket)); this._logger.LogInformation("Connection from: {@RemoteEndpoint}", this.Socket.RemoteEndPoint?.ToString()); base.OnReceived(decryptedBuffer.ToArray(), offset, decryptedBuffer.Length);