public string GetAutoTypeSequence() { string strSeq = m_listAutoType.DefaultSequence; PwGroup pg = m_pParentGroup; while (pg != null) { if (strSeq.Length != 0) { break; } strSeq = pg.DefaultAutoTypeSequence; pg = pg.ParentGroup; } if (strSeq.Length != 0) { return(strSeq); } if (PwDefs.IsTanEntry(this)) { return(PwDefs.DefaultAutoTypeSequenceTan); } return(PwDefs.DefaultAutoTypeSequence); }
private PwGroup SrxpFilterCloneSelf(SearchParameters sp) { PwGroup pgNew = CloneDeep(); pgNew.ParentGroup = null; DateTime dtNow = DateTime.UtcNow; GroupHandler gh = delegate(PwGroup pg) { if (!sp.SearchInGroupNames) { pg.Name = string.Empty; } if (!sp.SearchInTags) { pg.Tags.Clear(); } PwObjectList <PwEntry> l = pg.Entries; for (int i = (int)l.UCount - 1; i >= 0; --i) { PwEntry pe = l.GetAt((uint)i); if (sp.ExcludeExpired && pe.Expires && (pe.ExpiryTime <= dtNow)) { } else if (sp.RespectEntrySearchingDisabled && !pe.GetSearchingEnabled()) { } else { continue; } l.RemoveAt((uint)i); } return(true); }; EntryHandler eh = delegate(PwEntry pe) { SrxpClearString(!sp.SearchInTitles, pe, PwDefs.TitleField); SrxpClearString(!sp.SearchInUserNames, pe, PwDefs.UserNameField); SrxpClearString(!sp.SearchInPasswords, pe, PwDefs.PasswordField); SrxpClearString(!sp.SearchInUrls, pe, PwDefs.UrlField); SrxpClearString(!sp.SearchInNotes, pe, PwDefs.NotesField); if (!sp.SearchInOther) { List <string> lKeys = pe.Strings.GetKeys(); foreach (string strKey in lKeys) { SrxpClearString(!PwDefs.IsStandardField(strKey), pe, strKey); } } if (!sp.SearchInTags) { pe.Tags.Clear(); } if (!sp.SearchInHistory) { pe.History.Clear(); } return(true); }; gh(pgNew); pgNew.TraverseTree(TraversalMethod.PreOrder, gh, eh); return(pgNew); }
private static bool SrsmIsMatch(SearchParameters sp, Regex rx, PwEntry pe) { if (sp == null) { Debug.Assert(false); return(false); } foreach (KeyValuePair <string, ProtectedString> kvp in pe.Strings) { string strKey = kvp.Key; ProtectedString ps = kvp.Value; switch (strKey) { case PwDefs.TitleField: if (sp.SearchInTitles && SrsmIsMatch(sp, rx, pe, ps.ReadString())) { return(true); } break; case PwDefs.UserNameField: if (sp.SearchInUserNames && SrsmIsMatch(sp, rx, pe, ps.ReadString())) { return(true); } break; case PwDefs.PasswordField: if (sp.SearchInPasswords && SrsmIsMatch(sp, rx, pe, ps.ReadString())) { return(true); } break; case PwDefs.UrlField: if (sp.SearchInUrls && SrsmIsMatch(sp, rx, pe, ps.ReadString())) { return(true); } break; case PwDefs.NotesField: if (sp.SearchInNotes && SrsmIsMatch(sp, rx, pe, ps.ReadString())) { return(true); } break; default: Debug.Assert(!PwDefs.IsStandardField(strKey)); if (sp.SearchInOther && SrsmIsMatch(sp, rx, pe, ps.ReadString())) { return(true); } break; } if (sp.SearchInStringNames && SrsmIsMatch(sp, rx, pe, strKey)) { return(true); } } if (sp.SearchInTags) { foreach (string strTag in pe.GetTagsInherited()) { if (SrsmIsMatch(sp, rx, pe, strTag)) { return(true); } } } if (sp.SearchInUuids && SrsmIsMatch(sp, rx, pe, pe.Uuid.ToHexString())) { return(true); } if (sp.SearchInGroupPaths && (pe.ParentGroup != null) && SrsmIsMatch(sp, rx, pe, pe.ParentGroup.GetFullPath("\n", true))) { return(true); } if (sp.SearchInGroupNames && (pe.ParentGroup != null) && SrsmIsMatch(sp, rx, pe, pe.ParentGroup.Name)) { return(true); } if (sp.SearchInHistory) { foreach (PwEntry peHist in pe.History) { if (SrsmIsMatch(sp, rx, peHist)) { return(true); } } } return(false); }