Create entries and groups put them in Edit mode (as before)

Search now uses KeePassLib search
Code cleanup
This commit is contained in:
Geoffroy BONNEVILLE
2020-04-15 12:02:30 +02:00
parent b66e79f97c
commit 0063ef1977
14 changed files with 112 additions and 58 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
@@ -9,6 +10,7 @@ using ModernKeePass.Domain.Entities;
using ModernKeePass.Domain.Enums;
using ModernKeePass.Domain.Interfaces;
using ModernKeePassLib;
using ModernKeePassLib.Collections;
using ModernKeePassLib.Cryptography.KeyDerivation;
using ModernKeePassLib.Interfaces;
using ModernKeePassLib.Keys;
@@ -311,6 +313,21 @@ namespace ModernKeePass.Infrastructure.KeePass
_pwDatabase.MasterKey = CreateCompositeKey(credentials);
}
public IEnumerable<EntryEntity> Search(string groupId, string text)
{
var pwGroup = _pwDatabase.RootGroup.FindGroup(BuildIdFromString(groupId), true);
var searchResults = new PwObjectList<PwEntry>();
pwGroup.SearchEntries(new SearchParameters
{
ComparisonMode = StringComparison.OrdinalIgnoreCase,
SearchInTitles = true,
//SearchInUserNames = true,
SearchString = text
}, searchResults);
return searchResults.Select(e => _mapper.Map<EntryEntity>(e));
}
private CompositeKey CreateCompositeKey(Credentials credentials)
{
var compositeKey = new CompositeKey();