Example #1
0
        public override XmlTreeNode SerializeToXML(XmlTreeNode p_Parent)
        {
            var element = base.SerializeToXML(p_Parent);
            element.AddParameter("Value", Value.ToString());

            return element;
        }
Example #2
0
        public override XmlTreeNode SerializeToXML(XmlTreeNode p_Parent)
        {
            var element = base.SerializeToXML(p_Parent);
            element.AddParameter("Value", Common.StringConverter.ToString(Value));

            return element;
        }
Example #3
0
 public AbsNode(XmlTreeNode p_TreeNode, NodeGraphView p_View)
     : base(p_TreeNode, p_View)
 {
     this.m_sName = "Abs(A)";
     this.m_Connectors.Add(new NodeGraphConnector("A", this, ConnectorType.InputConnector, 0));
     this.m_Connectors.Add(new NodeGraphConnector("Result", this, ConnectorType.OutputConnector, 0));
     this.Height = 45;
 }
Example #4
0
 public ReferenceRoot(XmlTreeNode p_TreeNode, NodeGraphView p_View)
     : base(p_TreeNode, p_View)
 {
     this.m_sName = "Output";
     this.m_Connectors.Add(new NodeGraphConnector("Result 1", this, ConnectorType.InputConnector, 0));
     this.m_Connectors.Add(new NodeGraphConnector("Result 2", this, ConnectorType.InputConnector, 1));
     this.m_Connectors.Add(new NodeGraphConnector("Result 3", this, ConnectorType.InputConnector, 2));
     this.Height = 86;
 }
Example #5
0
 public DivideNode(XmlTreeNode p_TreeNode, NodeGraphView p_View)
     : base(p_TreeNode, p_View)
 {
     this.m_sName = "A/B";
     this.m_Connectors.Add(new NodeGraphConnector("A", this, ConnectorType.InputConnector, 0));
     this.m_Connectors.Add(new NodeGraphConnector("B", this, ConnectorType.InputConnector, 1));
     this.m_Connectors.Add(new NodeGraphConnector("Result (A/B)", this, ConnectorType.OutputConnector, 0));
     this.Height = 64;
 }
Example #6
0
        /// <summary>
        /// SERIALIZATION: Creates a NodeGraphLink, given an XML Serialized copy of the link and a view
        /// </summary>
        /// <param name="p_TreeNode"></param>
        /// <param name="p_View"></param>
        public NodeGraphLink(XmlTreeNode p_TreeNode, NodeGraphView p_View)
        {
            int v_InputNodeId = int.Parse(p_TreeNode.m_attributes["InputNodeId"]);
            int v_OutputNodeId = int.Parse(p_TreeNode.m_attributes["OutputNodeId"]);
            int v_InputNodeConnectorIdx = int.Parse(p_TreeNode.m_attributes["InputNodeConnectorIdx"]);
            int v_OutputNodeConnectorIdx = int.Parse(p_TreeNode.m_attributes["OutputNodeConnectorIdx"]);

            this.m_InputConnector = p_View.NodeCollection[v_InputNodeId].Connectors[v_InputNodeConnectorIdx];
            this.m_OutputConnector = p_View.NodeCollection[v_OutputNodeId].Connectors[v_OutputNodeConnectorIdx];
        }
Example #7
0
 public FloatConstNode(XmlTreeNode p_TreeNode, NodeGraphView p_View)
     : base(p_TreeNode, p_View)
 {
     this.m_sName = "Float: NAN";
     this.m_Connectors.Add(new NodeGraphConnector("Value", this, ConnectorType.OutputConnector, 0));
     this.Width = 80;
     this.Height = 45;
     this.Value = 0.0f;
    
 }
Example #8
0
 public TemplateModule(XmlTreeNode p_TreeNode, NodeGraphView p_View)
     : base(p_TreeNode, p_View)
 {
     this.m_sName = "TemplateModule";
     this.m_Connectors.Add(new NodeGraphConnector("Input 0", this, ConnectorType.InputConnector, 0));
     this.m_Connectors.Add(new NodeGraphConnector("Input 1", this, ConnectorType.InputConnector, 1));
     this.m_Connectors.Add(new NodeGraphConnector("Output 0", this, ConnectorType.OutputConnector, 0));
     this.m_Connectors.Add(new NodeGraphConnector("Output 1", this, ConnectorType.OutputConnector, 1));
     this.Height = 100;
 }
