Exemplo n.º 1
0
        public object Clone()
        {
            ProgramEntity obj = new ProgramEntity(
                (ObjectRef)_owner.Clone());

            if (_inports != null)
            {
                ProgramInPort[] a = new ProgramInPort[_inports.Length];
                for (int i = 0; i < _inports.Length; i++)
                {
                    _inports[i].ConstructorParameters = new object[] { obj };
                    a[i] = (ProgramInPort)_inports[i].Clone();
                }
                obj.Inports = a;
            }
            if (_outports != null)
            {
                ProgramOutPort[] a = new ProgramOutPort[_outports.Length];
                for (int i = 0; i < _outports.Length; i++)
                {
                    _outports[i].ConstructorParameters = new object[] { obj };
                    a[i] = (ProgramOutPort)_outports[i].Clone();
                }
                obj.Outports = a;
            }
            if (_newInport != null)
            {
                _newInport.ConstructorParameters = new object[] { obj };
                obj.NewInport = (LinkLineNodeInPort)_newInport.Clone();
            }
            if (_newOutport != null)
            {
                _newOutport.ConstructorParameters = new object[] { obj };
                obj.NewOutport = (LinkLineNodeOutPort)_newOutport.Clone();
            }
            return(obj);
        }
        public override void OnReadFromXmlNode(IXmlCodeReader serializer, XmlNode node)
        {
            _xmlNode = node;
            base.OnReadFromXmlNode(serializer, node);
            _fixed = XmlSerialization.GetAttributeBool(node, MathNodeRoot.XMLATT_FIXED);
            object v;

            if (XmlSerialization.ReadValueFromChildNode(node, "Color", out v))
            {
                _color = (Color)v;
            }
            if (XmlSerialization.ReadValueFromChildNode(node, "Location", out v))
            {
                _location = (Point)v;
            }
            TextColor = _color;
            ReadVariable(node);
            XmlNode nd = node.SelectSingleNode(XML_Cast);

            if (nd != null)
            {
                _castTo = (ProgramEntity)XmlSerialization.ReadFromXmlNode(serializer, nd);
            }
        }