Beispiel #1
0
        public bool AddEntry(KPEntry entry)
        {
            lock (databaseLock)
            {
                using (var connection = Open())
                {
                    PwGroup parent = GetGroup(entry.GroupID, connection.Database);
                    if (parent == null)
                    {
                        return(false);
                    }

                    PwEntry newEntry = new PwEntry(true, true);
                    newEntry.Strings.Set("Title", new KeePassLib.Security.ProtectedString(false, entry.Name));
                    newEntry.Strings.Set("UserName", new KeePassLib.Security.ProtectedString(false, entry.Username));
                    newEntry.Strings.Set("Password", new KeePassLib.Security.ProtectedString(true, entry.Password));
                    newEntry.Strings.Set("URL", new KeePassLib.Security.ProtectedString(false, entry.Url));

                    parent.AddEntry(newEntry, false);
                    connection.Database.Save(null);

                    entry.ID = newEntry.Uuid.ToHexString();

                    entryCache = null;

                    return(true);
                }
            }
        }
Beispiel #2
0
        public bool AddEntry(KPEntry entry)
        {
            bool result = KeePassContext.Instance.AddEntry(entry);

            if (result)
            {
                Clients.All.entryAdded(entry);
            }

            return(result);
        }