private void dispatch(Network.ForwardPacket packet) { Controller.LogIT("Reception de données ..", Color.Green); switch (packet.ID) { case Network.ForwardPacketTypeEnum.NIGHTWORLD_ClientInfos: this.onClientInfos(packet); break; } }
private void onClientInfos(Network.ForwardPacket packet) { this.IP = Socket.IP; this.Name = packet.Reader.ReadString(); this.Version = packet.Reader.ReadString(); this.PlayersCount = packet.Reader.ReadInt32(); this.Uptime = packet.Reader.ReadString(); Controller.LogIT("Informations reçu de la part du serveur '" + this.Name + "'", Color.Green); Controller.UpdateServersIT(); }
public void Send(Network.ForwardPacket packet) { try { this.Socket.Send(packet.GetBytes); } catch (Exception e) { Controller.LogIT("Impossible d'envoyer le packet : " + e.ToString(), Color.Red); } }
private void Socket_OnDataArrivalEvent(byte[] data) { var packet = new Network.ForwardPacket(data); this.dispatch(packet); }