Пример #1
0
        public override void ChannelRead(IChannelHandlerContext context, object message)
        {
            try
            {
                MapleBuffer buffer = new MapleBuffer((byte[])message);
                if (buffer.Available < 2)
                {
                    return;
                }
                System.Console.WriteLine("封包: {0}", buffer.ToString());

                CMapleClient client = context.GetAttribute <CMapleClient>(CMapleClient.attributeKey).Get();
                if (client != null)
                {
                    short packetId = buffer.read <byte>();
                    CommonGlobal.Run(packetId, buffer, client);
                }
            }
            catch (Exception e)
            {
                System.Console.WriteLine("错误:" + e);
            }
        }