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); } }
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); } } }