protected Node(Node node) { m_name = node.Name; m_tag = node.Tag; m_owner = node.Owner; m_attributes = node.Attributes; }
public virtual void PreVisit(IGroupNode group) { System.Console.WriteLine(currentIndentation + "A Drawable of type " + group.GetType().ToString() + " with name: " + group.Name); currentIndentation += indentIncrement; }
public void Write(IGroupNode rootNode, string filePath) { XmlDocument document = new XmlDocument(); AddDeclarationToXmlDocument(document); document.AppendChild(rootNode.ToXmlNodeWithChildNode(document)); document.Save(filePath); }
/// <summary> /// 在指定的文件路径写入文件 /// </summary> /// <param name="filePath"></param> public void Write(IGroupNode rootNode, string filePath) { string directory = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(filePath)); if (!System.IO.Directory.Exists(directory)) { System.IO.Directory.CreateDirectory(directory); } m_xmlWriter.Write(rootNode, filePath); }
public void Read(string filePath) { if (filePath == null) { m_items = m_nodeFactory.CreateGroupNodeFromData(new Internal.ReadArgs()); m_items.Name = DEFAULT_NAME; } else { m_items = new SimpleXmlManager(m_nodeFactory).Read(filePath, Name) as IGroupNode; } }
public void TestAddOrDelete() { string inputPath = "CreateAndReadFile.xml"; string outputPath = "AddOrDeleteFile.xml"; Document doc = Document.ReadAllFrom(inputPath); IGroupNode groupNode = doc.Data.Items.LastChild as IGroupNode; groupNode.Add(new ContentNode() { Content = "测试值", }); doc.Write(outputPath); }
public IItemsLayer AddItemsLayerAtSelectedNode() { IGroupNode node = SelectedNode; if (node is IGroup group) { return(group.AddItemsLayer()); } else if (node is ILayer) { return(node.ParentNode?.AddItemsLayer()); } else { return(AddItemsLayer()); } }
public IGroupNode FindTopMatchingChild(Func <IGroupNode, bool> nodeTester) { for (int i = ChildNodes.Count - 1; i >= 0; i--) { IGroupNode child = ChildNodes[i]; if (nodeTester(child)) { return(child); } IGroupNode match = child.FindTopMatchingChild(nodeTester); if (match != null) { return(match); } } return(null); }
private void Reload(int from, int to) { IGroupNode[] old = (IGroupNode[])SubGroups; if (Field.Count != old.Length) { IGroupNode[] @new = new IGroupNode[Field.Count]; Array.Copy(old, @new, Math.Min(old.Length, @new.Length)); for (int i = old.Length; i < Field.Count; ++i) { @new[i] = ChildCtor(i); } SubGroups = @new; PropertyChanged?.Invoke(this, IGroupNode.SubGroupsChanged); old = @new; } for (int i = from; i < to; ++i) { ChildReloader(i, old[i]); } }
public IGroup AddGroupAtSelectedNode(int maxGroupLevels) { IGroupNode node = SelectedNode; if (node is ILayer) { node = node.ParentNode; } while (node != null && node.NumAncestors >= maxGroupLevels) { node = node.ParentNode; } if (node is IGroup group) { return(group?.AddGroup()); } else { return(AddGroup()); } }
public virtual void PostVisit(IGroupNode group) { currentIndentation = currentIndentation.Substring(0, currentIndentation.Length - indentIncrement.Length); }
public virtual void PreVisit(IGroupNode group) { System.Console.WriteLine(currentIndentation + "Drawable Name: " + group.Name); currentIndentation += indentIncrement; }
public void AddChild(IGroupNode child) { m_ChildNodes.Add(child); child.ParentNode = this; }
public void PreVisit(IGroupNode group) { System.Console.WriteLine(currentIndentation + "A Group node of type " + group.GetType().ToString() + " with name: " + group.Name); currentIndentation += indentIncrement; }
public void PostVisit(IGroupNode group) { currentIndentation = currentIndentation.Substring(0, currentIndentation.Length - indentIncrement.Length); }
public GroupNodeChangedEventArgs(IGroupNode node) { Node = node; }
public void Close() { Release(); m_items = null; }
public void RemoveChild(IGroupNode child) { m_ChildNodes.Remove(child); child.ParentNode = null; }