private void SendData(ScavengerServiceMessageType messageType, Guid scavengerId, Action <BinaryWriter> writeData = null) { var message = new MessageWrapper(ClientType.Scavenger, (int)messageType, scavengerId); _clientTerminal.SendMessage(message.WriteBuffer(writeData)); }
public void AddScavengerHandler <T>(ScavengerServiceMessageType messageType, Func <BinaryReader, T> messageReader, Func <IScavengerService, MessageWrapper, T, Task> messageHandler) where T : class { _messageReaders[ClientType.Scavenger].Add((int)messageType, messageReader); _scavengerHandlers.Add((int)messageType, (service, message) => messageHandler(service, message, message.GetData <T>())); }