コード例 #1
0
        public override async Task OnReceive(byte[] buffer)
        {
            var packet = new IncomingRealmPacket(buffer, buffer.Length);

            Console.WriteLine("Received: {0}", packet.PacketId.ToString());

            LoginHandler.ProcessPacket(this, packet);
        }
コード例 #2
0
        public static void HandleAuthSession(IClient client, IncomingRealmPacket packet)
        {
            packet.ReadUInt16();
            uint   version   = packet.ReadUInt32();
            uint   sessionId = packet.ReadUInt32();
            string account   = packet.ReadCString();
            uint   seed      = packet.ReadUInt32();

            SendAuthSessionOkay(client);
        }
コード例 #3
0
        public static void ProcessPacket(IClient client, IncomingRealmPacket packet)
        {
            var packetId = packet.PacketId;
            Action <IClient, IncomingRealmPacket> methodHandler;

            actions.TryGetValue(packetId, out methodHandler);

            if (methodHandler != null)
            {
                methodHandler.Invoke(client, packet);
            }
            else
            {
                Console.WriteLine("Unknown packet :(");
            }
        }