private void UpdateTMCFile(TMCFile tmcFile, string airportAFSFullDirectory) { var baseFolder = airportAFSFullDirectory + @"\Output\"; tmcFile.BaseOutputFolder = baseFolder; tmcFile.InputFolder = "./"; tmcFile.OutputFolder = ""; }
private void ConvertAirport(string icaoCode) { log.InfoFormat("Converting {0}", icaoCode); var airportXPFullDirectory = DirectoryHelper.GetAirportXPFullDirectory(icaoCode, XP2AFSConverterManager.Settings); var airportZipFilename = airportXPFullDirectory + @"\" + icaoCode + ".zip"; var airportFilename = airportXPFullDirectory + @"\airport.xml"; var airportSceneryFilename = airportXPFullDirectory + @"\scenery.xml"; var airportAFSFullDirectory = DirectoryHelper.GetAirportAFSFullDirectory(icaoCode, XP2AFSConverterManager.Settings); // Make sure the 'input' folder exists if (!Directory.Exists(airportAFSFullDirectory + @"\Input")) { Directory.CreateDirectory(airportAFSFullDirectory + @"\Input"); } var tscFilename = airportAFSFullDirectory + @"\Input\" + icaoCode + ".tsc"; var tocFilename = airportAFSFullDirectory + @"\Input\" + icaoCode + ".toc"; var tmcFilename = airportAFSFullDirectory + @"\Input\" + icaoCode + ".tmc"; if (File.Exists(airportZipFilename)) { // Parse the DST and DAT files var datFileLoader = new DATFileLoader(); var dsfFileLoader = new DSFFileLoader(); var datFile = datFileLoader.GetDATFileFromXPZip(icaoCode, airportZipFilename); var dsfFile = dsfFileLoader.GetDSFFileFromXPZip(icaoCode, airportZipFilename); // Create empty AFS files var tscFile = new TSCFile(); var tocFile = new TOCFile(); var tmcFile = new TMCFile(); // Convert the X-Plane files this.datConverter.Convert(datFile, tscFile, tocFile); this.dsfConverter.Convert(dsfFile, tscFile, tocFile); // Update the TMC file this.UpdateTMCFile(tmcFile, airportAFSFullDirectory); // Get strings of the AFS files var tscFileString = tscFile.ToString(); var tocFileString = tocFile.ToString(); var tmcFileString = tmcFile.ToString(); if (!Directory.Exists(airportAFSFullDirectory)) { Directory.CreateDirectory(airportAFSFullDirectory); } // Write the AFS files File.WriteAllText(tscFilename, tscFileString); File.WriteAllText(tocFilename, tocFileString); File.WriteAllText(tmcFilename, tmcFileString); var maxScriptGenerator = new MaxScriptGenerator(); maxScriptGenerator.GenerateScripts(icaoCode, datFile, dsfFile, tscFile, airportAFSFullDirectory, DirectoryHelper.GetTexturesDirectory(XP2AFSConverterManager.Settings)); log.Info("Airport conversion done"); } else { log.ErrorFormat("Could not find the data for airport {0} make sure it is downloaded", icaoCode); } }