Exemplo n.º 1
0
 public override void Dispose()
 {
     _client.Dispose();
     _client.Disconnected   -= OnDisconnected;
     _client.Error          -= OnError;
     _client.PacketReceived -= OnPacketReceived;
 }
Exemplo n.º 2
0
        private byte _battleId = byte.MaxValue; // Spectator by default

        public NetworkClientConnection(string host, ushort port, PBELegalPokemonCollection party, Action <object> action)
        {
            _party  = party;
            _action = action;
            _client = new PBEClient();
            _client.Disconnected   += OnDisconnected;
            _client.Error          += OnError;
            _client.PacketReceived += OnPacketReceived;
            if (_client.Connect(new IPEndPoint(IPAddress.Parse(host), port), 10 * 1000))
            {
                OnConnected();
            }
            else
            {
                _client.Dispose();
                action.Invoke(null);
            }
        }
Exemplo n.º 3
0
 public override void Dispose()
 {
     base.Dispose();
     _client.Dispose(); // Events unsubscribed
 }
Exemplo n.º 4
0
 public void Dispose()
 {
     _client.Dispose(); // Unsubscribe events
 }