public IKeePassEntry CreateEntry(string title) { var pwEntry = new PwEntry(true, true); _group.AddEntry(pwEntry, true); Database.Modified = true; var wrapped = new KbdxEntry(pwEntry, Database, this) { Title = title }; Entries.Add(wrapped); return wrapped; }
public IKeePassEntry AddEntry(IKeePassEntry entry) { var pwEntry = new PwEntry(true, true); if (!string.IsNullOrEmpty(entry.Title)) { pwEntry.Strings.Set(PwDefs.TitleField, new ProtectedString(true, entry.Title)); } if (!string.IsNullOrEmpty(entry.UserName)) { pwEntry.Strings.Set(PwDefs.UserNameField, new ProtectedString(true, entry.UserName)); } if (!string.IsNullOrEmpty(entry.Password)) { pwEntry.Strings.Set(PwDefs.PasswordField, new ProtectedString(true, entry.Password)); } if (!string.IsNullOrEmpty(entry.Notes)) { pwEntry.Strings.Set(PwDefs.NotesField, new ProtectedString(true, entry.Notes)); } if (!string.IsNullOrEmpty(entry.Url)) { pwEntry.Strings.Set(PwDefs.UrlField, new ProtectedString(true, entry.Url)); } _group.AddEntry(pwEntry, true); Database.Modified = true; var wrapped = new KbdxEntry(pwEntry, Database, this); Entries.Add(wrapped); return(wrapped); }