private void btWriteIcaoSQDB_Click(object sender, EventArgs e) { if (IDB.Count <= 0) { RTB.Text += $"ERROR - No Aircraft records found, load BaseStation first\n"; return; } var iw = new AircraftsDB( ); string folder = Path.Combine(@"D:\DUMPTEST", CSV_PATH); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } RTB.Text += iw.CreateDB(Path.Combine(folder, "dump1090fa-aircrafts.sqb")); RTB.Text += iw.LoadDBfromIcao(IDB); RTB.Text += $"SQDB Icao ModeS file written (or not if prevously was an error...)\n"; }
// Collect Aircraft data from various sources // Write into web aircraft database private static void DoAircraftJob() { if (!jobAircrafts) { return; } Console.WriteLine($"\nCreating aircraft database .."); // read FA db if (jobAircraftsFAin) { string folder = Path.Combine(inputDir, faDbDirName); Console.WriteLine($"Reading FA Json database folder file: {folder}"); Console.WriteLine(icaoDbReader.ReadDb(ref IDB, folder)); Console.WriteLine($"DONE - ICAO ModeS Database contains {IDB.Count} records\n"); } // read BaseStation.sqb if (jobAircraftsBS) { string file = Path.Combine(inputDir, basestationFile); var ir = new BaseStationReader( ); if (!ir.Connect(file)) { Console.WriteLine($"ERROR Reading BaseStation SQB database file: {file} - cannot open database"); } else { Console.WriteLine($"Reading BaseStation SQB database file: {file}"); Console.WriteLine(ir.ReadDb(ref IDB)); Console.WriteLine($"DONE - ICAO ModeS Database contains {IDB.Count} records\n"); } } // read OSky aircrafts if (jobAircraftsCsv) { string file = Path.Combine(inputDir, icaoAcCsvFile); Console.WriteLine($"Reading ICAO Aircraft OpenSky CSV file: {file}"); Console.WriteLine(icaoCsvOpenSkyReader.ReadDb(ref IDB, file)); Console.WriteLine($"DONE - ICAO ModeS Database Database contains {IDB.Count} records\n"); } // read manual additions if (jobAircraftsAddon) { string file = Path.Combine(inputDir, icaoAddFile); Console.WriteLine($"Reading ICAO Aircraft Addon CSV file: {file}"); Console.WriteLine(icaoCsvAddonReader.ReadDb(ref IDB, file)); Console.WriteLine($"DONE - ICAO ModeS Database Database contains {IDB.Count} records\n"); } // Create now if (IDB.Count <= 0) { Console.WriteLine($"ERROR - No Aircraft records found, load populated BaseStation first\n"); return; } var iw = new AircraftsDB( ); Console.WriteLine(iw.CreateDB(Path.Combine(outputDir, aircraftsDBFile))); Console.WriteLine(iw.LoadDBfromIcao(IDB)); Console.WriteLine($"SQDB ICAO ModeS file written (or not if previously was an error...)"); }