public ActionResult RemoveConfirm(int userid) { RemoveClient removeClient = new RemoveClient(); removeClient.DoWork(userid); return(RedirectToAction("Get")); }
private void disconnectAvatarFromClients(RemoveClient clientToRemove) { for (int i = 0; i < _clients.Count; i++) { LobbyClient client = _clients[i]; sendObject(client.TcpClient, clientToRemove); } }
/// <summary> /// Handles the client. /// </summary> /// <param name="client">The client.</param> /// <param name="stream">The stream.</param> public void HandleClient(TcpClient client, NetworkStream stream) { m_logging.Log("start listening to new client...", Logging.Modal.MessageTypeEnum.INFO); new Task(() => { StreamReader reader = new StreamReader(stream); StreamWriter writer = new StreamWriter(stream); while (true) { try { bool res; string commandLine = reader.ReadLine(); while (reader.Peek() > 0) { commandLine += reader.ReadLine(); } if (commandLine != null) { CommandRecievedEventArgs command = JsonConvert.DeserializeObject <CommandRecievedEventArgs>(commandLine); if (command.CommandID.Equals((int)CommandEnum.CloseGui)) { string[] args = { JsonConvert.SerializeObject(client) }; CommandRecievedEventArgs closeCommand = new CommandRecievedEventArgs((int)CommandEnum.CloseGui, args, ""); m_controller.ExecuteCommand(closeCommand.CommandID, closeCommand.Args, out res); m_logging.Log("Client disconnected", Logging.Modal.MessageTypeEnum.WARNING); break; } string result = m_controller.ExecuteCommand(command.CommandID, command.Args, out res); try { // Thread.Sleep(1000); mtx.WaitOne(); writer.WriteLine(result); writer.Flush(); mtx.ReleaseMutex(); } catch (Exception e) { m_logging.Log("Client disconnected", Logging.Modal.MessageTypeEnum.WARNING); RemoveClient?.Invoke(client); } } } catch (Exception e) { Console.WriteLine(e.ToString()); return; } } }).Start(); }
private void Remove(WebNotifyConnection client) { try { connections.Remove(client); client?.Dispose(); } catch (Exception ex) { Helper.OnException(ex); } RemoveClient?.Invoke(this, new WebNotifyEventArgs(client)); }
public async Task <IHttpActionResult> DeleteClient([FromBody] RemoveClient model) { if (!ModelState.IsValid) { return(BadRequest()); } var findClient = await DB.ClientsTable.SingleOrDefaultAsync(x => x.Id == model.ClientId); if (findClient != null) { DB.ClientsTable.Remove(findClient); await DB.SaveChangesAsync(); } return(Ok()); }
private void removeFaultyClients() { for (int i = 0; i < _clients.Count; i++) { LobbyClient client = _clients[i]; //remove faulty clients if (!client.TcpClient.Connected) { Console.WriteLine("CLIENT " + client.id + " DISCONNECTED"); RemoveClient clientToRemove = new RemoveClient(); clientToRemove.SetParameters(client.id); _clients.RemoveAt(i); disconnectAvatarFromClients(clientToRemove); continue; } } }
/// <summary> /// /// </summary> /// <param name="message"></param> public void Handle(RemoveClient message) { m_clientById.Remove(message.Client.ClientId); m_log.Info("remove client : {0}", message.Client.ClientId); }
private void OnRemoveClient(SocketConnection sender) { RemoveClient?.Invoke(sender); }
/// <summary> /// Delete the role. /// </summary> /// <param name="command">The command.</param> /// <returns>IList<IEvent>.</returns> /// <exception cref="ClientNotFoundException">Id</exception> /// <exception cref="ClientConcurrencyFailureException"></exception> private IList <IEvent> Handle(RemoveClient command) { CheckConcurrencyStamp(command.ConcurrencyCheckStamp); return(new[] { new ClientRemoved(Id, command.UserId, command.CorrelationId) }); }