Example #1
0
        public List<string> GetDataList(Entry entry)
        {
            List<string> dataItems = new List<string>();

            if (this.SearchTitle)
            {
                dataItems.Add(entry.Title);
            }

            if (this.SearchUsername)
            {
                dataItems.Add(entry.Username);
            }

            if (this.SearchPassword)
            {
                dataItems.Add(entry.Password);
            }

            if (this.SearchURL)
            {
                dataItems.Add(entry.URL.ToString());
            }

            if (this.SearchNotes)
            {
                dataItems.Add(entry.Notes);
            }

            if (this.SearchRecovery)
            {
                foreach (var i in entry.RecoveryInfo)
                {
                    dataItems.Add(i.Key);
                    dataItems.Add(i.Value);
                }
            }

            if (this.SearchCustomFields)
            {
                foreach (var i in entry.CustomFields)
                {
                    dataItems.Add(i.Key);
                    dataItems.Add(i.Value);
                }
            }

            // If the entry doesn't have a parent node we won't check its group title
            if (this.SearchGroupTitle && entry.ParentNode != null)
            {
                dataItems.Add(entry.ParentNode.Title);
            }

            if (this.SearchUUID)
            {
                dataItems.Add(entry.UUID.ToString());
            }

            return dataItems;
        }
Example #2
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;
            }
        }
Example #3
0
        public Entry CreateCopy()
        {
            Entry entry = new Entry();
            entry.Title = this.Title;
            entry.Username = this.Username;
            entry.Password = this.Password;
            entry.URL = this.URL;
            entry.Notes = this.Notes;

            foreach (var i in this.RecoveryInfo)
            {
                entry.InsertRecoveryInfo(i.Key, i.Value);
            }

            foreach (var i in this.CustomFields)
            {
                entry.InsertCustomField(i.Key, i.Value);
            }

            return entry;
        }