public static XmlTree FromFile(string p_FileName) { XmlTree v_OutXMLTree = new XmlTree("Temporary"); v_OutXMLTree.LoadXML(p_FileName); return(v_OutXMLTree); }
/// <summary> /// SERIALIZATION: Saves the current view and all items to XML File /// </summary> /// <param name="p_FileName"></param> public void SaveCurrentView(string p_FileName) { try { Xml.XmlTree v_OutTree = new Xml.XmlTree("NodeGraphControl"); v_OutTree.m_rootNode.AddChild(this.View.SerializeToXML(v_OutTree.m_rootNode)); v_OutTree.SaveXML(p_FileName); } catch { // ERROR Saving View } }
/// <summary> /// SERIALIZATION: Loads a serialized XML Copy into the current view /// </summary> /// <param name="p_FileName"></param> public void LoadCurrentView(string p_FileName) { try { Xml.XmlTree v_InTree = new Xml.XmlTree("NodeGraphControl"); v_InTree.LoadXML(p_FileName); this.View = new NodeGraphView(v_InTree.m_rootNode.GetFirstChild(Xml.SerializationUtils.GetFullTypeName(this.View)), this); this.UpdateFontSize(); this.Refresh(); }catch{ // ERROR loading View } }
public static XmlTree FromFile(string p_FileName) { XmlTree v_OutXMLTree = new XmlTree("Temporary"); v_OutXMLTree.LoadXML(p_FileName); return v_OutXMLTree; }
/// <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); }
public void LoadCurrentViewPure(string p_FileName) { Xml.XmlTree v_InTree = new Xml.XmlTree("NodeGraphControl"); v_InTree.LoadXML(p_FileName); this.View = new NodeGraphView(v_InTree.m_rootNode.GetFirstChild(Xml.SerializationUtils.GetFullTypeName(this.View)), this, this.View.KnownDataTypes); }