Example #9
0
 /// <summary>
 /// SERIALIZATION: Creates a NodeGraphNode from a XML Serialized Copy
 /// </summary>
 /// <param name="p_Input"></param>
 /// <param name="p_View"></param>
 public NodeGraphNode(Xml.XmlTreeNode p_Input, NodeGraphView p_View)
 {
     this.m_oView          = p_View;
     this.m_sName          = p_Input.m_attributes["Name"];
     this.m_sComment       = p_Input.m_attributes["Comment"];
     this.X                = int.Parse(p_Input.m_attributes["X"]);
     this.Y                = int.Parse(p_Input.m_attributes["Y"]);
     this.Width            = int.Parse(p_Input.m_attributes["Width"]);
     this.Height           = int.Parse(p_Input.m_attributes["Height"]);
     this.m_bCanBeSelected = bool.Parse(p_Input.m_attributes["CanBeSelected"]);
     this.m_Connectors     = new List <NodeGraphConnector>();
 }
Example #10
0
        /// <summary>
        /// VIRTUAL: Serializes the current Node to XML Serialized copy. Must be overriden to implement custom members.
        /// </summary>
        /// <param name="p_Parent"></param>
        /// <returns></returns>
        public virtual Xml.XmlTreeNode SerializeToXML(Xml.XmlTreeNode p_Parent)
        {
            Xml.XmlTreeNode v_Out = new Xml.XmlTreeNode(Xml.SerializationUtils.GetFullTypeName(this), p_Parent);

            v_Out.AddParameter("Name", this.Name);
            v_Out.AddParameter("X", this.X.ToString());
            v_Out.AddParameter("Y", this.Y.ToString());
            v_Out.AddParameter("Width", this.Width.ToString());
            v_Out.AddParameter("Height", this.Height.ToString());
            v_Out.AddParameter("Comment", this.Comment.ToString());
            v_Out.AddParameter("CanBeSelected", this.CanBeSelected.ToString());
            return(v_Out);
        }
Example #11
0
        /// <summary>
        /// STATIC: Deserializes a new NodeGraphNode given a XML Serialized Copy
        /// </summary>
        /// <param name="p_Node"></param>
        /// <param name="p_View"></param>
        /// <returns></returns>
        public static NodeGraphNode DeserializeFromXML(Xml.XmlTreeNode p_Node, NodeGraphView p_View)
        {
            string className = p_Node.m_nodeName;

            object[] arguments = { p_Node, p_View };

            object v_Out = System.Reflection.Assembly.GetEntryAssembly().CreateInstance(className, false,
                                                                                        System.Reflection.BindingFlags.CreateInstance,
                                                                                        null,
                                                                                        arguments, System.Globalization.CultureInfo.GetCultureInfo("fr-fr"),
                                                                                        null);

            return(v_Out as NodeGraphNode);
        }
Example #12
0
        /// <summary>
        /// Loads an XML Stream into current XMLTree, destroying any objects in It.
        /// </summary>
        /// <param name="p_Stream"></param>
        public void LoadXML(Stream p_Stream)
        {
            XmlReaderSettings xKeySettings = new XmlReaderSettings();

            xKeySettings.IgnoreWhitespace = true;
            xKeySettings.IgnoreComments   = true;

            XmlReader xReader = XmlReader.Create(p_Stream, xKeySettings);

            if (!xReader.IsEmptyElement)
            {
                xReader.Read();
                if (xReader.NodeType == XmlNodeType.XmlDeclaration)
                {
                    xReader.Read();
                }

                m_rootNode = new XmlTreeNode(xReader, null);
            }

            m_rootNode.GetType();
            xReader.Close();
        }
Example #13
0
        /// <summary>
        /// VIRTUAL: Serializes the current Node to XML Serialized copy. Must be overriden to implement custom members.
        /// </summary>
        /// <param name="p_Parent"></param>
        /// <returns></returns>
        public virtual Xml.XmlTreeNode SerializeToXML(Xml.XmlTreeNode p_Parent)
        {
            Xml.XmlTreeNode v_Out = new Xml.XmlTreeNode(Xml.SerializationUtils.GetFullTypeName(this), p_Parent);

            v_Out.AddParameter("Name", this.Name);
            v_Out.AddParameter("X", this.X.ToString());
            v_Out.AddParameter("Y", this.Y.ToString());
            v_Out.AddParameter("Width", this.Width.ToString());
            v_Out.AddParameter("Height", this.Height.ToString());
            v_Out.AddParameter("Comment", this.Comment.ToString());
            v_Out.AddParameter("CanBeSelected", this.CanBeSelected.ToString());
            return v_Out;
        }
