Beispiel #1
0
        private static Boolean SendMessage(Server server, String message)
        {
            var con = new RConnection();

            con.HostName          = server.Host;
            con.Port              = (ushort)server.Port;
            con.PlaintextPassword = server.Password;

            con.Connect();

            while (!con.Client.Connected)
            {
                System.Threading.Thread.Sleep(200);
            }
            con.Login();
            con.Command("admin.say", message, "all");
            System.Threading.Thread.Sleep(200);
            con.Shutdown();

            return(true);
        }
Beispiel #2
0
        private void RunClient()
        {
            Connection.Connect();

            while (Connection.Client.Connected == true)
            {
                // Reconnect logic should be here later on

                #region Shutdown app
                String messageInput = Console.ReadLine();
                if (String.Compare(messageInput, "exit", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    Connection.Shutdown();
                }
                else
                {
                    Connection.Command(messageInput.Wordify());
                }
                #endregion
            }

            //Console.WriteLine("{0} {1}", DateTime.Now, "[INFO] - Lost connection to game server");
        }