File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed
Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 1010 <projectUrl >https://github.com/passxyz/KPCLib</projectUrl >
1111 <description >This is an extension of KPCLib.</description >
1212 <releaseNotes >
13- - Removed dependencies
14- - Added Delete function in Class User
13+ - Added FindEntryById()
1514 </releaseNotes >
1615 <copyright >Roger Ye</copyright >
1716 <repository url =" https://github.com/passxyz/KPCLib" />
Original file line number Diff line number Diff line change 77using SkiaSharp ;
88
99using KeePassLib ;
10- using KeePassLib . Interfaces ;
10+ using KeePassLib . Delegates ;
1111using KeePassLib . Keys ;
1212using KeePassLib . Security ;
1313using KeePassLib . Serialization ;
@@ -540,6 +540,33 @@ PwGroup FindSubgroup(PwGroup group, string name)
540540 }
541541
542542
543+ /// <summary>
544+ /// Find an entry by Uuid
545+ /// </summary>
546+ /// <param name="uuid">The entry uuid</param>
547+ /// <returns>Entry found or return <c>null</c> if the entry cannot be found</returns>
548+ public PwEntry FindEntryById ( string id )
549+ {
550+ PwEntry targetEntry = null ;
551+
552+ EntryHandler eh = delegate ( PwEntry pe )
553+ {
554+ PwUuid pu = pe . Uuid ;
555+ string hexStr = pu . ToHexString ( ) ;
556+ if ( hexStr . Equals ( id ) )
557+ {
558+ targetEntry = pe ;
559+ return false ;
560+ }
561+
562+ return true ;
563+ } ;
564+
565+ RootGroup . TraverseTree ( TraversalMethod . PreOrder , null , eh ) ;
566+
567+ return targetEntry ;
568+ }
569+
543570 /// <summary>
544571 /// Delete a group.
545572 /// </summary>
You can’t perform that action at this time.
0 commit comments