Example #14
0
 public override NodeGraphControl.Xml.XmlTreeNode SerializeToXML(NodeGraphControl.Xml.XmlTreeNode p_Parent)
 {
     NodeGraphControl.Xml.XmlTreeNode v_Out = base.SerializeToXML(p_Parent);
     v_Out.AddParameter("Value", Value.ToString(System.Globalization.CultureInfo.GetCultureInfo("en-us")));
     return(v_Out);
 }
Example #15
0
 public FloatLerpNode(XmlTreeNode p_TreeNode, NodeGraphView p_View)
     : base(p_TreeNode, p_View)
 {
     Setup();
 }
Example #16
0
        /// <summary>
        /// (Adoption) Adds an existing Child to this node's children.
        /// NOTE: WHEN ADOPTING, FORMER PARENT NODE REFERENCE FOR THE ADOPTED NODE WILL BE DESTROYED.
        /// </summary>
        /// <param name="p_node">Reference to the node to adopt.</param>
        public void AddChild(XmlTreeNode p_node)
        {
            this.m_childNodes.Add(p_node);

            p_node.m_parentNode = this;


        }
Example #17
0
        /// <summary>
        /// Construct: Creates a XmlTreeNode Based on readings of a XML File
        /// (SHOULD NOT BE USED, PLEASE USE XMLTREE.LOADXML() INSTEAD)
        /// </summary>
        /// <param name="p_XmlReader">Reference to the XmlReader</param>
        /// <param name="p_parent">Reference to the Parent Node</param>
        public XmlTreeNode(XmlReader p_XmlReader, XmlTreeNode p_parent)
        {
            XmlTreeNode tempNode;

            m_nodeName = p_XmlReader.Name;
            m_parentNode = p_parent;
            if (p_XmlReader.NodeType == XmlNodeType.Text)
            {
                m_bIsTextOnly = true;
                m_value = p_XmlReader.Value;

            }
            else
            {
                m_bIsTextOnly = false;
                m_childNodes = new List<XmlTreeNode>();
                m_attributes = new Dictionary<string, string>();

                if (p_XmlReader.HasAttributes)
                {
                    while (p_XmlReader.MoveToNextAttribute())
                    {
                        m_attributes.Add(p_XmlReader.Name, p_XmlReader.Value);
                    }

                }

                p_XmlReader.MoveToElement();

                if (!p_XmlReader.IsEmptyElement)
                {
                    // Si c'est une valeur....
                    if (p_XmlReader.HasValue)
                    {
                        p_XmlReader.Read();
                        m_value = p_XmlReader.Value;

                    }



                    p_XmlReader.Read();

                    // Parse all direct children
                    if (p_XmlReader != null)
                    {
                        while (!((p_XmlReader.NodeType == XmlNodeType.EndElement) && (p_XmlReader.Name == m_nodeName)))
                        {
                            //System.Console.Beep();
                            tempNode = new XmlTreeNode(p_XmlReader, this);
                            if (tempNode.m_bIsTextOnly)
                            {
                                this.m_value = tempNode.m_value;
                            }
                            else
                            {
                                m_childNodes.Add(tempNode);
                            }
                            p_XmlReader.Read();

                        }
                    }
                }
            }

        }
Example #18
0
        /// <summary>
        /// Loads an XML Stream into current XMLTree, destroying any objects in It.
        /// </summary>
        /// <param name="p_Stream"></param>
        public void LoadXML(Stream p_Stream)
        {
            XmlReaderSettings xKeySettings = new XmlReaderSettings();
            xKeySettings.IgnoreWhitespace = true;
            xKeySettings.IgnoreComments = true;

            XmlReader xReader = XmlReader.Create(p_Stream, xKeySettings);
            if (!xReader.IsEmptyElement)
            {
                xReader.Read();
                if (xReader.NodeType == XmlNodeType.XmlDeclaration) xReader.Read();

                m_rootNode = new XmlTreeNode(xReader, null);
            }

            m_rootNode.GetType();
            xReader.Close();
        }
