Beispiel #1
0
 public JSPacket Pack(JSMessage msg)
 {
     var packet = new JSPacket();
     packet.MessageType = msg.GetType();
     msg.OnSerialize(packet);
     return packet;
 }
Beispiel #2
0
        public JSMessage Open(JSPacket packet)
        {
            Type type = packet.MessageType;
            var msg = (JSMessage)Activator.CreateInstance(type);
            OnOpening(msg);
            msg.OnDeserialize(packet);

            return msg;
        }
Beispiel #3
0
 protected internal abstract void OnSerialize(JSPacket packet);