public void Load(string fileName) { using (insideStream = new MemoryStream()) { using (outStream = new FileStream(fileName, FileMode.Open)) { dataInConverter = new TxtLoadAlgorythm(); dataInConverter.Convert(insideStream, outStream); } insideStream.Position = 0; string str; while ((insideStream.Length) != (insideStream.Position)) { str = ReadTagFromStream(); if (str.StartsWith("<Rect>")) { figureFactory.SetFigureType(FigureType.RECT); Figure figure = figureFactory.CreateFigure(); figure.LoadFromStream(insideStream); store.Add(figure); } else if (str.StartsWith("<Line>")) { figureFactory.SetFigureType(FigureType.LINE); Figure figure = figureFactory.CreateFigure(); figure.LoadFromStream(insideStream); store.Add(figure); } else if (str.StartsWith("<Ellipse>")) { figureFactory.SetFigureType(FigureType.ELLIPSE); Figure figure = figureFactory.CreateFigure(); figure.LoadFromStream(insideStream); store.Add(figure); } insideStream.ReadByte(); insideStream.ReadByte(); } } }