예제 #1
0
        private void CNetwork_OnReceived(object sender, NetReceivedEventArgs <byte[]> e)
        {
            reader = new ArrayReader(e.Data, e.Data.Length);
            FROM_SERVER header = (FROM_SERVER)reader.ReadShort();

            switch (header)
            {
            case FROM_SERVER.LOGIN_STATUS:
                break;

            case FROM_SERVER.CLIENT_HELLO:
                var version = reader.ReadShort();
                var patch   = reader.ReadMapleString();

                if (version != (short)GameConstants.MAJOR_VERSION && patch != GameConstants.MINOR_VERSION)
                {
                    Disconnect(NetStoppedReason.Exception);
                    Environment.Exit(0);
                }
                break;

            default:
                Console.WriteLine("[Unhandled] Packet received: {0}", ByteArrayToString(e.Data));
                break;
            }
        }