Exemple #1
0
        public void Serialize(Message message, BinaryWriter writer)
        {
            //GetMsgId(message);
            //_serializer.GetSerializer(message.GetType())(writer, message);

            _serializer.Serialize(writer.BaseStream, message);
        }
 public void Invoke(IMessageSender sender, Message message)
 {
     foreach(var listener in Listeners)
     {
         listener.Value.Invoke(listener.Key, sender, message);
     }
 }
Exemple #3
0
 public void SendMessage(Message message)
 {
     foreach(var listener in _listeners)
     {
         listener.SendMessage(message);
     }
 }
Exemple #4
0
        public int GetMsgId(Message message)
        {
            var index = Types.IndexOf(message.GetType());

            if (index == -1)
            {
                throw new Exception("Not registered");
            }

            return index;
        }
Exemple #5
0
 public void Error(Message message, ErrorMessage errorMessage)
 {
     throw new NotImplementedException();
 }
Exemple #6
0
 public void SendMessage(Message message)
 {
     throw new NotImplementedException();
 }
Exemple #7
0
 public override void Invoke(object target, IMessageSender sender, Message message)
 {
     MethodInfo.Invoke(target, new object[] { sender, message });
 }
Exemple #8
0
 public EntityMessage(IHost host, int entity, Message message)
 {
     _serializer = host.ServiceManager.GetProvider<MsgDes>();
     Entity = entity;
     Message = message;
 }
Exemple #9
0
 public void Error(Message message, ErrorMessage error)
 {
     Console.WriteLine(error.ToString());
     throw new Exception(error.ToString());
 }
Exemple #10
0
 public abstract void Invoke(object target, IMessageSender sender, Message message);