コード例 #1
0
ファイル: Form1.cs プロジェクト: akira-cn/Traingulate-lib
        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)
                    {
                    }
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: akira-cn/Traingulate-lib
        private void Open(string strFileName)
        {
            WFParser wfParser = new WFParser(strFileName);

            Polygon2D polygon = wfParser.Read();

            if (StatusController.availablePartition == Partition.Left)
            {
                this.LeftPolygon = new Polygon2DAdorner(polygon);
                this.FileName1 = strFileName;
            }
            else
            {
                this.RightPolygon = new Polygon2DAdorner(polygon);
                this.FileName2 = strFileName;
            }
            this.LeftPolygon.ShowIndices = this.showIndicesMenuItem.Checked;
            this.RightPolygon.ShowIndices = this.showIndicesMenuItem.Checked;
        }