Esempio n. 1
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            for (int i = 0; i < RCONServer.Clients.Count; i++)
            {
                RCONConnection client              = RCONServer.Clients[i];
                int            timeTotal           = (int)((DateTime.Now - client.ConnectedTime).TotalSeconds);
                string         connectedTimeFormat = "";

                // Format days, hours minutes and seconds since the client connected to RCON.
                if (timeTotal >= (60 * 60 * 24))
                {
                    connectedTimeFormat = ((int)(timeTotal / (60 * 60 * 24))).ToString() + "d ";
                }
                if (timeTotal >= (60 * 60))
                {
                    connectedTimeFormat += ((int)((timeTotal / (60 * 60)) % 24)).ToString() + "h ";
                }
                if (timeTotal >= 60)
                {
                    connectedTimeFormat += ((int)((timeTotal / 60) % 60)).ToString() + "m ";
                }
                connectedTimeFormat += ((int)(timeTotal % 60)).ToString() + "s";
                Logger.Log(R.Translate("command_rwho_line", i + 1, client.InstanceID, client.Authenticated, client.Address, client.ConnectedTime.ToString(), connectedTimeFormat));
            }
        }
 public void Execute(IRocketPlayer caller, string[] command)
 {
     if (command.Length == 0 || command.Length > 1 || command[0] != "y")
     {
         Logger.Log(R.Translate("command_rflush_help"));
     }
     else
     {
         Logger.Log(R.Translate("command_rflush_total", RCONServer.Clients.Count.ToString()));
         List <RCONConnection> connections = new List <RCONConnection>();
         connections.AddRange(RCONServer.Clients);
         for (int i = 0; i < connections.Count; i++)
         {
             RCONConnection client = connections[i];
             if (client.Client.Client.Connected)
             {
                 Logger.Log(R.Translate("command_rflush_line", i + 1, client.InstanceID, client.Address));
                 client.Close();
             }
         }
     }
 }