public static AllData ReadAll(ReaderDescriptor readerDescriptor, bool readRegistrationData = false) { using (var advancedReader = new AdvancedReader()) { advancedReader.SelectReader(readerDescriptor); advancedReader.ProcessNewCard(); var result = new AllData(); result.VehicleData = advancedReader.ReadVehicleData(); result.DocumentData = advancedReader.ReadDocumentData(); result.PersonalData = advancedReader.ReadPersonalData(); result.RegistrationData = new List<RegistrationData>(); if (readRegistrationData) { for (int i = 1; i <= 3; i++) { var registrationData = advancedReader.ReadRegistrationData(i); result.RegistrationData.Add(registrationData); } } return result; } }
private static void PrintData(AllData data) { PrintStruct(data.VehicleData); PrintStruct(data.DocumentData); PrintStruct(data.PersonalData); Console.WriteLine("{0} pieces of RegistrationData", data.RegistrationData.Count); }