Пример #1
0
 public void SendMessage <T>(T message) where T : class
 {
     if (IsConnected)
     {
         TestMessage.ID msgId = TestMessage.GetID(typeof(T));
         TestMessage    msg   = TestMessage.Create <T>(message);
         SendMessage((uint)msgId, msg);
     }
 }
Пример #2
0
 private void PeekMessage(ref uint msgId, ref object message)
 {
     msgId   = 0;
     message = null;
     if (IsConnected)
     {
         MessagePacket packet = DequeueMessage();
         if (null != packet)
         {
             msgId = packet.MsgId;
             TestMessage.ID msgEnum = (TestMessage.ID)msgId;
             message = ((TestMessage)packet.Message).GetValue(msgEnum);
         }
     }
 }