public List <PolygraphicItem> ReadFromFile(string path) { using (StreamReader sr = new StreamReader(path)) { string line; while ((line = sr.ReadLine()) != null) { Newspaper newspaper = new Newspaper(); string[] newspaperParts = line.Split('|'); _newspaperSetter.SetPolygraphicItem(newspaperParts[0], newspaper); for (int i = 1; i < newspaperParts.Length; i++) { AuthoredItem article = new AuthoredItem(); _newspaperSetter.SetPolygraphicItem(newspaperParts[i], article); newspaper.Articles.Add(article); } _list.Add(newspaper); } } return(_list); }
public List <PolygraphicItem> ReadFromFile(string path) { using (StreamReader sr = new StreamReader(path)) { string line; while ((line = sr.ReadLine()) != null) { Magazine magazine = new Magazine(); string[] magazinsParts = line.Split('|'); _itemSetter.SetPolygraphicItem(magazinsParts[0], magazine); for (int i = 1; i < magazinsParts.Length; i++) { AuthoredItem article = new AuthoredItem(); _itemSetter.SetPolygraphicItem(magazinsParts[i], article); magazine.Articles.Add(article); } _list.Add(magazine); } } return(_list); }
public List <PolygraphicItem> ReadFromFile(string path) { _list = new List <PolygraphicItem>(); using (StreamReader sr = new StreamReader(path)) { string line; while ((line = sr.ReadLine()) != null) { AuthoredItem authoredItem = new AuthoredItem(); _bookSetter.SetPolygraphicItem(line, authoredItem); _list.Add(authoredItem); } } return(_list); }