Esempio n. 1
0
        private void ProcessMessage(byte[] buffer, int offset, int length)
        {
            var operationCode = MessageBase.GetOperationCode(buffer, offset);

            _logger.LogInfo($"Message received. Operation code: {operationCode}");
            if (operationCode != ShamanOperationCode.Bundle)
            {
                _receivedMessages.Add(new RawMessage
                {
                    Data          = buffer.ToArray(),
                    Offset        = offset,
                    Length        = length,
                    OperationCode = operationCode
                });
            }
            else
            {
                var bundleOperationCode = MessageBase.GetOperationCode(buffer, offset + 1);
                _logger.LogInfo($"It is bundle message ! {bundleOperationCode}");
                _receivedMessages.Add(new RawMessage
                {
                    Data          = buffer.ToArray(),
                    Offset        = offset + 1,
                    Length        = length - 1,
                    OperationCode = bundleOperationCode
                });
            }


            //save join info
            if (operationCode == ShamanOperationCode.JoinInfo)
            {
                _joinInfo = _serializer.DeserializeAs <JoinInfoEvent>(buffer, offset, length).JoinInfo;
            }
        }
 public static void Info(this IShamanLogger shamanLogger, string message)
 {
     shamanLogger.LogInfo(message);
 }
 public static void Info(this IShamanLogger shamanLogger, string sourceName, string action, string message)
 {
     shamanLogger.LogInfo(sourceName, action, message);
 }
Esempio n. 4
0
 public void OnStatusChanged(ShamanClientStatus prevStatus, ShamanClientStatus newStatus)
 {
     _logger.LogInfo($"Status changed from {prevStatus} to {newStatus}");
 }