using System; namespace QuantumUNET.Messages { public class QSBNetworkMessage { public const int MaxMessageSize = 65535; public short MsgType; public QSBNetworkConnection Connection; public QSBNetworkReader Reader; public int ChannelId; public TMsg ReadMessage() where TMsg : QSBMessageBase, new() { var result = Activator.CreateInstance(); result.Deserialize(Reader); return result; } public void ReadMessage(TMsg msg) where TMsg : QSBMessageBase => msg.Deserialize(Reader); } }