Attachment Add and Delete commands implemented

This commit is contained in:
Geoffroy BONNEVILLE
2020-05-07 12:11:12 +02:00
parent ca04a6c8ee
commit e901afaf29
10 changed files with 150 additions and 19 deletions

View File

@@ -244,7 +244,7 @@ namespace ModernKeePass.Infrastructure.KeePass
break;
}
}
public EntryEntity AddHistory(string entryId)
{
var pwEntry = _pwDatabase.RootGroup.FindEntry(BuildIdFromString(entryId), true);
@@ -307,6 +307,18 @@ namespace ModernKeePass.Infrastructure.KeePass
pwGroup.SortSubGroups(false);
}
public void AddAttachment(string entryId, string attachmentName, byte[] attachmentContent)
{
var pwEntry = _pwDatabase.RootGroup.FindEntry(BuildIdFromString(entryId), true);
pwEntry.Binaries.Set(attachmentName, new ProtectedBinary(true, attachmentContent));
}
public void DeleteAttachment(string entryId, string attachmentName)
{
var pwEntry = _pwDatabase.RootGroup.FindEntry(BuildIdFromString(entryId), true);
pwEntry.Binaries.Remove(attachmentName);
}
public EntryEntity GetEntry(string id)
{
var pwEntry = _pwDatabase.RootGroup.FindEntry(BuildIdFromString(id), true);