Beispiel #1
0
        private static void parseServers(VATData data)
        {
            VATDataCategory c1 = data.GetCategories()[0];

            Console.WriteLine("Parsing servers...");
            Console.WriteLine("Category: " + c1.getName());
            foreach (string server in c1.getData())
            {
                if (server.StartsWith("msg0"))
                {
                    Console.WriteLine("MESSAGE FROM VATSIM:");
                    Console.WriteLine(server.Substring(5));
                }
                else if (server.StartsWith("url0"))
                {
                    VATDataAPI.urls.Add(server.Substring(5));
                }
                else if (server.StartsWith("metar0"))
                {
                    metar = server.Substring(7);
                }
            }
            Console.WriteLine("Loaded " + VATDataAPI.urls.Count + " data servers (Primary: " + VATDataAPI.urls[0] + ")");
            Console.WriteLine("Metar Server: " + metar);
        }
Beispiel #2
0
        public static void updateStatus()
        {
            status = queryURL("http://status.vatsim.net/status.txt");
            VATData data = new VATData(status);

            parseServers(data);
        }
Beispiel #3
0
        public static void query()
        {
            string thisQuery = urls[random.Next(urls.Count)];

            Console.WriteLine("Querying data server " + thisQuery);
            VATData data = new VATData(VATRequestManager.queryURL(thisQuery));

            parse(data);
        }
Beispiel #4
0
 private static void parse(VATData data)
 {
     clients.Clear();
     Console.WriteLine("Sorting connected clients...");
     for (int i = 1; i < data.GetCategories().Length; i++)
     {
         VATDataCategory cat     = data.GetCategories()[i];
         string[]        catdata = cat.getData();
         Console.WriteLine("Category: " + cat.getName());
         if (cat.getName() == "CLIENTS" || cat.getName() == "PREFILE")
         {
             foreach (string client in catdata)
             {
                 var c = client.Split(':');
                 clients.Add(new VATClient(c[0], c[1], c[2], (c[3] == "ATC"), c[4], c[11], c[13], c[16], c[29], c[35]));
             }
         }
     }
     Console.WriteLine("Sorted " + clients.Count + " connected clients");
 }