public override bool Equals(object obj) { KdbxAutoType other = obj as KdbxAutoType; if (other == null) { return(false); } return(XElement.DeepEquals(this.original, other.original)); }
public KdbxEntry(XElement xml, IKeePassGroup parent, IRandomNumberGenerator rng, KdbxMetadata metadata, KdbxSerializationParameters parameters) : base(xml, parameters) { Parent = parent; ForegroundColor = GetNullableColor("ForegroundColor"); BackgroundColor = GetNullableColor("BackgroundColor"); OverrideUrl = GetString("OverrideURL") ?? string.Empty; Tags = GetString("Tags") ?? string.Empty; Fields = new ObservableCollection <IProtectedString>(); IEnumerable <KdbxString> strings = GetNodes(KdbxString.RootName) .Select(x => new KdbxString(x, rng)); foreach (KdbxString s in strings) { switch (s.Key) { case "Notes": Notes = s; break; case "Password": Password = s; break; case "Title": Title = s; break; case "URL": Url = s; break; case "UserName": UserName = s; break; default: Fields.Add(s); break; } } KdbxMemoryProtection memProtection = metadata.MemoryProtection; if (Password == null) { Password = new KdbxString("Password", string.Empty, rng, memProtection.ProtectPassword); } if (Title == null) { Title = new KdbxString("Title", string.Empty, rng, memProtection.ProtectTitle); } if (Url == null) { Url = new KdbxString("URL", string.Empty, rng, memProtection.ProtectUrl); } if (UserName == null) { UserName = new KdbxString("UserName", string.Empty, rng, memProtection.ProtectUserName); } if (Notes == null) { Notes = new KdbxString("Notes", string.Empty, rng, memProtection.ProtectNotes); } IEnumerable <KdbxBinAttachment> binNodes = GetNodes(KdbxBinAttachment.RootName).Select(x => new KdbxBinAttachment(x, metadata, parameters)); Binaries = new ObservableCollection <IKeePassBinAttachment>(binNodes); XElement autoTypeNode = GetNode(KdbxAutoType.RootName); if (autoTypeNode != null) { AutoType = new KdbxAutoType(autoTypeNode); } XElement historyElement = GetNode(KdbxHistory.RootName); if (historyElement != null) { History = new KdbxHistory(historyElement, rng, metadata, parameters); } else { History = new KdbxHistory(metadata); } this._metadata = metadata; }