public void execute(string code_, Storage storage_, int x_, int y_) { code = code_; storage = storage_; x = x_; y = y_; f = factory.createFigure(code, x, y); storage.setFigure(f); }
public void LOAD(MyFigureFactory factory, string filename, XmlReader rdr) { StreamReader reader = new StreamReader(filename); /*int count = System.IO.File.ReadAllLines(filename).Length; * for (int i = 0; i < count; i++) * { * string read; * read = reader.ReadLine(); * bool flag1 = false; * Figure figure = factory.createFigure(read, 0, 0); * if (figure != null) * { * * figure.load(reader, factory); * setFigure(figure); * } * * }*/ //int count = System.IO.File.ReadAllLines(filename)- 5; //for (int i = 0; i < count; i++) //{ //Строка для чтения string read = ""; read = reader.ReadLine(); //Пока файл читается while (rdr.Read()) { //Если встретился тег, тогда создаем соответвующую фигуру и загружаем ее в хранилище if (rdr.NodeType == XmlNodeType.Element && rdr.LocalName != "svg") { Figure figure = factory.createFigure(rdr.LocalName, 0, 0); figure.load(reader, factory, rdr); //Помещаем фигуру в хранилище setFigure(figure); } } notifyEveryine(); }