public static void Create <T>(GameOpCode opCode)
            where T : GameMessage, new()
        {
            var type = typeof(T);

            OpCodeLookup.Add(type, opCode);
            TypeLookup.Add(opCode, type);
        }
        public static GameMessage GetMessage(GameOpCode opCode, BinaryReader r)
        {
            var type = TypeLookup.GetValueOrDefault(opCode);

            if (type == null)
            {
                throw new NetsphereBadOpCodeException(opCode);
            }

            return((GameMessage)Serializer.Deserialize(r, type));
        }
 public NetsphereBadOpCodeException(GameOpCode opCode)
     : base($"Bad opCode: {opCode}")
 {
 }