Example #19
0
 public TextureConstNode(XmlTreeNode p_TreeNode, NodeGraphView p_View)
     : base(p_TreeNode, p_View)
 {
     Setup();
     Value = p_TreeNode.m_attributes["Value"];
 }
Example #20
0
        /// <summary>
        /// CLIPBOARD: Copies the selection as a list of Nodes into ClipBoard.
        /// </summary>
        public void CopySelectionToClipboard()
        {
            XmlTree v_ClipboardCopy = new XmlTree("NodeGraphCopy");
            XmlTreeNode v_NodeRoot = v_ClipboardCopy.m_rootNode.AddChild("Nodes");
            XmlTreeNode v_LinksRoot = v_ClipboardCopy.m_rootNode.AddChild("Links");
            // Nodes
            foreach (NodeGraphNode i_Node in this.m_SelectedItems)
            {
                v_NodeRoot.AddChild(i_Node.SerializeToXML(v_ClipboardCopy.m_rootNode));
            }
            // Links

            XmlTreeNode v_CurrentLink;

            foreach (NodeGraphLink i_Link in this.m_Links)
            {
                // if the node is connecting copied nodes
                if (this.m_SelectedItems.Contains(i_Link.Input.Parent) && this.m_SelectedItems.Contains(i_Link.Output.Parent))
                {
                    v_CurrentLink = new XmlTreeNode("ToBeRelinked", v_LinksRoot);
                    v_CurrentLink.AddParameter("InputNodeId", this.GetSelectionNodeIndex(i_Link.Input.Parent).ToString());
                    v_CurrentLink.AddParameter("InputNodeConnectorIdx", i_Link.Input.Parent.GetConnectorIndex(i_Link.Input).ToString());
                    v_CurrentLink.AddParameter("OutputNodeId", this.GetSelectionNodeIndex(i_Link.Output.Parent).ToString());
                    v_CurrentLink.AddParameter("OutputNodeConnectorIdx", i_Link.Output.Parent.GetConnectorIndex(i_Link.Output).ToString());
                    v_LinksRoot.AddChild(v_CurrentLink);
                }

            }

            Clipboard.Clear();
            string v_TempPath = Path.GetTempPath() + "NodeGraphClipboard.xml";
            v_ClipboardCopy.SaveXML(v_TempPath);
            System.Collections.Specialized.StringCollection v_ClipBoardContent = new System.Collections.Specialized.StringCollection();
            v_ClipBoardContent.Add(v_TempPath);
            Clipboard.SetFileDropList(v_ClipBoardContent);
        }
Example #21
0
        /// <summary>
        /// SERIALIZATION: Creates a XML Serialized copy of the link
        /// </summary>
        /// <param name="p_XmlParentTreeNode"></param>
        /// <returns></returns>
        public XmlTreeNode SerializeToXML(XmlTreeNode p_XmlParentTreeNode)
        {
            XmlTreeNode v_Out = new XmlTreeNode(SerializationUtils.GetFullTypeName(this),p_XmlParentTreeNode);

            NodeGraphView v_View = Input.Parent.ParentView;
            NodeGraphNode v_InputNode = Input.Parent;
            NodeGraphNode v_OutputNode = Output.Parent;

            v_Out.AddParameter("InputNodeId", v_View.GetNodeIndex(v_InputNode).ToString());
            v_Out.AddParameter("OutputNodeId", v_View.GetNodeIndex(v_OutputNode).ToString());
            v_Out.AddParameter("InputNodeConnectorIdx",v_InputNode.GetConnectorIndex(Input).ToString());
            v_Out.AddParameter("OutputNodeConnectorIdx", v_OutputNode.GetConnectorIndex(Output).ToString());

            return v_Out;
        }
