Esempio n. 1
0
        private void getServers()
        {
            //get list of public server for test purposes
            Assembly     exeasm     = Assembly.GetExecutingAssembly();
            AssemblyName exeasmname = exeasm.GetName();
            string       exename    = exeasmname.Name;
            string       exeversion = exeasmname.Version.ToString();

            Assembly     dllasm     = Assembly.GetAssembly(ttclient.GetType());
            AssemblyName dllasmname = dllasm.GetName();
            string       dllname    = dllasmname.Name;
            string       dllversion = dllasmname.Version.ToString();
            string       url        = string.Format("http://www.bearware.dk/teamtalk/tt5servers.php?client={0}&version={1}&dllversion={2}&os=Windows",
                                                    dllname, exeversion, dllversion);

            HttpWebRequest myHttpWebRequest1  = (HttpWebRequest)WebRequest.Create(url);
            WebResponse    response           = myHttpWebRequest1.GetResponse();
            Stream         dataStream         = response.GetResponseStream();
            StreamReader   reader             = new StreamReader(dataStream);
            string         responseFromServer = reader.ReadToEnd();

            parsePublicServers(responseFromServer);

            foreach (Server server in publicservers)
            {
                serversListBox.Items.Add(server);
            }
        }