private void ImportFromXMLFile(string filePath) { FileCabinetServiceSnapshot snapshot = new FileCabinetServiceSnapshot(); Dictionary <int, string> exceptions = new Dictionary <int, string>(); int recordsCount = 0; using (StreamReader reader = new StreamReader(filePath)) { snapshot.LoadFromXML(reader, out recordsCount); this.Service.Restore(snapshot, out exceptions); } foreach (var ex in exceptions) { write($"Record #{ex.Key} was not imported."); } write($"{recordsCount - exceptions.Count} records were imported from {filePath}."); }