Beispiel #1
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;
            }
        }
Beispiel #2
0
 public SessionSystem(ITWServer server, Network.PacketHandler packetHander) : base(server, packetHander)
 {
     server.OnAcceptClient += OnAcceptClient;
     packetHander.Bind <ITW.Protocol.ToServer.Session.Connect>(Connect);
     packetHander.Bind <ITW.Protocol.ToServer.Session.Disconnect>(Disconnect);
 }
Beispiel #3
0
 public System(ITWServer server, Network.PacketHandler packetHandler)
 {
     this.server        = server;
     this.packetHandler = packetHandler;
 }