예제 #1
0
        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();
        }
예제 #2
0
        public override void load(StreamReader reader, FigureFactory factory, XmlReader rdr)
        {
            string count_;

            count_ = reader.ReadLine();
            for (int i = 0; i < Convert.ToInt32(count_) * 6; i++)
            {
                string read;
                read = reader.ReadLine();
                bool   flag1  = false;
                Figure figure = factory.createFigure(read, 0, 0);
                if (figure == null)
                {
                    flag1 = true;
                }
                if (flag1 == false)
                {
                    {
                        figure.load(reader, factory, rdr);
                        add_toGroup(figure);
                    }
                }
            }
        }
예제 #3
0
 public override void load(StreamReader reader, FigureFactory factory, XmlReader rdr)
 {
     sticky.load(reader, factory, rdr);
 }