Esempio n. 1
0
        public void Call <T>(Vdb.Session session, T packet) where T : ITW.Protocol.Packet
        {
            if (bindedMethods.ContainsKey(packet.GetType()) == false)
            {
                return;
            }

            foreach (object obj in bindedMethods[packet.GetType()])
            {
                (obj as HandlerMethod <T>)(session, packet);
            }
        }
Esempio n. 2
0
        public static void ParseAndDeliver(Network.PacketHandler handler, Vdb.Session session, byte[] data)
        {
            IFormatter f = new BinaryFormatter();

            ITW.Protocol.Packet p = (ITW.Protocol.Packet)f.Deserialize(new System.IO.MemoryStream(data));

            switch (p.PacketName)
            {
            case ITW.Protocol.ToServer.Session.Connect.TypeName:
                handler.Call(session, p as ITW.Protocol.ToServer.Session.Connect);
                break;

            case ITW.Protocol.ToServer.Session.Disconnect.TypeName:
                handler.Call(session, p as ITW.Protocol.ToServer.Session.Disconnect);
                break;

            default:
                // 이상한 패킷
                break;
            }
        }
Esempio n. 3
0
 private bool Disconnect(Vdb.Session session, ITW.Protocol.ToServer.Session.Disconnect packet)
 {
     Console.Write("Disconnect : " + session.client.Client.Handle);
     server.CloseSession(session);
     return(true);
 }
Esempio n. 4
0
 private bool Connect(Vdb.Session session, ITW.Protocol.ToServer.Session.Connect packet)
 {
     Console.Write("Connect : " + packet.Id);
     return(true);
 }
Esempio n. 5
0
 private void OnAcceptClient(Vdb.Session session)
 {
     Console.WriteLine("AcceptClient : " + session.client.Client.Handle);
 }