Esempio n. 1
0
        public bool Noi2Objs(CFOUNDNODE pFoundNode)
        {
            bool result = false;

            checked
            {
                if (pFoundNode.FoundObject.GetObjType() == OBJECTTYPE.Curve | pFoundNode.FoundObject.GetObjType() == OBJECTTYPE.Line)
                {
                    NodesShapeGraphic nodesShapeGraphic = (NodesShapeGraphic)pFoundNode.FoundObject;
                    if (pFoundNode.NodeIndex == 0 | pFoundNode.NodeIndex == nodesShapeGraphic.Nodes.Count - 1)
                    {
                        CFOUNDNODE cFOUNDNODE = this.Tim2ndNode(pFoundNode);
                        if (pFoundNode.NodeIndex == 0)
                        {
                            nodesShapeGraphic.ReverseNodes();
                        }
                        if (cFOUNDNODE.NodeIndex == 0)
                        {
                            NodesShapeGraphic nodesShapeGraphic2 = (NodesShapeGraphic)cFOUNDNODE.FoundObject;
                            if (nodesShapeGraphic2.Nodes.Count > 1)
                            {
                                int arg_A1_0 = 1;
                                int num      = nodesShapeGraphic2.Nodes.Count - 1;
                                for (int i = arg_A1_0; i <= num; i++)
                                {
                                    nodesShapeGraphic.Nodes.Add(nodesShapeGraphic2.Nodes[i]);
                                }
                            }
                            this.m_GObjs.Remove(cFOUNDNODE.FoundObject);
                            result = true;
                        }
                        else if (cFOUNDNODE.NodeIndex > 0)
                        {
                            NodesShapeGraphic nodesShapeGraphic3 = (NodesShapeGraphic)cFOUNDNODE.FoundObject;
                            if (nodesShapeGraphic3.Nodes.Count > 1)
                            {
                                for (int j = nodesShapeGraphic3.Nodes.Count - 2; j >= 0; j += -1)
                                {
                                    nodesShapeGraphic.Nodes.Add(nodesShapeGraphic3.Nodes[j]);
                                }
                            }
                            this.m_GObjs.Remove(cFOUNDNODE.FoundObject);
                            result = true;
                        }
                    }
                }
                return(result);
            }
        }
Esempio n. 2
0
        private CFOUNDNODE Tim2ndNode(CFOUNDNODE pFoundNode)
        {
            CFOUNDNODE cFOUNDNODE = new CFOUNDNODE();

            cFOUNDNODE.NodeIndex = -1;
            checked
            {
                try
                {
                    IEnumerator enumerator = this.m_GObjs.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        GraphicObject graphicObject = (GraphicObject)enumerator.Current;
                        if ((graphicObject.GetObjType() == OBJECTTYPE.Curve | graphicObject.GetObjType() == OBJECTTYPE.Line) && graphicObject != pFoundNode.FoundObject)
                        {
                            NodesShapeGraphic nodesShapeGraphic  = (NodesShapeGraphic)graphicObject;
                            NodesShapeGraphic nodesShapeGraphic2 = (NodesShapeGraphic)pFoundNode.FoundObject;
                            if (nodesShapeGraphic.Nodes[0].X == nodesShapeGraphic2.Nodes[pFoundNode.NodeIndex].X & nodesShapeGraphic.Nodes[0].Y == nodesShapeGraphic2.Nodes[pFoundNode.NodeIndex].Y)
                            {
                                cFOUNDNODE.FoundObject = graphicObject;
                                cFOUNDNODE.NodeIndex   = 0;
                            }
                            else if (nodesShapeGraphic.Nodes[nodesShapeGraphic.Nodes.Count - 1].X == nodesShapeGraphic2.Nodes[pFoundNode.NodeIndex].X & nodesShapeGraphic.Nodes[nodesShapeGraphic.Nodes.Count - 1].Y == nodesShapeGraphic2.Nodes[pFoundNode.NodeIndex].Y)
                            {
                                cFOUNDNODE.FoundObject = graphicObject;
                                cFOUNDNODE.NodeIndex   = nodesShapeGraphic.Nodes.Count - 1;
                            }
                        }
                    }
                }
                finally
                {
                    IEnumerator enumerator;
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                return(cFOUNDNODE);
            }
        }