Example #22
0
        /// <summary>
        /// SERIALIZATION: Creates a NodeGraphLink from XML, used for inherited classes
        /// </summary>
        /// <param name="p_ObjectXml"></param>
        /// <param name="p_View"></param>
        /// <returns></returns>
        public static NodeGraphLink DeserializeFromXML(XmlTreeNode p_ObjectXml, NodeGraphView p_View)
        {
            string className = p_ObjectXml.m_nodeName;

            object[] arguments = { p_ObjectXml, p_View };

            System.Reflection.Assembly v_Assembly = System.Reflection.Assembly.GetExecutingAssembly();

            object v_Out = v_Assembly.CreateInstance(className, false,
                                                    System.Reflection.BindingFlags.CreateInstance,
                                                    null,
                                                    arguments, System.Globalization.CultureInfo.GetCultureInfo("en-us"),
                                                    null);

            return v_Out as NodeGraphLink;
        }
Example #23
0
 public RootNode(XmlTreeNode p_TreeNode, NodeGraphView p_View)
     : base(p_TreeNode, p_View)
 {
     Setup();
 }
Example #24
0
 public Vector4AddNode(XmlTreeNode p_TreeNode, NodeGraphView p_View)
     : base(p_TreeNode, p_View)
 {
     Setup();
 }
Example #25
0
 /// <summary>
 /// Construct: Creates a new XmlTree and its named root
 /// </summary>
 /// <param name="p_RootName">The name of the Root Node</param>
 public XmlTree(string p_RootName)
 {
     m_rootNode = new XmlTreeNode(p_RootName, null);
 }
Example #26
0
 public Vector4ConstNode(XmlTreeNode p_TreeNode, NodeGraphView p_View)
     : base(p_TreeNode, p_View)
 {
     Setup();
     Value = Common.StringConverter.Parse<Vector4>(p_TreeNode.m_attributes["Value"]);
 }
Example #27
0
 public FloatConstNode(XmlTreeNode p_TreeNode, NodeGraphView p_View)
     : base(p_TreeNode, p_View)
 {
     Setup();
     Value = float.Parse(p_TreeNode.m_attributes["Value"]);
 }
Example #28
0
        /// <summary>
        /// XML CONSTRUCTOR: Should not be called by API Users, used for deserialization
        /// </summary>
        /// <param name="p_TreeNode">XmlTreeNode used for Deserialization</param>
        /// <param name="p_View">NodeGraphView Object that will contain the node</param>
        public IfNode(XmlTreeNode p_TreeNode, NodeGraphView p_View)
            : base(p_TreeNode, p_View)
        {
            this.m_sName = "If condition";
            this.m_Connectors.Add(new NodeGraphConnector("A", this, ConnectorType.InputConnector, 0));
            this.m_Connectors.Add(new NodeGraphConnector("B", this, ConnectorType.InputConnector, 1));
            this.m_Connectors.Add(new NodeGraphConnector("A>B", this, ConnectorType.InputConnector, 2));
            this.m_Connectors.Add(new NodeGraphConnector("A=B", this, ConnectorType.InputConnector, 3));
            this.m_Connectors.Add(new NodeGraphConnector("A<B", this, ConnectorType.InputConnector, 4));
            this.m_Connectors.Add(new NodeGraphConnector("Value", this, ConnectorType.OutputConnector, 0));
            this.Height = 110;

            // Parses XML to get back our values.

                    // Since m_eBehavior is an enum, i've stocked it as a string, then use it to compare
                    if (p_TreeNode.m_attributes["Behavior"] == "ErrorOnMissingInput") this.m_eBehavior = IfNodeBehavior.ErrorOnMissingInput;
                    else this.m_eBehavior = IfNodeBehavior.ReturnDefaultValue;

                    // Float values can be a pain because of the type of the dot. It's always encoded as en-us CultureInfo
                    this.m_fDefaultValue = float.Parse(p_TreeNode.m_attributes["DefaultValue"], System.Globalization.CultureInfo.GetCultureInfo("en-us"));

        }
Example #29
0
 /// <summary>
 /// Construct: Creates a XmlTreeNode and sets It in a hierarchy.
 /// </summary>
 /// <param name="p_nodeName">The Node Name</param>
 /// <param name="p_parent">Reference to the parent XmlTreeNode</param>
 public XmlTreeNode(string p_nodeName, XmlTreeNode p_parent)
 {
     m_nodeName = p_nodeName;
     m_childNodes = new List<XmlTreeNode>();
     m_parentNode = p_parent;
     m_attributes = new Dictionary<string, string>();
     m_bIsTextOnly = false;
     m_value = null;
 }
