//private void refreshlistbox() //{ // if (AKSERVERS.Count != 0) // AKSERVERS.Clear(); // if (listBox.Items.Count != 0) // listBox.Items.Clear(); // try // { // string sql = "SELECT * FROM phpap_AKservers"; // MySqlCommand cmd = new MySqlCommand(sql, Program.AKsqlcon); // MySqlDataReader rdr = cmd.ExecuteReader(); // while (rdr.Read()) // { // AKservers readerserver = new AKservers(); // readerserver.ID = (int)rdr["ServerID"]; // readerserver.Servername = rdr["ServerName"].ToString(); // readerserver.IP = rdr["ServerIP"].ToString(); // readerserver.Mapname = rdr["ServerMapname"].ToString(); // readerserver.Port = (int)rdr["ServerPort"]; // readerserver.ServerPassword = rdr["ServerPassword"].ToString(); // readerserver.ServerPrivate = (int)rdr["ServerPrivate"]; // readerserver.Version = "V 3.3.1.1"; //iNCIN AK version // //if (readerserver.ServerPrivate == 0) //server is set to private, don't show // //{ // AKSERVERS.Add(readerserver); // //} // } // rdr.Close(); // rdr.Dispose(); // } // catch (Exception ex) // { // if (ex != null) // { // EngineConsole.Instance.Print("No servers found \n"); // EngineConsole.Instance.Print(ex.Message); // return; // } // } // foreach (AKservers AKserveritem in AKSERVERS) // { // if (AKserveritem.ServerPrivate == 0) // { // listBox.Items.Add(GetLobbyServerText(AKserveritem)); // } // } //} private String GetLobbyServerText(AKservers AKSitem) { char[] delimiterChars = { '\\' }; string[] words = AKSitem.Mapname.Split(delimiterChars); string mapnameClean = words[1].ToString(); string Space = "||"; string final = AKSitem.ID.ToString() + Space + AKSitem.Servername.ToString() + ":" + AKSitem.Port.ToString() + Space + mapnameClean; //AKSitem.ID.ToString() + Space + mapnameClean + Space + AKSitem.Version.ToString(); return(final); }
private void RunMap(object SelectedItem) { AKservers selectedserver = SelectedItem as AKservers; if (SelectedItem != null) { GameNetworkClient client = new GameNetworkClient(true); client.ConnectionStatusChanged += Client_ConnectionStatusChanged; string error; if (!client.BeginConnect(selectedserver.IP, selectedserver.Port, EngineVersionInformation.Version, Program.username, serverpassword, out error)) { Log.Error("Running Map Error: " + error); DisposeClient(); return; } } }
//private void refreshlistbox() //{ // if (AKSERVERS.Count != 0) // AKSERVERS.Clear(); // if (listBox.Items.Count != 0) // listBox.Items.Clear(); // try // { // string sql = "SELECT * FROM phpap_AKservers"; // MySqlCommand cmd = new MySqlCommand(sql, Program.AKsqlcon); // MySqlDataReader rdr = cmd.ExecuteReader(); // while (rdr.Read()) // { // AKservers readerserver = new AKservers(); // readerserver.ID = (int)rdr["ServerID"]; // readerserver.Servername = rdr["ServerName"].ToString(); // readerserver.IP = rdr["ServerIP"].ToString(); // readerserver.Mapname = rdr["ServerMapname"].ToString(); // readerserver.Port = (int)rdr["ServerPort"]; // readerserver.ServerPassword = rdr["ServerPassword"].ToString(); // readerserver.ServerPrivate = (int)rdr["ServerPrivate"]; // readerserver.Version = "V 3.3.1.1"; //iNCIN AK version // //if (readerserver.ServerPrivate == 0) //server is set to private, don't show // //{ // AKSERVERS.Add(readerserver); // //} // } // rdr.Close(); // rdr.Dispose(); // } // catch (Exception ex) // { // if (ex != null) // { // EngineConsole.Instance.Print("No servers found \n"); // EngineConsole.Instance.Print(ex.Message); // return; // } // } // foreach (AKservers AKserveritem in AKSERVERS) // { // if (AKserveritem.ServerPrivate == 0) // { // listBox.Items.Add(GetLobbyServerText(AKserveritem)); // } // } //} private String GetLobbyServerText(AKservers AKSitem) { char[] delimiterChars = { '\\' }; string[] words = AKSitem.Mapname.Split(delimiterChars); string mapnameClean = words[1].ToString(); string Space = "||"; string final = AKSitem.ID.ToString() + Space + AKSitem.Servername.ToString() + ":" + AKSitem.Port.ToString() + Space + mapnameClean; //AKSitem.ID.ToString() + Space + mapnameClean + Space + AKSitem.Version.ToString(); return final; }