Skip to content

Commit 100e69a

Browse files
authoredJan 18, 2021
Update Program.cs
1 parent b664a51 commit 100e69a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎PiAware2SQLV4/Program.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,10 @@ static void Main()
148148
{
149149
var json = webClient.DownloadString("aircraft.json");
150150

151-
JToken token = JToken.Parse(json);
152-
JArray aircraft = (JArray)token.SelectToken("aircraft");
153-
JArray saircraft = new JArray(aircraft.OrderBy(obj => (string)obj["flight"]));
151+
JToken token = JToken.Parse(json); // Parse JSON from Rasperry Pi.
152+
JArray aircraft = (JArray)token.SelectToken("aircraft"); // Pull out just the flight records from the JSON.
153+
JArray saircraft = new JArray(aircraft.OrderBy(obj => (string)obj["flight"])); Create a new array and sort records by flight number.
154+
154155
// Write headers at top of console screen
155156
Console.SetCursorPosition(0, 0);
156157
Console.WriteLine("----------------------------------------------------------------------------------------");
@@ -161,7 +162,7 @@ static void Main()
161162

162163
var i = 0;
163164

164-
// Only process records with the hex,flight,lat,lon,alt_baro,baro_rate,track and gs columns
165+
// Only process records with the hex,flight,lat,lon,alt_baro,baro_rate,track and gs columns.
165166
foreach (JToken ac in saircraft)
166167
{
167168
if (ac["hex"] != null &

0 commit comments

Comments
 (0)