Example #30
0
        /// <summary>
        /// Loads an XML File into current XMLTree, destroying any objects in It.
        /// </summary>
        /// <param name="filename">The filename to load.</param>
        public void LoadXML(string p_filename)
        {
            try
            {
                XmlReaderSettings xKeySettings = new XmlReaderSettings();
                xKeySettings.IgnoreWhitespace = true;
                xKeySettings.IgnoreComments = true;

                XmlReader xReader = XmlReader.Create(p_filename, xKeySettings);
                if (!xReader.IsEmptyElement)
                {
                    xReader.Read();
                    if (xReader.NodeType == XmlNodeType.XmlDeclaration) xReader.Read();

                    m_rootNode = new XmlTreeNode(xReader, null);
                }

                m_rootNode.GetType();
                xReader.Close();

            }
            catch (Exception pe)
            {

                pe.GetHashCode();
            }

        }
Example #31
0
 /// <summary>
 /// (Conception) Creates a new ChildNode for the current node.
 /// </summary>
 /// <param name="p_nodename">Name of the child</param>
 /// <returns>Reference to the child</returns>
 public XmlTreeNode AddChild(string p_nodename)
 {
     XmlTreeNode newNode = new XmlTreeNode(p_nodename, this);
     this.m_childNodes.Add(newNode);
     return (newNode);
 }
Example #32
0
        /// <summary>
        /// (Adoption) Adds an existing Child to this node's children.
        /// NOTE: WHEN ADOPTING, FORMER PARENT NODE REFERENCE FOR THE ADOPTED NODE WILL BE DESTROYED.
        /// </summary>
        /// <param name="p_node">Reference to the node to adopt.</param>
        public void AddChild(XmlTreeNode p_node)
        {
            this.m_childNodes.Add(p_node);

            p_node.m_parentNode = this;
        }
Example #33
0
 /// <summary>
 /// Construct: Creates a new XmlTree and its named root
 /// </summary>
 /// <param name="p_RootName">The name of the Root Node</param>
 public XmlTree(string p_RootName)
 {
     m_rootNode = new XmlTreeNode(p_RootName, null);
 }
Example #34
0
 public NormalMapNode(XmlTreeNode p_TreeNode, NodeGraphView p_View)
     : base(p_TreeNode, p_View)
 {
     Setup();
 }
Example #35
0
        /// <summary>
        /// SERIALIZATION: Serializes current object and all of its children to an XML Node
        /// </summary>
        /// <param name="p_Parent">Parent XML Node used in serialization</param>
        /// <returns>the XML serialized copy of the object</returns>
        public XmlTreeNode SerializeToXML(XmlTreeNode p_Parent)
        {
            XmlTreeNode v_Out = new XmlTreeNode(Xml.SerializationUtils.GetFullTypeName(this),p_Parent);
            v_Out.AddParameter("ViewX", ViewX.ToString());
            v_Out.AddParameter("ViewY", ViewY.ToString());
            v_Out.AddParameter("ViewZoom", ViewZoom.ToString(System.Globalization.CultureInfo.GetCultureInfo("en-us")));

            // Process Nodes
            XmlTreeNode v_NodeCollection = v_Out.AddChild("NodeGraphNodeCollection");
            foreach (NodeGraphNode i_Node in this.NodeCollection)
            {
                v_NodeCollection.AddChild(i_Node.SerializeToXML(v_NodeCollection));
            }

            // Process Links

            XmlTreeNode v_LinksCollection = v_Out.AddChild("NodeGraphLinkCollection");
            foreach (NodeGraphLink i_Link in this.Links)
            {
                v_LinksCollection.AddChild(i_Link.SerializeToXML(v_LinksCollection));
            }

            return v_Out;
        }
