Ejemplo n.º 1
0
 /// <summary>
 /// Given lines from the vatsim-data.txt file, parse metadata information
 /// </summary>
 /// <param name="lines">lines from vatsim-data.txt</param>
 /// <param name="currentData">VatsimData</param>
 private static void GetVatsimDataMetaDataFromLines(string[] lines)
 {
     // get meta data
     foreach (string line in lines)
     {
         if (line.StartsWith("VERSION"))
         {
             CurrentVatsimData.VatsimDataVersion = line.Split('=')[1].Trim();
         }
         if (line.StartsWith("RELOAD"))
         {
             CurrentVatsimData.VatsimDataReload = line.Split('=')[1].Trim();
         }
         if (line.StartsWith("UPDATE"))
         {
             string update_value = line.Split('=')[1].Trim();
             CurrentVatsimData.VatsimDataLastUpdated = VatsimDataState.GetDateTimeFromVatsimTimeStamp(update_value);
         }
         if (line.StartsWith("CONNECTED CLIENTS"))
         {
             CurrentVatsimData.VatsimDataConnectedClients = line.Split('=')[1].Trim();
         }
         if (line.StartsWith("UNIQUE USERS"))
         {
             CurrentVatsimData.VatsimDataUniqueUsers = line.Split('=')[1].Trim();
         }
     }
 }
Ejemplo n.º 2
0
        //static constructor
        // https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/static-constructors
        static VatsimDataReader()
        {
            /*
             *  url0 - URLs where complete data files are available. Please choose one randomly every time
             *  url1 - URLs where servers list data files are available. Please choose one randomly every time
             *  metar0 - URL where to retrieve metar. Invoke it passing a parameter like for example: http://data.satita.net/metar.html?id=KBOS
             */
            VATSIM_STATUS_URL     = "https://status.vatsim.net/";
            VATSIM_DATA_PREFIX    = "url0";
            VATSIM_SERVERS_PREFIX = "url1";
            VATSIM_METAR_PREFIX   = "metar0";

            CurrentVatsimData = new VatsimDataState();
        }