private List <airfieldPlateData> getDoDPlatesInformation(int areaIdent) { List <airfieldPlateData> inputAirfieldsData = new List <airfieldPlateData>(); string sourceFolder = strDiscLoc + areaDiscLocations[areaIdent][1]; string[] airfields = Directory.GetDirectories(sourceFolder); for (int i = 0; i < airfields.Length; i++) { //Get ICAO code of input document string inputICAOcode = airfields[i].Remove(0, airfields[i].Length - 4).ToUpper().Replace("_", ""); //Get Name given by DoD document string airfieldLoc = TitleCase(Path.GetFileNameWithoutExtension(airfields[i]).Replace("__", "_").Replace("_", " ").Trim()); //Compare ICAO code to database to get country airfieldWorldData worldData = worldAirfieldData.Find(x => x.ICAO == inputICAOcode); //if(worldData == null) { worldData = worldAirfieldData.Find(x => x.IATA == inputICAOcode); } if (worldData == null) { worldData = new airfieldWorldData(); worldData.Country = " Unknown"; worldData.ICAO = inputICAOcode; } //Get approach plates for the airfield and add to list List <string> inputPlateFiles = new List <string>(); inputPlateFiles.AddRange(Directory.GetFiles(airfields[i])); List <string[]> inputPlates = new List <string[]>(); foreach (string p in inputPlateFiles) { //Get the name of the plate string plateName = TitleCase(Path.GetFileNameWithoutExtension(p).Replace("__", "_").Replace("_", " ").Trim()); //Add to the dicionary inputPlates.Add(new string[] { plateName, p }); } //Find the supplement if available string[] strSuppPageFiles = Directory.GetFiles(strDiscLoc + areaDiscLocations[areaIdent][2]); for (int a = 0; a < strSuppPageFiles.Length; a++) { if (airfields[i].Replace("_", "").Replace("-", "").Contains(Path.GetFileNameWithoutExtension(strSuppPageFiles[a]).Replace("_", ""))) { inputPlates.Add(new string[] { "Supplement", strSuppPageFiles[a] }); break; } } //Add airfield to list inputAirfieldsData.Add(new airfieldPlateData(airfieldLoc, worldData.Country, worldData.ICAO, inputPlates)); } return(inputAirfieldsData); }
private void loadWorldAirfieldData() { worldAirfieldData = new List <airfieldWorldData>(); listICAOcodes = new List <string>(); //get info from config file string fileContent = resFiles.airportsDirectory; using (StringReader reader = new StringReader(fileContent)) { string line; while ((line = reader.ReadLine()) != null) { //add line of chart info string[] values = line.Split(new string[] { "," }, StringSplitOptions.None); airfieldWorldData c = new airfieldWorldData(values); listICAOcodes.Add(c.ICAO); worldAirfieldData.Add(c); } } }