private void btWriteFlightsSQDB_Click(object sender, EventArgs e) { if (APDB.Count <= 0) { RTB.Text += $"ERROR - No Airports found, load airports first\n"; return; } if (RTDB.Count <= 0) { RTB.Text += $"ERROR - No Routes found, load routes first\n"; return; } var iw = new FlightsDB( ); string folder = Path.Combine(@"D:\DUMPTEST", CSV_PATH); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } RTB.Text += iw.CreateDB(Path.Combine(folder, "dump1090fa-flights.sqb")); RTB.Text += iw.LoadDBfromAirports(APDB); RTB.Text += iw.LoadDBfromARoutes(RTDB); RTB.Text += $"SQDB Flights file written (or not if prevously was an error...)\n"; }
private static void DoFlightsJob() { if (!jobFlights) { return; } Console.WriteLine($"\nCreating flights database .."); string file = Path.Combine(inputDir, airportsFile); var ir = new apCsvReader( ); Console.WriteLine($"Reading Airport CSV: {file}"); Console.WriteLine(apCsvReader.ReadDb(APDB, file)); Console.WriteLine($"DONE - Airports Database contains {APDB.Count} records\n"); file = Path.Combine(inputDir, routesFile); Console.WriteLine($"Reading Route TSV: {file}"); Console.WriteLine(rtTsvReader.ReadDb(ref RTDB, file)); Console.WriteLine($"DONE - Route Database contains {RTDB.Count} records\n"); // Create now if (APDB.Count <= 0) { Console.WriteLine($"ERROR - No Airports found, provide a populated airports file\n"); return; } if (RTDB.Count <= 0) { Console.WriteLine($"ERROR - No Routes found, provide a populated routes file\n"); return; } var iw = new FlightsDB( ); Console.WriteLine(iw.CreateDB(Path.Combine(outputDir, flightsDBFile))); Console.WriteLine(iw.LoadDBfromAirports(APDB)); Console.WriteLine(iw.LoadDBfromARoutes(RTDB)); Console.WriteLine($"SQDB Flights file written (or not if previously was an error...)"); }