public static Aff Parse(string pathToDb) { var pathToFile = Path.Combine(pathToDb, "AFF.txt"); var lines = File.ReadAllLines(pathToFile); var aff = new Aff(); foreach (var line in lines) { using (var reader = new StringReader(line)) { var recordTypeBuffer = new char[4]; reader.Read(recordTypeBuffer); var recordType = new string(recordTypeBuffer); switch (recordType) { case "AFF1": var aff1 = RecordParser.Parse <Aff1Record>(reader); aff.Aff1Records.Add(aff1); break; case "AFF2": var aff2 = RecordParser.Parse <Aff2Record>(reader); aff.Aff2Records.Add(aff2); break; case "AFF3": var aff3 = RecordParser.Parse <Aff3Record>(reader); aff.Aff3Records.Add(aff3); break; case "AFF4": var aff4 = RecordParser.Parse <Aff4Record>(reader); aff.Aff4Records.Add(aff4); break; } } } return(aff); }
public static void Main(string[] args) { var pathToDb = args[0]; Console.WriteLine($"Path to DB: {pathToDb}"); var aff = Aff.Parse(pathToDb); var savePath = Path.Combine(pathToDb, "ArtccFacility.csv"); SaveToCSV(aff.Aff1Records, savePath); savePath = Path.Combine(pathToDb, "ArtccRemarks.csv"); SaveToCSV(aff.Aff2Records, savePath); savePath = Path.Combine(pathToDb, "ArtccFreq.csv"); SaveToCSV(aff.Aff3Records, savePath); savePath = Path.Combine(pathToDb, "ArtccFreqRemarks.csv"); SaveToCSV(aff.Aff4Records, savePath); //var arb = Arb.Parse(pathToDb); //savePath = Path.Combine(pathToDb, "ArtccBoundarySegment.csv"); //SaveToCSV(arb.Arb1Record, savePath); }