public static void ReorderEntriesAsInDatabase(PwObjectList <PwEntry> v, PwDatabase pd) { if ((v == null) || (pd == null)) { Debug.Assert(false); return; } PwObjectList <PwEntry> vRem = v.CloneShallow(); v.Clear(); EntryHandler eh = delegate(PwEntry pe) { int p = vRem.IndexOf(pe); if (p >= 0) { v.Add(pe); vRem.RemoveAt((uint)p); } return(true); }; pd.RootGroup.TraverseTree(TraversalMethod.PreOrder, null, eh); foreach (PwEntry peRem in vRem) { v.Add(peRem); // Entries not found } }
/// <summary> /// Search this group and all subgroups for entries. /// </summary> /// <param name="sp">Specifies the search parameters.</param> /// <param name="lResults">Entry list in which the search results /// will be stored.</param> /// <param name="slStatus">Optional status reporting object.</param> public void SearchEntries(SearchParameters sp, PwObjectList <PwEntry> lResults, IStatusLogger slStatus) { if (sp == null) { Debug.Assert(false); return; } if (lResults == null) { Debug.Assert(false); return; } Debug.Assert(lResults.UCount == 0); lResults.Clear(); PwSearchMode sm = sp.SearchMode; if ((sm == PwSearchMode.Simple) || (sm == PwSearchMode.Regular)) { SrsmSearch(sp, lResults, slStatus); } else if (sm == PwSearchMode.XPath) { SrxpSearch(sp, lResults, slStatus); } else { Debug.Assert(false); } }
public static void ReorderEntriesAsInDatabase(PwObjectList<PwEntry> v, PwDatabase pd) { if((v == null) || (pd == null)) { Debug.Assert(false); return; } if(pd.RootGroup == null) { Debug.Assert(false); return; } // DB must be open PwObjectList<PwEntry> vRem = v.CloneShallow(); v.Clear(); EntryHandler eh = delegate(PwEntry pe) { int p = vRem.IndexOf(pe); if(p >= 0) { v.Add(pe); vRem.RemoveAt((uint)p); } return true; }; pd.RootGroup.TraverseTree(TraversalMethod.PreOrder, null, eh); foreach(PwEntry peRem in vRem) v.Add(peRem); // Entries not found }