コード例 #1
0
        private void Append(XmlDocument document, XmlNode node, Group group)
        {
            if (group == null)
            {
                return;
            }

            XmlElement element = group.ToXml(document);
            node.AppendChild(element);

            foreach (Group childGroup in group.Groups)
            {
                this.Append(document, element, childGroup);
            }

            foreach (Entry entry in group.Entries)
            {
                element.AppendChild(entry.ToXml(document));
            }
        }
コード例 #2
0
ファイル: DatabaseNode.cs プロジェクト: petroules/silverlock
        protected void Detach()
        {
            if (this.IsAttached)
            {
                this.DetachFromList();
                DatabaseNode parentTemp = this.parent;
                this.parent = null;

                // Notify the tree that it has been modified and
                // disconnect our modification event from the parent's
                this.TreeModified(this, EventArgs.Empty);
                this.TreeModified -= parentTemp.TreeModified;
            }
        }
コード例 #3
0
        private void ReadGroup(Group group, XmlElement element)
        {
            if (group == null)
            {
                return;
            }

            // Find the first child of the element we were given to process
            XmlNode node = element.FirstChild;
            while (node != null)
            {
                // Convert the node into an element, which should be either a group or entry tag
                XmlElement e = node as XmlElement;
                if (e != null)
                {
                    if (e.Name == DatabaseKeys.XML_GROUP)
                    {
                        Group ourGroup = new Group();
                        ourGroup.FromXml(e);
                        ourGroup.ParentNode = group;

                        // Call the method again to recursively add child nodes to the one we just added
                        this.ReadGroup(ourGroup, e);
                    }
                    else if (e.Name == DatabaseKeys.XML_ENTRY)
                    {
                        // If we found an entry, the process here is simply - read all the
                        // properties and then add it to the group's list of entries
                        Entry entry = new Entry();
                        entry.FromXml(e);
                        entry.ParentNode = group;
                    }
                }

                // Continue on with the loop to process the next sibling node (which can be a group or entry)
                node = node.NextSibling;
            }
        }
コード例 #4
0
ファイル: Entry.cs プロジェクト: petroules/silverlock
 public Entry(string title = "", Group parent = null)
     : base(title)
 {
     this.ParentNode = parent;
 }