Esempio n. 1
0
 private void SubscribeUIUpdate(ClientConnectionBase client)
 {
     client.ConnectionError += (s, ex) =>
     {
         MessageBox.Show(ex.Message);
     };
 }
Esempio n. 2
0
 public UInt64 add(ClientConnectionBase connection) // returns connection ID
 {
     // TODO: revise for performance
     ClientConnection cc = new ClientConnection();
     cc.connection = connection;
     cc.ref_id_at_client = ++connIdxBase;
     cc.ref_id_at_server = 0;
     /*auto ins = */
     connections.Add(cc.ref_id_at_client, cc);
     //assert(ins.second);
     connection.addedToPool(this, cc.ref_id_at_client);
     return cc.ref_id_at_client;
 }
        public OperationState Send <T>(ClientConnectionBase connection, ProtocolBase <T> data)
        {
            var operationState = connection.SendData(data);

            if (operationState.IsSuccessful)
            {
                connection.TransportStats.AddBytesSent(operationState.Counter);
            }
            else
            {
                return(operationState);
            }
            return(new OperationState {
                IsSuccessful = true
            });
        }
        public void AddClientConnection(ClientConnectionBase connection)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }
            if (string.IsNullOrEmpty(connection.ConnectionName))
            {
                throw new ArgumentNullException(nameof(connection.ConnectionName));
            }

            if (Connections.ContainsKey(connection.ConnectionName))
            {
                var currentConnection = Connections[connection.ConnectionName];
                currentConnection.Dispose();
                Connections.Remove(connection.ConnectionName);
            }
            connection.PeerRef = this;
            Connections.Add(connection.ConnectionName, connection);
        }
 public void Execute(ClientConnectionBase connection, IClientCommand entity)
 {
     var cmd = (GetUsersInGame)entity;
 }
Esempio n. 6
0
 public void Execute(ClientConnectionBase connection, IClientCommand entity)
 {
     Trace.WriteLine("Join request got");
 }
Esempio n. 7
0
 public void remove(ClientConnectionBase obj)
 {
     cliPool.remove(obj);
 }
Esempio n. 8
0
 public void add(ClientConnectionBase obj)
 {
     cliPool.add(obj);
 }
Esempio n. 9
0
 public void remove(ClientConnectionBase connection)
 {
     connections.Remove(connection.getConnID());
     connection.setRemovedFromPool();
 }
Esempio n. 10
0
 public void Execute(ClientConnectionBase connection, IClientCommand entity)
 {
     Trace.WriteLine("Leave Req Got");
 }
Esempio n. 11
0
        public void Execute(ClientConnectionBase connection, IClientCommand entity)
        {
            var cmd = (SendToGameUsers)entity;

            Trace.WriteLine($"Cmd sent to Users with message {Message}");
        }