Example #1
0
        public IKeePassGroup Clone()
        {
            KdbxGroup clone = new KdbxGroup()
            {
                Parent = Parent
            };

            if (Title != null)
            {
                clone.Title = Title.Clone();
            }
            else
            {
                clone.Title = null;
            }
            clone.Uuid = Uuid.Clone();
            if (Notes != null)
            {
                clone.Notes = Notes.Clone();
            }
            else
            {
                clone.Notes = null;
            }
            clone.IconID = IconID;
            if (CustomIconUuid != null)
            {
                clone.CustomIconUuid = CustomIconUuid.Clone();
            }
            else
            {
                clone.CustomIconUuid = null;
            }
            clone.Times      = Times.Clone();
            clone.IsExpanded = IsExpanded;
            clone.DefaultAutoTypeSequence = DefaultAutoTypeSequence;
            clone.EnableAutoType          = EnableAutoType;
            clone.EnableSearching         = EnableSearching;
            if (LastTopVisibleEntry != null)
            {
                clone.LastTopVisibleEntry = LastTopVisibleEntry.Clone();
            }
            else
            {
                clone.LastTopVisibleEntry = null;
            }
            clone._children = Children;
            if (CustomData != null)
            {
                clone.CustomData = CustomData.Clone();
            }
            else
            {
                clone.CustomData = null;
            }
            return(clone);
        }
Example #2
0
        public override bool Equals(object obj)
        {
            KdbxGroup other = obj as KdbxGroup;

            if (other == null)
            {
                return(false);
            }

            if (Parent != null)
            {
                if (other.Parent == null)
                {
                    return(false);
                }
                if (!Parent.Uuid.Equals(other.Parent.Uuid))
                {
                    return(false);
                }
            }
            else
            {
                if (other.Parent != null)
                {
                    return(false);
                }
            }

            if (!Uuid.Equals(other.Uuid))
            {
                return(false);
            }

            if (!Title.Equals(other.Title) || !Notes.Equals(other.Notes))
            {
                return(false);
            }

            if (IconID != other.IconID)
            {
                return(false);
            }

            if (CustomIconUuid != null)
            {
                if (!CustomIconUuid.Equals(other.CustomIconUuid))
                {
                    return(false);
                }
            }
            else
            {
                if (other.CustomIconUuid != null)
                {
                    return(false);
                }
            }

            if (!Times.Equals(other.Times))
            {
                return(false);
            }

            if (IsExpanded != other.IsExpanded || !LastTopVisibleEntry.Equals(other.LastTopVisibleEntry))
            {
                return(false);
            }

            if (DefaultAutoTypeSequence != other.DefaultAutoTypeSequence ||
                EnableAutoType != other.EnableAutoType ||
                EnableSearching != other.EnableSearching)
            {
                return(false);
            }

            int childCount = Children.Count;

            if (childCount != other.Children.Count)
            {
                return(false);
            }

            for (int i = 0; i < childCount; i++)
            {
                if (!Children[i].Equals(other.Children[i]))
                {
                    return(false);
                }
            }

            if (CustomData != null)
            {
                if (!CustomData.Equals(other.CustomData))
                {
                    return(false);
                }
            }
            else
            {
                if (other.CustomData != null)
                {
                    return(false);
                }
            }

            return(true);
        }