Esempio n. 3
0
        private void khs2xml(AxMap pMap, ref XmlTextWriter wr)
        {
            wr.WriteStartElement("KyHieus");
            wr.WriteAttributeString("CX", pMap.CenterX.ToString("#.0000"));
            wr.WriteAttributeString("CY", pMap.CenterY.ToString("#.0000"));
            wr.WriteAttributeString("Zoom", pMap.Zoom.ToString());
            checked
            {
                try
                {
                    IEnumerator enumerator = this.List.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        CSymbol mKH = (CSymbol)enumerator.Current;
                        wr.WriteStartElement("KyHieu");
                        bool flag = mKH.Description.Length > 0;
                        if (flag)
                        {
                            wr.WriteAttributeString("Desc", mKH.Description);
                        }
                        flag = mKH.Blinking;
                        if (flag)
                        {
                            wr.WriteAttributeString("Blink", mKH.Blinking.ToString());
                        }
                        wr.WriteAttributeString("Zoom", mKH.Zoom.ToString());
                        wr.WriteAttributeString("MWi", mKH.MWidth.ToString());
                        wr.WriteAttributeString("GocX", mKH.GocX.ToString("#.0000"));
                        wr.WriteAttributeString("GocY", mKH.GocY.ToString("#.0000"));
                        try
                        {
                            IEnumerator enumerator2 = mKH.GObjs.GetEnumerator();
                            while (enumerator2.MoveNext())
                            {
                                GraphicObject mPart = (GraphicObject)enumerator2.Current;
                                wr.WriteStartElement("Part");
                                OBJECTTYPE mType = mPart.GetObjType();
                                wr.WriteAttributeString("Type", mType.ToString());
                                flag = (mType == OBJECTTYPE.Text);
                                if (flag)
                                {
                                    TextGraphic mTextObj = (TextGraphic)mPart;
                                    wr.WriteAttributeString("Text", mTextObj.Text);
                                    wr.WriteAttributeString("FName", mTextObj.Font.Name);
                                    wr.WriteAttributeString("FSize", mTextObj.Font.Size.ToString());
                                    wr.WriteAttributeString("FStyle", mTextObj.Font.Style.ToString());
                                    wr.WriteAttributeString("FColor", Conversions.ToString(mTextObj.Color.ToArgb()));
                                    wr.WriteStartElement("Pos");
                                    wr.WriteAttributeString("X", mTextObj.X.ToString());
                                    wr.WriteAttributeString("Y", mTextObj.Y.ToString());
                                    wr.WriteAttributeString("A", mTextObj.Rotation.ToString());
                                    wr.WriteEndElement();
                                }
                                else
                                {
                                    flag = (mType == OBJECTTYPE.Table);
                                    if (flag)
                                    {
                                        TableGraphic mTableObj = (TableGraphic)mPart;
                                        wr.WriteStartElement("TBL");
                                        wr.WriteAttributeString("X", mTableObj.X.ToString());
                                        wr.WriteAttributeString("Y", mTableObj.Y.ToString());
                                        wr.WriteAttributeString("W", mTableObj.Width.ToString());
                                        wr.WriteAttributeString("H", mTableObj.Height.ToString());
                                        wr.WriteAttributeString("A", mTableObj.Rotation.ToString());
                                        wr.WriteAttributeString("Cols", mTableObj.ColsNo.ToString());
                                        wr.WriteAttributeString("Rows", mTableObj.RowsNo.ToString());
                                        wr.WriteAttributeString("BColor", Conversions.ToString(mTableObj.BorderColor.ToArgb()));
                                        wr.WriteAttributeString("BWidth", mTableObj.BorderWidth.ToString());
                                        wr.WriteAttributeString("LColor", Conversions.ToString(mTableObj.LineColor.ToArgb()));
                                        wr.WriteAttributeString("LWidth", mTableObj.LineWidth.ToString());
                                        wr.WriteAttributeString("FiColor", Conversions.ToString(mTableObj.FiColor.ToArgb()));
                                        string str       = Conversions.ToString(mTableObj.AWidth[0]);
                                        int    arg_47A_0 = 1;
                                        int    num       = mTableObj.ColsNo - 1;
                                        int    i         = arg_47A_0;
                                        while (true)
                                        {
                                            int arg_4A4_0 = i;
                                            int num2      = num;
                                            if (arg_4A4_0 > num2)
                                            {
                                                break;
                                            }
                                            str = str + "|" + Conversions.ToString(mTableObj.AWidth[i]);
                                            i++;
                                        }
                                        wr.WriteAttributeString("AWS", str);
                                        str = Conversions.ToString(mTableObj.AHeight[0]);
                                        int arg_4CF_0 = 1;
                                        int num3      = mTableObj.RowsNo - 1;
                                        i = arg_4CF_0;
                                        while (true)
                                        {
                                            int arg_4F9_0 = i;
                                            int num2      = num3;
                                            if (arg_4F9_0 > num2)
                                            {
                                                break;
                                            }
                                            str = str + "|" + Conversions.ToString(mTableObj.AHeight[i]);
                                            i++;
                                        }
                                        wr.WriteAttributeString("AHS", str);
                                        i = 0;
                                        try
                                        {
                                            IEnumerator enumerator3 = mTableObj.Cells.GetEnumerator();
                                            while (enumerator3.MoveNext())
                                            {
                                                CCell mCell = (CCell)enumerator3.Current;
                                                i++;
                                                wr.WriteStartElement("Cell");
                                                wr.WriteAttributeString("iR", mCell.iRow.ToString());
                                                wr.WriteAttributeString("iC", mCell.iCol.ToString());
                                                wr.WriteAttributeString("RNo", mCell.RowsNo.ToString());
                                                wr.WriteAttributeString("CNo", mCell.ColsNo.ToString());
                                                wr.WriteAttributeString("Text", mCell.Text);
                                                wr.WriteAttributeString("FName", mCell.Font.Name);
                                                wr.WriteAttributeString("FSize", mCell.Font.Size.ToString());
                                                wr.WriteAttributeString("FStyle", mCell.Font.Style.ToString());
                                                wr.WriteAttributeString("Color", Conversions.ToString(mCell.Color.ToArgb()));
                                                wr.WriteElementString("i", i.ToString());
                                                wr.WriteEndElement();
                                            }
                                        }
                                        finally
                                        {
                                            IEnumerator enumerator3;
                                            flag = (enumerator3 is IDisposable);
                                            if (flag)
                                            {
                                                (enumerator3 as IDisposable).Dispose();
                                            }
                                        }
                                        wr.WriteEndElement();
                                    }
                                    else
                                    {
                                        flag = (mType == OBJECTTYPE.EmbeddedImage);
                                        if (flag)
                                        {
                                            EmbeddedImageGraphic mImageObj = (EmbeddedImageGraphic)mPart;
                                            wr.WriteAttributeString("ITYPE", mImageObj.ImageType);
                                            wr.WriteAttributeString("IMAGEW", mImageObj.Width.ToString());
                                            wr.WriteAttributeString("IMAGEH", mImageObj.Height.ToString());
                                            string strImage  = "";
                                            string imageType = mImageObj.ImageType;
                                            if (Operators.CompareString(imageType, "wmf", false) == 0 || Operators.CompareString(imageType, "emf", false) == 0)
                                            {
                                                goto IL_74D;
                                            }
                                            if (Operators.CompareString(imageType, "kro", false) == 0)
                                            {
                                                goto IL_74D;
                                            }
                                            bool arg_74E_0 = false;
IL_74E:
                                            flag = arg_74E_0;
                                            if (flag)
                                            {
                                                try
                                                {
                                                    object mFileName = "tmp2.kro";
                                                    Image  mMetaFile = mImageObj.Image;
                                                    mMetaFile.Save(Conversions.ToString(mFileName));
                                                    byte[] arrImageByte = this.GetarrImage(Conversions.ToString(mFileName));
                                                    strImage = Convert.ToBase64String(arrImageByte);
                                                }
                                                catch (Exception expr_78D)
                                                {
                                                    ProjectData.SetProjectError(expr_78D);
                                                    Exception ex = expr_78D;
                                                    Interaction.MsgBox("kro sai: " + ex.Message, MsgBoxStyle.OkOnly, null);
                                                    ProjectData.ClearProjectError();
                                                }
                                            }
                                            else
                                            {
                                                MemoryStream memStream = new MemoryStream();
                                                mImageObj.Image.Save(memStream, ImageFormat.Bmp);
                                                strImage = Convert.ToBase64String(memStream.ToArray());
                                            }
                                            wr.WriteAttributeString("IMAGE", strImage);
                                            wr.WriteStartElement("Pos");
                                            wr.WriteAttributeString("X", mImageObj.X.ToString());
                                            wr.WriteAttributeString("Y", mImageObj.Y.ToString());
                                            wr.WriteAttributeString("A", mImageObj.Rotation.ToString());
                                            wr.WriteEndElement();
                                            goto IL_CDF;
IL_74D:
                                            arg_74E_0 = true;
                                            goto IL_74E;
                                        }
                                        ShapeGraphic mShapeObj = (ShapeGraphic)mPart;
                                        wr.WriteAttributeString("Color", Conversions.ToString(mShapeObj.LineColor.ToArgb()));
                                        wr.WriteAttributeString("Width", mShapeObj.LineWidth.ToString());
                                        flag = (mShapeObj.LineStyle > 0);
                                        if (flag)
                                        {
                                            wr.WriteAttributeString("Style", mShapeObj.LineStyle.ToString());
                                            wr.WriteAttributeString("SWidth", mShapeObj.StyleWidth.ToString());
                                        }
                                        flag = (mShapeObj.Line2Width > 0f);
                                        if (flag)
                                        {
                                            wr.WriteAttributeString("Color2", Conversions.ToString(mShapeObj.Line2Color.ToArgb()));
                                            wr.WriteAttributeString("Width2", mShapeObj.Line2Width.ToString());
                                        }
                                        flag = (mShapeObj.DValues.Length > 6);
                                        if (flag)
                                        {
                                            wr.WriteAttributeString("DV", mShapeObj.DValues);
                                        }
                                        flag = mShapeObj.Fill;
                                        if (flag)
                                        {
                                            wr.WriteAttributeString("Fill", mShapeObj.Fill.ToString());
                                            wr.WriteAttributeString("FColor", Conversions.ToString(mShapeObj.FillColor.ToArgb()));
                                            wr.WriteAttributeString("HColor", Conversions.ToString(mShapeObj.HatchColor.ToArgb()));
                                            wr.WriteAttributeString("HStyle", mShapeObj.HatchStyle.ToString());
                                        }
                                        flag = (mType == OBJECTTYPE.Ellipse);
                                        if (flag)
                                        {
                                            EllipseGraphic mEllipseObj = (EllipseGraphic)mShapeObj;
                                            wr.WriteStartElement("Rect");
                                            wr.WriteAttributeString("X", mEllipseObj.X.ToString());
                                            wr.WriteAttributeString("Y", mEllipseObj.Y.ToString());
                                            wr.WriteAttributeString("W", mEllipseObj.Width.ToString());
                                            wr.WriteAttributeString("H", mEllipseObj.Height.ToString());
                                            wr.WriteAttributeString("A", mEllipseObj.Rotation.ToString());
                                            wr.WriteEndElement();
                                        }
                                        else
                                        {
                                            flag = (mType == OBJECTTYPE.Pie);
                                            if (flag)
                                            {
                                                PieGraphic mPieObj = (PieGraphic)mShapeObj;
                                                wr.WriteStartElement("Pie");
                                                wr.WriteAttributeString("X", mPieObj.X.ToString());
                                                wr.WriteAttributeString("Y", mPieObj.Y.ToString());
                                                wr.WriteAttributeString("W", mPieObj.Width.ToString());
                                                wr.WriteAttributeString("H", mPieObj.Height.ToString());
                                                wr.WriteAttributeString("ST", mPieObj.StartAngle.ToString());
                                                wr.WriteAttributeString("SW", mPieObj.SweepAngle.ToString());
                                                flag = mPieObj.IsArc;
                                                if (flag)
                                                {
                                                    wr.WriteAttributeString("ARC", mPieObj.IsArc.ToString());
                                                }
                                                wr.WriteAttributeString("A", mPieObj.Rotation.ToString());
                                                wr.WriteEndElement();
                                            }
                                            else
                                            {
                                                int i = 0;
                                                NodesShapeGraphic mNodesShapeObj = (NodesShapeGraphic)mShapeObj;
                                                try
                                                {
                                                    IEnumerator enumerator4 = mNodesShapeObj.Nodes.GetEnumerator();
                                                    while (enumerator4.MoveNext())
                                                    {
                                                        CNODE mNode = (CNODE)enumerator4.Current;
                                                        i++;
                                                        wr.WriteStartElement("Node");
                                                        wr.WriteAttributeString("X", mNode.Pt.X.ToString());
                                                        wr.WriteAttributeString("Y", mNode.Pt.Y.ToString());
                                                        flag = mNode.IsControl;
                                                        if (flag)
                                                        {
                                                            wr.WriteAttributeString("Type", mNode.IsControl.ToString());
                                                        }
                                                        wr.WriteElementString("i", i.ToString());
                                                        wr.WriteEndElement();
                                                    }
                                                }
                                                finally
                                                {
                                                    IEnumerator enumerator4;
                                                    flag = (enumerator4 is IDisposable);
                                                    if (flag)
                                                    {
                                                        (enumerator4 as IDisposable).Dispose();
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
IL_CDF:
                                wr.WriteEndElement();
                            }
                        }
                        finally
                        {
                            IEnumerator enumerator2;
                            flag = (enumerator2 is IDisposable);
                            if (flag)
                            {
                                (enumerator2 as IDisposable).Dispose();
                            }
                        }
                        wr.WriteEndElement();
                    }
                }
                finally
                {
                    IEnumerator enumerator;
                    bool        flag = enumerator is IDisposable;
                    if (flag)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                wr.WriteEndElement();
            }
        }