Example #36
0
        /// <summary>
        /// Construct: Creates a XmlTreeNode Based on readings of a XML File
        /// (SHOULD NOT BE USED, PLEASE USE XMLTREE.LOADXML() INSTEAD)
        /// </summary>
        /// <param name="p_XmlReader">Reference to the XmlReader</param>
        /// <param name="p_parent">Reference to the Parent Node</param>
        public XmlTreeNode(XmlReader p_XmlReader, XmlTreeNode p_parent)
        {
            XmlTreeNode tempNode;

            m_nodeName   = p_XmlReader.Name;
            m_parentNode = p_parent;
            if (p_XmlReader.NodeType == XmlNodeType.Text)
            {
                m_bIsTextOnly = true;
                m_value       = p_XmlReader.Value;
            }
            else
            {
                m_bIsTextOnly = false;
                m_childNodes  = new List <XmlTreeNode>();
                m_attributes  = new Dictionary <string, string>();

                if (p_XmlReader.HasAttributes)
                {
                    while (p_XmlReader.MoveToNextAttribute())
                    {
                        m_attributes.Add(p_XmlReader.Name, p_XmlReader.Value);
                    }
                }

                p_XmlReader.MoveToElement();

                if (!p_XmlReader.IsEmptyElement)
                {
                    // Si c'est une valeur....
                    if (p_XmlReader.HasValue)
                    {
                        p_XmlReader.Read();
                        m_value = p_XmlReader.Value;
                    }



                    p_XmlReader.Read();

                    // Parse all direct children
                    if (p_XmlReader != null)
                    {
                        while (!((p_XmlReader.NodeType == XmlNodeType.EndElement) && (p_XmlReader.Name == m_nodeName)))
                        {
                            //System.Console.Beep();
                            tempNode = new XmlTreeNode(p_XmlReader, this);
                            if (tempNode.m_bIsTextOnly)
                            {
                                this.m_value = tempNode.m_value;
                            }
                            else
                            {
                                m_childNodes.Add(tempNode);
                            }
                            p_XmlReader.Read();
                        }
                    }
                }
            }
        }
Example #37
0
        /// <summary>
        /// SERIALIZATION: Creates a NodeGraphView from a Serialized XML Copy
        /// </summary>
        /// <param name="p_XmlTreeNode">the parent XmlTreeNode used in serialization</param>
        /// <param name="p_Panel">the panel that will contain this NodeGraphView</param>
        public NodeGraphView(XmlTreeNode p_XmlTreeNode, NodeGraphPanel p_Panel, Dictionary<string, NodeGraphDataType> knownDataTypes)
        {
            System.Globalization.CultureInfo v_IntlCultureInfo = new System.Globalization.CultureInfo("en-us");
            this.m_KnownDataTypes = knownDataTypes;
            this.m_oPanel = p_Panel;
            this.ViewX = int.Parse(p_XmlTreeNode.m_attributes["ViewX"]);
            this.ViewY = int.Parse(p_XmlTreeNode.m_attributes["ViewY"]);
            this.ViewZoom = float.Parse(p_XmlTreeNode.m_attributes["ViewZoom"], v_IntlCultureInfo);
            this.CurrentViewZoom = this.ViewZoom;

            this.m_NodeCollection = new List<NodeGraphNode>();

            XmlTreeNode v_NodesXml = p_XmlTreeNode.GetFirstChild("NodeGraphNodeCollection");
            foreach (XmlTreeNode i_ChildNode in v_NodesXml.m_childNodes)
            {

                    this.m_NodeCollection.Add(NodeGraphNode.DeserializeFromXML(i_ChildNode, this));
            }

            this.m_Links = new List<NodeGraphLink>();

            XmlTreeNode v_LinksXml = p_XmlTreeNode.GetFirstChild("NodeGraphLinkCollection");
            foreach (XmlTreeNode i_ChildLink in v_LinksXml.m_childNodes)
            {
                    this.m_Links.Add(NodeGraphLink.DeserializeFromXML(i_ChildLink, this));
            }

            this.m_SelectedItems = new List<NodeGraphNode>();
        }
Example #38
0
        /// <summary>
        /// Overrides XML Serialization by using base then adding our custom members
        /// </summary>
        /// <param name="p_Parent">Parent Tree Node used in Serialization</param>
        /// <returns>a Serialized Copy of our object</returns>
        public override XmlTreeNode SerializeToXML(XmlTreeNode p_Parent)
        {
            // Base SerializeToXML provides initial work for the XMLTreeNode
            XmlTreeNode v_Out =  base.SerializeToXML(p_Parent);

                // ... then I will encode our custom data
                v_Out.AddParameter("Behavior", m_eBehavior.ToString());
                v_Out.AddParameter("DefaultValue", m_fDefaultValue.ToString(System.Globalization.CultureInfo.GetCultureInfo("en-us")));

            return v_Out;
        }