static void Main(string[] args) { //hard coded list of search ranges List<SearchRange> listOfSearchRanges = new List<SearchRange>(); listOfSearchRanges.Add(new SearchRange("Flight distance", 12000, 16000)); listOfSearchRanges.Add(new SearchRange("Passenger capacity", 300, 500)); //listOfSearchRanges.Add(new SearchRange("Freight capacity", 50, 100)); //hard coded file names and folder string fileStorage = @"D:\Temp\Aviation\"; string listOfAirplanesTextFile = "ListOfAirplanesTextFile.txt"; string outputTextFileName = "TextFileOutput.txt"; string searchRangesBinaryFile = "SearchRanges.dat"; string searchRangesXmlFile = "SearchRanges.xml"; string searchRangesJsonFile = "SearchRanges.json"; //Init aircompany object AirlineCompany airlineCompany = new AirlineCompany("My airline company"); //Init file objects TextFileReader textFileReader = new TextFileReader(fileStorage); TextFileWriter textFileWriter = new TextFileWriter(fileStorage); BinaryFileProcessor binaryFileProcessor = new BinaryFileProcessor(fileStorage); XmlFileProcessor xmlFileProcessor = new XmlFileProcessor(fileStorage); JsonFileProcessor jsonFileProcessor = new JsonFileProcessor(fileStorage); //Creating different kinds of files textFileWriter.CreateListOfAirplanesTextFile(listOfAirplanesTextFile); binaryFileProcessor.CreateSearchRangesBinaryFile(searchRangesBinaryFile, listOfSearchRanges); xmlFileProcessor.CreateSearchRangesXmlFile(searchRangesXmlFile, listOfSearchRanges); jsonFileProcessor.CreateSearchRangesJsonFile(searchRangesJsonFile, listOfSearchRanges); //Reading airplanes info from text file airlineCompany.CreateAircraftFleet(textFileReader.ReadAirplanesModelsFromTextFile(listOfAirplanesTextFile)); textFileWriter.AddLinesToOutputList(airlineCompany.ShowOverallPassengerCapacity()); textFileWriter.AddLinesToOutputList(airlineCompany.ShowOverallFreightCapacity()); textFileWriter.AddLinesToOutputList(airlineCompany.ShowSortedAirplanesByFlightDistance()); //Reading search ranges from binary file textFileWriter.AddLinesToOutputList(airlineCompany.ShowFoundAirplanesInRanges(binaryFileProcessor.ReadSearchRangesFromBinaryFile(searchRangesBinaryFile))); //Reading search ranges from xml file textFileWriter.AddLinesToOutputList(airlineCompany.ShowFoundAirplanesInRanges(xmlFileProcessor.ReadSearchRangesFromXmlFile(searchRangesXmlFile))); //Reading search ranges from json file textFileWriter.AddLinesToOutputList(airlineCompany.ShowFoundAirplanesInRanges(jsonFileProcessor.ReadSearchRangesFromJsonFile(searchRangesJsonFile))); //Writing output to text file textFileWriter.WriteDataToFile(outputTextFileName); }
public void Init() { testDirectory = @"TestDirectory"; fileProcessor = new BinaryFileProcessor(testDirectory); }
public void Cleanup() { fileProcessor = null; Directory.Delete(testDirectory, true); }