Beispiel #1
0
 public void UpdateServerList()
 {
     serverList = Php.getServers();
     String[] s = serverList.ServerToStrings();
     tot = Union(s, uptext);
     servers.SetMenuItems(tot);
 }
Beispiel #2
0
        public static ServerList getServers()
        {
            String tableString = Php.formatString();

            if (tableString != "")
            {
                List <string> ip        = new List <string>();
                List <Int32>  max       = new List <Int32>();
                List <Int32>  openSlots = new List <Int32>();
                List <Int32>  ping      = new List <Int32>();
                const string  SERVER_VALID_DATA_HEADER = "SERVER_";
                String        rows  = tableString.Trim().Substring(SERVER_VALID_DATA_HEADER.Length);
                String[]      words = Regex.Split(rows, "_ROW_");

                foreach (string word in words)
                {
                    String[] cols = Regex.Split(word, "_COL_");
                    if (cols.Length == 4)
                    {
                        String temp = cols[0].Trim();
                        if (temp.Equals(Functions.MyIp()))
                        {
                            ip.Add("localhost");
                        }
                        else
                        {
                            ip.Add(temp);
                        }
                        max.Add(Convert.ToInt32(cols[1].Trim()));
                        openSlots.Add(Convert.ToInt32(cols[2].Trim()));
                        ping.Add(Convert.ToInt32(cols[3].Trim()));
                    }
                }
                ServerList sL = new ServerList(ip, max, openSlots, ping);
                return(sL);
            }
            else
            {
                return(null);
            }
        }