Пример #1
0
        public async Task WriteGameCreatedAsync(ClientRecorder client, GameCode gameCode)
        {
            _logger.LogTrace("Writing GameCreated {0}.", gameCode);

            var context = _pool.Get();

            try
            {
                WritePacketHeader(context, RecordedPacketType.GameCreated);
                WriteClient(context, client, false);
                WriteGameCode(context, gameCode);
                WriteLength(context);

                await WriteAsync(context.Stream);
            }
            finally
            {
                _pool.Return(context);
            }
        }
Пример #2
0
        public async Task WriteMessageAsync(ClientRecorder client, IMessageReader reader, MessageType messageType)
        {
            _logger.LogTrace("Writing Message.");

            var context = _pool.Get();

            try
            {
                WritePacketHeader(context, RecordedPacketType.Message);
                WriteClient(context, client, false);
                WritePacket(context, reader, messageType);
                WriteLength(context);

                await WriteAsync(context.Stream);
            }
            finally
            {
                _pool.Return(context);
            }
        }