Example #1
0
        public Polygon2D Read()
        {
            StreamReader Reader = new StreamReader(Path);
            string msg = null;
            int count = this.GetCount();

            indices = new int[count];
            points = new Point2D[count];
            while ((msg = Reader.ReadLine()) != null)
            {
                if (msg.Length > 0 && msg[0] == '<')
                {
                    XWFParser xwfParser = new XWFParser(this.Path);

                    return xwfParser.Read();
                }
                this.Parse(msg);
            }

            Reader.Close();

            return this.BuildPolygon();
        }
Example #2
0
        public Polygon2D Read()
        {
            StreamReader Reader = new StreamReader(Path);
            string       msg    = null;
            int          count  = this.GetCount();

            indices = new int[count];
            points  = new Point2D[count];
            while ((msg = Reader.ReadLine()) != null)
            {
                if (msg.Length > 0 && msg[0] == '<')
                {
                    XWFParser xwfParser = new XWFParser(this.Path);

                    return(xwfParser.Read());
                }
                this.Parse(msg);
            }

            Reader.Close();

            return(this.BuildPolygon());
        }
Example #3
0
        private void Save(string strFileName)
        {
            Polygon2D polygon = null;

            if (StatusController.availablePartition == Partition.Left)
            {
                polygon = this.FirstPolygon;
                this.FileName1 = strFileName;
            }
            else
            {
                polygon = this.SecondPolygon;
                this.FileName2 = strFileName;
            }

            string[] s = strFileName.Split('.');

            if (s[s.Length - 1] != "xwf")
            {
                WFParser wfParser = new WFParser(strFileName);
                bool isWritable = false;

                while (!isWritable)
                {
                    try
                    {
                        wfParser.Write(polygon);
                        isWritable = true;
                    }
                    catch (IOException)
                    {
                    }
                }
            }

            else
            {
                XWFParser xwfParser = new XWFParser(strFileName);
                bool isWritable = false;

                while (!isWritable)
                {
                    try
                    {
                        xwfParser.Write(polygon);
                        isWritable = true;
                    }
                    catch (IOException)
                    {
                    }
                }
            }
        }
Example #4
0
 private void menuItem14_Click(object sender, System.EventArgs e)
 {
     XWFParser parser = new XWFParser("test.xml");
     Polygon2D polygon = parser.Read();
     this.LeftPolygon = new Polygon2DAdorner(polygon);
     this.Invalidate();
 }
Example #5
0
 private void menuItem13_Click(object sender, System.EventArgs e)
 {
     XWFParser parser = new XWFParser("test.xml");
     parser.Write(this.FirstPolygon);
 }