예제 #1
0
        static public void OutputFromFile(out Figure[] figures, string path)
        {
            int difference     = 0;
            int counterOfLines = File.ReadAllLines(path).Length;

            Figure[] figuresTemp = new Figure[counterOfLines];

            using (StreamReader fstream = new StreamReader(path))
            {
                for (int i = 0; i < counterOfLines; i++)
                {
                    bool     flag = false;
                    string[] line = fstream.ReadLine().Split('|').ToArray();
                    Figure   tmp  = MyFactory.GetCertainFigure(line, ref flag, ref difference);

                    if (flag)
                    {
                        figuresTemp[i - difference] = tmp;
                    }
                }
            }

            figures = new Figure[figuresTemp.Length - difference];
            Array.Copy(figuresTemp, 0, figures, 0, figures.Length);
        }
예제 #2
0
        public override bool Equals(object obj)
        {
            Figure figure = MyFactory.GetCertainFigure(obj);

            return(this.Perimetr == figure.Perimetr);
        }